diff options
author | sail@chromium.org <sail@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-04-23 05:37:11 +0000 |
---|---|---|
committer | sail@chromium.org <sail@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-04-23 05:37:11 +0000 |
commit | 2735ec6e28e688ad7f60fc4fa7f9315124ba2b96 (patch) | |
tree | 216311d2362658f36742ed67a1a25df6ee68839e | |
parent | b9d4a36706c85ded24be4056967142a6fa457050 (diff) | |
download | chromium_src-2735ec6e28e688ad7f60fc4fa7f9315124ba2b96.zip chromium_src-2735ec6e28e688ad7f60fc4fa7f9315124ba2b96.tar.gz chromium_src-2735ec6e28e688ad7f60fc4fa7f9315124ba2b96.tar.bz2 |
Wrench Menu Icons: Use new icons
Here's a doc with screenshots of everything that's changing:
https://docs.google.com/a/chromium.org/document/d/18uAqIl1oPJRpji8lNMCi1om1iqsHKd6oNI2Onptp6Y4/edit?usp=sharing
The basic idea is:
- all update related UI will use the green, yellow and red up arrow icon
- all non-update related UI will use the yellow exclamation icon
For now we're not planning to have a green or red exclamation icon.
BUG=180107
Review URL: https://chromiumcodereview.appspot.com/14317003
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@195727 0039d316-1c4b-4281-b951-d872f2087c98
17 files changed, 68 insertions, 92 deletions
diff --git a/chrome/app/theme/theme_resources.grd b/chrome/app/theme/theme_resources.grd index 5814b11..35ccf7a 100644 --- a/chrome/app/theme/theme_resources.grd +++ b/chrome/app/theme/theme_resources.grd @@ -128,9 +128,7 @@ <structure type="chrome_scaled_image" name="IDR_BROWSER_ACTIONS_OVERFLOW_P" file="common/browser_actions_overflow_pressed.png" /> <structure type="chrome_scaled_image" name="IDR_CLOSE_BUTTON_MASK" file="close_button_mask.png" /> <if expr="is_win"> - <structure type="chrome_scaled_image" name="IDR_CONFLICT_BADGE" file="conflict_badge.png" /> <structure type="chrome_scaled_image" name="IDR_CONFLICT_FAVICON" file="common/favicon_conflicts.png" /> - <structure type="chrome_scaled_image" name="IDR_CONFLICT_MENU" file="conflict_menu.png" /> </if> <structure type="chrome_scaled_image" name="IDR_CONSTRAINED_BOTTOM_CENTER_V" file="constrained_bottom_center_vista.png" /> <structure type="chrome_scaled_image" name="IDR_CONSTRAINED_BOTTOM_LEFT_CORNER_V" file="constrained_bottom_left_corner_vista.png" /> @@ -403,8 +401,9 @@ <structure type="chrome_scaled_image" name="IDR_INFOBAR_SYNC" file="infobar_sync.png" /> <structure type="chrome_scaled_image" name="IDR_INFOBAR_THEME" file="infobar_theme.png" /> <structure type="chrome_scaled_image" name="IDR_INFOBAR_TRANSLATE" file="infobar_translate.png" /> - <structure type="chrome_scaled_image" name="IDR_INPUT_ALERT" file="input_alert.png" /> - <structure type="chrome_scaled_image" name="IDR_INPUT_GOOD" file="input_good.png" /> + <structure type="chrome_scaled_image" name="IDR_INPUT_ALERT" file="common/input_alert.png" /> + <structure type="chrome_scaled_image" name="IDR_INPUT_ALERT_MENU" file="common/input_alert_menu.png" /> + <structure type="chrome_scaled_image" name="IDR_INPUT_GOOD" file="common/input_good.png" /> <structure type="chrome_scaled_image" name="IDR_KEYWORD_SEARCH_MAGNIFIER" file="keyword_search_magnifier.png" /> <structure type="chrome_scaled_image" name="IDR_KILLED_TAB" file="killtab.png" /> <structure type="chrome_scaled_image" name="IDR_LAPTOP_FAVICON" file="common/favicon_laptop.png" /> @@ -886,20 +885,17 @@ <structure type="chrome_scaled_image" name="IDR_TOOLS_BAR_MEDIUM" file="common/browser_tools_bar_medium.png" /> <structure type="chrome_scaled_image" name="IDR_TOOLS_BAR_HIGH" file="common/browser_tools_bar_high.png" /> - <structure type="chrome_scaled_image" name="IDR_UPDATE_AVAILABLE" file="update_available.png" /> - <structure type="chrome_scaled_image" name="IDR_UPDATE_BADGE" file="update_badge.png" /> - <structure type="chrome_scaled_image" name="IDR_UPDATE_BADGE2" file="update_badge2.png" /> - <structure type="chrome_scaled_image" name="IDR_UPDATE_BADGE3" file="update_badge3.png" /> - <structure type="chrome_scaled_image" name="IDR_UPDATE_BADGE4" file="update_badge4.png" /> - <!-- TODO(mpcomplete): need icon for IDR_UPDATE_*_EXTENSION --> - <structure type="chrome_scaled_image" name="IDR_UPDATE_BADGE_EXTENSION" file="external_extension_install_badge.png" /> - <structure type="chrome_scaled_image" name="IDR_UPDATE_FAIL" file="update_fail.png" /> - <structure type="chrome_scaled_image" name="IDR_UPDATE_MENU" file="update_menu.png" /> - <structure type="chrome_scaled_image" name="IDR_UPDATE_MENU2" file="update_menu2.png" /> - <structure type="chrome_scaled_image" name="IDR_UPDATE_MENU3" file="update_menu3.png" /> - <structure type="chrome_scaled_image" name="IDR_UPDATE_MENU4" file="update_menu4.png" /> - <structure type="chrome_scaled_image" name="IDR_UPDATE_MENU_EXTENSION" file="external_extension_install_menu.png" /> - <structure type="chrome_scaled_image" name="IDR_UPDATE_UPTODATE" file="update_uptodate.png" /> + <if expr="not is_macosx and not pp_ifdef('toolkit_views')"> + <structure type="chrome_scaled_image" name="IDR_UPDATE_BADGE" file="update_badge.png" /> + <structure type="chrome_scaled_image" name="IDR_UPDATE_BADGE2" file="update_badge2.png" /> + <structure type="chrome_scaled_image" name="IDR_UPDATE_BADGE3" file="update_badge3.png" /> + <structure type="chrome_scaled_image" name="IDR_UPDATE_BADGE4" file="update_badge4.png" /> + </if> + <structure type="chrome_scaled_image" name="IDR_UPDATE_FAIL" file="common/update_fail.png" /> + <structure type="chrome_scaled_image" name="IDR_UPDATE_MENU_SEVERITY_LOW" file="common/update_menu_severity_low.png" /> + <structure type="chrome_scaled_image" name="IDR_UPDATE_MENU_SEVERITY_MEDIUM" file="common/update_menu_severity_medium.png" /> + <structure type="chrome_scaled_image" name="IDR_UPDATE_MENU_SEVERITY_HIGH" file="common/update_menu_severity_high.png" /> + <structure type="chrome_scaled_image" name="IDR_UPDATE_UPTODATE" file="common/update_uptodate.png" /> <if expr="pp_ifdef('chromeos')"> <structure type="chrome_scaled_image" name="IDR_USER_IMAGE_CAPTURE" file="snapshot_wide.png" /> <structure type="chrome_scaled_image" name="IDR_USER_IMAGE_CAPTURE_DISABLED" file="snapshot_wide_disabled.png" /> diff --git a/chrome/browser/extensions/extension_disabled_ui.cc b/chrome/browser/extensions/extension_disabled_ui.cc index 1822853..8767dd3 100644 --- a/chrome/browser/extensions/extension_disabled_ui.cc +++ b/chrome/browser/extensions/extension_disabled_ui.cc @@ -138,7 +138,6 @@ class ExtensionDisabledGlobalError : public GlobalError, virtual bool HasMenuItem() OVERRIDE; virtual int MenuItemCommandID() OVERRIDE; virtual string16 MenuItemLabel() OVERRIDE; - virtual int MenuItemIconResourceID() OVERRIDE; virtual void ExecuteMenuItem(Browser* browser) OVERRIDE; virtual bool HasBubbleView() OVERRIDE; virtual string16 GetBubbleViewTitle() OVERRIDE; @@ -211,10 +210,6 @@ int ExtensionDisabledGlobalError::MenuItemCommandID() { return menu_command_id_; } -int ExtensionDisabledGlobalError::MenuItemIconResourceID() { - return IDR_UPDATE_MENU; -} - string16 ExtensionDisabledGlobalError::MenuItemLabel() { return l10n_util::GetStringFUTF16(IDS_EXTENSION_DISABLED_ERROR_TITLE, UTF8ToUTF16(extension_->name())); diff --git a/chrome/browser/extensions/external_install_ui.cc b/chrome/browser/extensions/external_install_ui.cc index 5a9e6f4..c2a1126 100644 --- a/chrome/browser/extensions/external_install_ui.cc +++ b/chrome/browser/extensions/external_install_ui.cc @@ -96,7 +96,6 @@ class ExternalInstallMenuAlert : public GlobalError, virtual bool HasMenuItem() OVERRIDE; virtual int MenuItemCommandID() OVERRIDE; virtual string16 MenuItemLabel() OVERRIDE; - virtual int MenuItemIconResourceID() OVERRIDE; virtual void ExecuteMenuItem(Browser* browser) OVERRIDE; virtual bool HasBubbleView() OVERRIDE; virtual string16 GetBubbleViewTitle() OVERRIDE; @@ -222,10 +221,6 @@ int ExternalInstallMenuAlert::MenuItemCommandID() { return kMenuCommandId; } -int ExternalInstallMenuAlert::MenuItemIconResourceID() { - return IDR_UPDATE_MENU_EXTENSION; -} - string16 ExternalInstallMenuAlert::MenuItemLabel() { int id = -1; if (extension_->is_app()) diff --git a/chrome/browser/resources/help/help.css b/chrome/browser/resources/help/help.css index e274e8ec..59e544b 100644 --- a/chrome/browser/resources/help/help.css +++ b/chrome/browser/resources/help/help.css @@ -60,11 +60,6 @@ body { width: 17px; } -#update-status-icon.available { - background-image: url('chrome://theme/IDR_UPDATE_AVAILABLE'); - background-size: 17px; -} - #update-status-icon.up-to-date { background-image: url('chrome://theme/IDR_UPDATE_UPTODATE'); background-size: 17px; diff --git a/chrome/browser/ui/cocoa/toolbar/toolbar_controller.mm b/chrome/browser/ui/cocoa/toolbar/toolbar_controller.mm index 7fff2a1..5918bfb 100644 --- a/chrome/browser/ui/cocoa/toolbar/toolbar_controller.mm +++ b/chrome/browser/ui/cocoa/toolbar/toolbar_controller.mm @@ -571,8 +571,7 @@ class NotificationBridge GlobalError* error = GlobalErrorServiceFactory::GetForProfile( browser_->profile())->GetHighestSeverityGlobalErrorWithWrenchMenuItem(); if (error) { - [cell setSeverity:WrenchIconPainter::SeverityFromGlobalErrorSeverity( - error->GetSeverity()) + [cell setSeverity:WrenchIconPainter::GlobalErrorSeverity() shouldAnimate:YES]; return; } diff --git a/chrome/browser/ui/global_error/global_error.cc b/chrome/browser/ui/global_error/global_error.cc index c6e7627..fce33ef 100644 --- a/chrome/browser/ui/global_error/global_error.cc +++ b/chrome/browser/ui/global_error/global_error.cc @@ -21,7 +21,9 @@ GlobalError::Severity GlobalError::GetSeverity() { } int GlobalError::MenuItemIconResourceID() { - return IDR_UPDATE_MENU4; + // If you change this make sure to also change the bubble icon and the wrench + // icon color. + return IDR_INPUT_ALERT_MENU; } bool GlobalError::HasShownBubbleView() { @@ -44,6 +46,8 @@ GlobalErrorBubbleViewBase* GlobalError::GetBubbleView() { } int GlobalError::GetBubbleViewIconResourceID() { + // If you change this make sure to also change the menu icon and the wrench + // icon color. return IDR_INPUT_ALERT; } diff --git a/chrome/browser/ui/global_error/global_error.h b/chrome/browser/ui/global_error/global_error.h index 3569c0e..fe79ce3 100644 --- a/chrome/browser/ui/global_error/global_error.h +++ b/chrome/browser/ui/global_error/global_error.h @@ -38,7 +38,7 @@ class GlobalError : public base::SupportsWeakPtr<GlobalError> { // Returns the label for the menu item. virtual string16 MenuItemLabel() = 0; // Returns the resource ID for the menu item icon. - virtual int MenuItemIconResourceID(); + int MenuItemIconResourceID(); // Called when the user clicks on the menu item. virtual void ExecuteMenuItem(Browser* browser) = 0; @@ -51,7 +51,7 @@ class GlobalError : public base::SupportsWeakPtr<GlobalError> { // Returns the bubble view. virtual GlobalErrorBubbleViewBase* GetBubbleView(); // Returns the resource ID for bubble view icon. - virtual int GetBubbleViewIconResourceID(); + int GetBubbleViewIconResourceID(); // Returns the title for the bubble view. virtual string16 GetBubbleViewTitle() = 0; // Returns the messages for the bubble view, one per line. Multiple messages diff --git a/chrome/browser/ui/global_error/global_error_service_browsertest.cc b/chrome/browser/ui/global_error/global_error_service_browsertest.cc index 243ca2a..49d2230 100644 --- a/chrome/browser/ui/global_error/global_error_service_browsertest.cc +++ b/chrome/browser/ui/global_error/global_error_service_browsertest.cc @@ -30,10 +30,6 @@ class BubbleViewError : public GlobalError { ADD_FAILURE(); return string16(); } - virtual int MenuItemIconResourceID() OVERRIDE { - ADD_FAILURE(); - return 0; - } virtual void ExecuteMenuItem(Browser* browser) OVERRIDE { ADD_FAILURE(); } virtual bool HasBubbleView() OVERRIDE { return true; } diff --git a/chrome/browser/ui/global_error/global_error_service_unittest.cc b/chrome/browser/ui/global_error/global_error_service_unittest.cc index d49e523..07d239a 100644 --- a/chrome/browser/ui/global_error/global_error_service_unittest.cc +++ b/chrome/browser/ui/global_error/global_error_service_unittest.cc @@ -28,17 +28,9 @@ class BaseError : public GlobalError { ADD_FAILURE(); return string16(); } - virtual int MenuItemIconResourceID() OVERRIDE { - ADD_FAILURE(); - return 0; - } virtual void ExecuteMenuItem(Browser* browser) OVERRIDE { ADD_FAILURE(); } virtual bool HasBubbleView() OVERRIDE { return false; } - virtual int GetBubbleViewIconResourceID() OVERRIDE { - ADD_FAILURE(); - return 0; - } virtual string16 GetBubbleViewTitle() OVERRIDE { ADD_FAILURE(); return string16(); diff --git a/chrome/browser/ui/toolbar/wrench_icon_painter.cc b/chrome/browser/ui/toolbar/wrench_icon_painter.cc index f0ba3d8..858e903 100644 --- a/chrome/browser/ui/toolbar/wrench_icon_painter.cc +++ b/chrome/browser/ui/toolbar/wrench_icon_painter.cc @@ -65,18 +65,10 @@ bool WrenchIconPainter::ShouldAnimateUpgradeLevel( } // static -WrenchIconPainter::Severity WrenchIconPainter::SeverityFromGlobalErrorSeverity( - GlobalError::Severity severity) { - switch (severity) { - case GlobalError::SEVERITY_LOW: - return SEVERITY_LOW; - case GlobalError::SEVERITY_MEDIUM: - return SEVERITY_MEDIUM; - case GlobalError::SEVERITY_HIGH: - return SEVERITY_HIGH; - } - NOTREACHED(); - return SEVERITY_LOW; +WrenchIconPainter::Severity WrenchIconPainter::GlobalErrorSeverity() { + // If you change this make sure to also change the menu icon and the bubble + // icon. + return SEVERITY_MEDIUM; } WrenchIconPainter::WrenchIconPainter(Delegate* delegate) diff --git a/chrome/browser/ui/toolbar/wrench_icon_painter.h b/chrome/browser/ui/toolbar/wrench_icon_painter.h index 36d106a..5b72e4b 100644 --- a/chrome/browser/ui/toolbar/wrench_icon_painter.h +++ b/chrome/browser/ui/toolbar/wrench_icon_painter.h @@ -54,9 +54,8 @@ class WrenchIconPainter : ui::AnimationDelegate { static bool ShouldAnimateUpgradeLevel( UpgradeDetector::UpgradeNotificationAnnoyanceLevel level); - // Map a global error level to a severity level. - static Severity SeverityFromGlobalErrorSeverity( - GlobalError::Severity severity); + // Get the severity level for global errors. + static Severity GlobalErrorSeverity(); explicit WrenchIconPainter(Delegate* delegate); virtual ~WrenchIconPainter(); diff --git a/chrome/browser/ui/toolbar/wrench_menu_model.cc b/chrome/browser/ui/toolbar/wrench_menu_model.cc index d8ae5ad..d7beda325c 100644 --- a/chrome/browser/ui/toolbar/wrench_menu_model.cc +++ b/chrome/browser/ui/toolbar/wrench_menu_model.cc @@ -613,7 +613,7 @@ void WrenchMenuModel::Build(bool is_new_menu) { #if defined(OS_WIN) SetIcon(GetIndexOfCommandId(IDC_VIEW_INCOMPATIBILITIES), ui::ResourceBundle::GetSharedInstance(). - GetNativeImageNamed(IDR_CONFLICT_MENU)); + GetNativeImageNamed(IDR_INPUT_ALERT_MENU)); #endif if (!is_new_menu) { diff --git a/chrome/browser/ui/toolbar/wrench_menu_model_unittest.cc b/chrome/browser/ui/toolbar/wrench_menu_model_unittest.cc index 4d42560..d2bb889 100644 --- a/chrome/browser/ui/toolbar/wrench_menu_model_unittest.cc +++ b/chrome/browser/ui/toolbar/wrench_menu_model_unittest.cc @@ -34,10 +34,6 @@ class MenuError : public GlobalError { virtual void ExecuteMenuItem(Browser* browser) OVERRIDE { execute_count_++; } virtual bool HasBubbleView() OVERRIDE { return false; } - virtual int GetBubbleViewIconResourceID() OVERRIDE { - ADD_FAILURE(); - return 0; - } virtual string16 GetBubbleViewTitle() OVERRIDE { ADD_FAILURE(); return string16(); diff --git a/chrome/browser/ui/views/critical_notification_bubble_view.cc b/chrome/browser/ui/views/critical_notification_bubble_view.cc index f2cec42..f0dc444 100644 --- a/chrome/browser/ui/views/critical_notification_bubble_view.cc +++ b/chrome/browser/ui/views/critical_notification_bubble_view.cc @@ -173,7 +173,7 @@ void CriticalNotificationBubbleView::Init() { layout->StartRow(0, top_column_set_id); views::ImageView* image = new views::ImageView(); - image->SetImage(rb.GetImageSkiaNamed(IDR_UPDATE_MENU3)); + image->SetImage(rb.GetImageSkiaNamed(IDR_UPDATE_MENU_SEVERITY_HIGH)); layout->AddView(image); headline_ = new views::Label(); diff --git a/chrome/browser/ui/views/outdated_upgrade_bubble_view.cc b/chrome/browser/ui/views/outdated_upgrade_bubble_view.cc index b947cd9..77be5a4 100644 --- a/chrome/browser/ui/views/outdated_upgrade_bubble_view.cc +++ b/chrome/browser/ui/views/outdated_upgrade_bubble_view.cc @@ -114,7 +114,7 @@ void OutdatedUpgradeBubbleView::Init() { text_label->SetHorizontalAlignment(gfx::ALIGN_LEFT); views::ImageView* image_view = new views::ImageView(); - image_view->SetImage(rb.GetImageSkiaNamed(IDR_UPDATE_MENU3)); + image_view->SetImage(rb.GetImageSkiaNamed(IDR_UPDATE_MENU_SEVERITY_HIGH)); GridLayout* layout = new GridLayout(this); SetLayoutManager(layout); diff --git a/chrome/browser/ui/views/toolbar_view.cc b/chrome/browser/ui/views/toolbar_view.cc index 1aabd6b..22f8257 100644 --- a/chrome/browser/ui/views/toolbar_view.cc +++ b/chrome/browser/ui/views/toolbar_view.cc @@ -813,7 +813,7 @@ void ToolbarView::UpdateWrenchButtonSeverity() { if (ShouldShowIncompatibilityWarning()) { if (!was_showing) content::RecordAction(UserMetricsAction("ConflictBadge")); - app_menu_->SetSeverity(WrenchIconPainter::SEVERITY_HIGH, true); + app_menu_->SetSeverity(WrenchIconPainter::SEVERITY_MEDIUM, true); incompatibility_badge_showing = true; return; } @@ -823,8 +823,7 @@ void ToolbarView::UpdateWrenchButtonSeverity() { GlobalError* error = service->GetHighestSeverityGlobalErrorWithWrenchMenuItem(); if (error) { - app_menu_->SetSeverity(WrenchIconPainter::SeverityFromGlobalErrorSeverity( - error->GetSeverity()), true); + app_menu_->SetSeverity(WrenchIconPainter::GlobalErrorSeverity(), true); return; } diff --git a/chrome/browser/upgrade_detector.cc b/chrome/browser/upgrade_detector.cc index 4345afd..0463dee 100644 --- a/chrome/browser/upgrade_detector.cc +++ b/chrome/browser/upgrade_detector.cc @@ -38,26 +38,44 @@ void UpgradeDetector::RegisterPrefs(PrefRegistrySimple* registry) { } int UpgradeDetector::GetIconResourceID(UpgradeNotificationIconType type) { - bool badge = type == UPGRADE_ICON_TYPE_BADGE; + if (type == UPGRADE_ICON_TYPE_BADGE) { + // Badges do not exist on Views and Mac OS X. +#if !defined(TOOLKIT_VIEWS) && !defined(OS_MACOSX) + switch (upgrade_notification_stage_) { + case UPGRADE_ANNOYANCE_NONE: + return 0; + case UPGRADE_ANNOYANCE_LOW: + return IDR_UPDATE_BADGE; + case UPGRADE_ANNOYANCE_ELEVATED: + return IDR_UPDATE_BADGE2; + case UPGRADE_ANNOYANCE_HIGH: + return IDR_UPDATE_BADGE3; + case UPGRADE_ANNOYANCE_SEVERE: + return IDR_UPDATE_BADGE3; + case UPGRADE_ANNOYANCE_CRITICAL: + return IDR_UPDATE_BADGE3; + } +#endif + NOTREACHED(); + return 0; + } + switch (upgrade_notification_stage_) { - case UPGRADE_ANNOYANCE_CRITICAL: - // The critical annoyance state, somewhat ironically, re-purposes the - // icon for the second highest severity state, since that state has the - // icon most closely resembling the one requested of this feature and the - // critical annoyance is never part of the sliding scale of severity - // anyway (always shown on its own). - return badge ? IDR_UPDATE_BADGE3 : IDR_UPDATE_MENU3; - case UPGRADE_ANNOYANCE_SEVERE: - return badge ? IDR_UPDATE_BADGE4 : IDR_UPDATE_MENU4; - case UPGRADE_ANNOYANCE_HIGH: - return badge ? IDR_UPDATE_BADGE3 : IDR_UPDATE_MENU3; - case UPGRADE_ANNOYANCE_ELEVATED: - return badge ? IDR_UPDATE_BADGE2 : IDR_UPDATE_MENU2; - case UPGRADE_ANNOYANCE_LOW: - return badge ? IDR_UPDATE_BADGE : IDR_UPDATE_MENU; - default: + case UPGRADE_ANNOYANCE_NONE: return 0; + case UPGRADE_ANNOYANCE_LOW: + return IDR_UPDATE_MENU_SEVERITY_LOW; + case UPGRADE_ANNOYANCE_ELEVATED: + return IDR_UPDATE_MENU_SEVERITY_MEDIUM; + case UPGRADE_ANNOYANCE_HIGH: + return IDR_UPDATE_MENU_SEVERITY_HIGH; + case UPGRADE_ANNOYANCE_SEVERE: + return IDR_UPDATE_MENU_SEVERITY_HIGH; + case UPGRADE_ANNOYANCE_CRITICAL: + return IDR_UPDATE_MENU_SEVERITY_HIGH; } + NOTREACHED(); + return 0; } UpgradeDetector::UpgradeDetector() |