diff options
author | sidharthms@chromium.org <sidharthms@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-07-31 23:36:14 +0000 |
---|---|---|
committer | sidharthms@chromium.org <sidharthms@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-07-31 23:36:14 +0000 |
commit | b6c510aa543193337041517c2d70113840189b06 (patch) | |
tree | 05d44d4f51ce5e20ea42aa619c96813ac3cb61d1 /chrome/browser/background | |
parent | 1e931f67fc33fd748bf1d52b1a815c5d5138565b (diff) | |
download | chromium_src-b6c510aa543193337041517c2d70113840189b06.zip chromium_src-b6c510aa543193337041517c2d70113840189b06.tar.gz chromium_src-b6c510aa543193337041517c2d70113840189b06.tar.bz2 |
Status tray refactor and no-menu status icon support on Linux
The status tray interface has been refactored to require an image as well as a
tool tip as parameters to the status icon factory method. This is because
creating a status icon without at least an icon would not make much sense (all
current use cases set an image also). A tool-tip text can come in handy in many
ways. Apart from the showing a description of the icon it is quite useful in
cases when there is no menu set for the status icon. Platforms like Ubuntu Unity
will not create a status icon for us unless we set a menu so we could use the
tool-tip as a single item menu.
Consequently Linux app indicator implementation has been modified to support
icons with no menus since we can now use the tool-tip to create the menu as a
fallback. Also some string resources previously taking product names as
parameters have been moved into chromium_strings.grd and
google_chrome_strings.grd since it is the correct way to do include the product
name in a string resource.
BUG=262372
Review URL: https://chromiumcodereview.appspot.com/19482010
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@214864 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/background')
-rw-r--r-- | chrome/browser/background/background_mode_manager.cc | 15 |
1 files changed, 7 insertions, 8 deletions
diff --git a/chrome/browser/background/background_mode_manager.cc b/chrome/browser/background/background_mode_manager.cc index b925aba..579f031 100644 --- a/chrome/browser/background/background_mode_manager.cc +++ b/chrome/browser/background/background_mode_manager.cc @@ -665,17 +665,16 @@ void BackgroundModeManager::CreateStatusTrayIcon() { if (!status_tray_ || status_icon_) return; - status_icon_ = - status_tray_->CreateStatusIcon(StatusTray::BACKGROUND_MODE_ICON); - if (!status_icon_) - return; - - // Set the image and add ourselves as a click observer on it. // TODO(rlp): Status tray icon should have submenus for each profile. gfx::ImageSkia* image_skia = ui::ResourceBundle::GetSharedInstance(). GetImageSkiaNamed(IDR_STATUS_TRAY_ICON); - status_icon_->SetImage(*image_skia); - status_icon_->SetToolTip(l10n_util::GetStringUTF16(IDS_PRODUCT_NAME)); + + status_icon_ = status_tray_->CreateStatusIcon( + StatusTray::BACKGROUND_MODE_ICON, + *image_skia, + l10n_util::GetStringUTF16(IDS_PRODUCT_NAME)); + if (!status_icon_) + return; UpdateStatusTrayIconContextMenu(); } |