mirror of
https://github.com/electron/electron.git
synced 2026-04-10 03:01:51 -04:00
refactor: don't use AppIndicatorIcon directly (#15536)
This commit is contained in:
@@ -8,19 +8,11 @@
|
||||
#include "atom/common/application_info.h"
|
||||
#include "base/strings/stringprintf.h"
|
||||
#include "base/strings/utf_string_conversions.h"
|
||||
#include "chrome/browser/ui/libgtkui/app_indicator_icon.h"
|
||||
#include "chrome/browser/ui/libgtkui/gtk_status_icon.h"
|
||||
#include "ui/gfx/image/image.h"
|
||||
#include "ui/views/linux_ui/linux_ui.h"
|
||||
|
||||
namespace atom {
|
||||
|
||||
namespace {
|
||||
|
||||
// Number of app indicators used (used as part of app-indicator id).
|
||||
int indicators_count;
|
||||
|
||||
} // namespace
|
||||
|
||||
TrayIconGtk::TrayIconGtk() {}
|
||||
|
||||
TrayIconGtk::~TrayIconGtk() {}
|
||||
@@ -32,16 +24,8 @@ void TrayIconGtk::SetImage(const gfx::Image& image) {
|
||||
}
|
||||
|
||||
const auto toolTip = base::UTF8ToUTF16(GetApplicationName());
|
||||
|
||||
if (libgtkui::AppIndicatorIcon::CouldOpen()) {
|
||||
++indicators_count;
|
||||
icon_.reset(new libgtkui::AppIndicatorIcon(
|
||||
base::StringPrintf("%s%d", Browser::Get()->GetName().c_str(),
|
||||
indicators_count),
|
||||
image.AsImageSkia(), toolTip));
|
||||
} else {
|
||||
icon_.reset(new libgtkui::Gtk2StatusIcon(image.AsImageSkia(), toolTip));
|
||||
}
|
||||
icon_ = views::LinuxUI::instance()->CreateLinuxStatusIcon(
|
||||
image.AsImageSkia(), toolTip, Browser::Get()->GetName().c_str());
|
||||
icon_->set_delegate(this);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user