refactor: don't use AppIndicatorIcon directly (#15536)
This commit is contained in:
parent
3a3b197327
commit
934a7fc118
4 changed files with 111 additions and 61 deletions
|
@ -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);
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue