Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(2674)

Unified Diff: chrome/browser/ui/toolbar/wrench_menu_model.cc

Issue 1289413003: Switch global error menu icon to vectorized MD asset (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase Created 5 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: chrome/browser/ui/toolbar/wrench_menu_model.cc
diff --git a/chrome/browser/ui/toolbar/wrench_menu_model.cc b/chrome/browser/ui/toolbar/wrench_menu_model.cc
index 5f9ca12ae7d21024e8709f2d56fc691a8e654ba1..5299cb5c49706f24dd24a9bb4954cb11d2c6970a 100644
--- a/chrome/browser/ui/toolbar/wrench_menu_model.cc
+++ b/chrome/browser/ui/toolbar/wrench_menu_model.cc
@@ -366,8 +366,7 @@ bool WrenchMenuModel::IsItemForCommandIdDynamic(int command_id) const {
#elif defined(OS_WIN)
command_id == IDC_PIN_TO_START_SCREEN ||
#endif
- command_id == IDC_UPGRADE_DIALOG ||
- (!switches::IsNewAvatarMenu() && command_id == IDC_SHOW_SIGNIN);
+ command_id == IDC_UPGRADE_DIALOG;
}
base::string16 WrenchMenuModel::GetLabelForCommandId(int command_id) const {
@@ -397,10 +396,6 @@ base::string16 WrenchMenuModel::GetLabelForCommandId(int command_id) const {
#endif
case IDC_UPGRADE_DIALOG:
return GetUpgradeDialogMenuItemName();
- case IDC_SHOW_SIGNIN:
- DCHECK(!switches::IsNewAvatarMenu());
- return signin_ui_util::GetSigninMenuLabel(
- browser_->profile()->GetOriginalProfile());
default:
NOTREACHED();
return base::string16();
@@ -419,19 +414,6 @@ bool WrenchMenuModel::GetIconForCommandId(int command_id,
}
return false;
}
- case IDC_SHOW_SIGNIN: {
- DCHECK(!switches::IsNewAvatarMenu());
- GlobalError* error = signin_ui_util::GetSignedInServiceError(
- browser_->profile()->GetOriginalProfile());
- if (error) {
- int icon_id = error->MenuItemIconResourceID();
- if (icon_id) {
- *icon = rb.GetNativeImageNamed(icon_id);
- return true;
- }
- }
- return false;
- }
default:
break;
}
@@ -446,16 +428,6 @@ void WrenchMenuModel::ExecuteCommand(int command_id, int event_flags) {
return;
}
- if (!switches::IsNewAvatarMenu() && command_id == IDC_SHOW_SIGNIN) {
- // If a custom error message is being shown, handle it.
- GlobalError* error = signin_ui_util::GetSignedInServiceError(
- browser_->profile()->GetOriginalProfile());
- if (error) {
- error->ExecuteMenuItem(browser_);
- return;
- }
- }
-
LogMenuMetrics(command_id);
chrome::ExecuteCommand(browser_, command_id);
}
@@ -930,21 +902,6 @@ void WrenchMenuModel::Build() {
CreateCutCopyPasteMenu();
AddItemWithStringId(IDC_OPTIONS, IDS_SETTINGS);
-#if !defined(OS_CHROMEOS)
- if (!switches::IsNewAvatarMenu()) {
- // No "Sign in to Chromium..." menu item on ChromeOS.
- SigninManager* signin = SigninManagerFactory::GetForProfile(
- browser_->profile()->GetOriginalProfile());
- if (signin && signin->IsSigninAllowed() &&
- signin_ui_util::GetSignedInServiceErrors(
- browser_->profile()->GetOriginalProfile()).empty()) {
- AddItem(IDC_SHOW_SYNC_SETUP,
- l10n_util::GetStringFUTF16(
- IDS_SYNC_MENU_PRE_SYNCED_LABEL,
- l10n_util::GetStringUTF16(IDS_SHORT_PRODUCT_NAME)));
- }
- }
-#endif
// The help submenu is only displayed on official Chrome builds. As the
// 'About' item has been moved to this submenu, it's reinstated here for
// Chromium builds.
@@ -989,7 +946,6 @@ bool WrenchMenuModel::AddGlobalErrorMenuItems() {
// window. This means that if a new error is added after the menu is built
// it won't show in the existing wrench menu. To fix this we need to some
// how update the menu if new errors are added.
- ui::ResourceBundle& rb = ui::ResourceBundle::GetSharedInstance();
// GetSignedInServiceErrors() can modify the global error list, so call it
// before iterating through that list below.
std::vector<GlobalError*> signin_errors;
@@ -1003,26 +959,9 @@ bool WrenchMenuModel::AddGlobalErrorMenuItems() {
GlobalError* error = *it;
DCHECK(error);
if (error->HasMenuItem()) {
-#if !defined(OS_CHROMEOS)
- // Don't add a signin error if it's already being displayed elsewhere.
- if (std::find(signin_errors.begin(), signin_errors.end(), error) !=
- signin_errors.end()) {
- MenuModel* model = this;
- int index = 0;
- if (MenuModel::GetModelAndIndexForCommandId(
- IDC_SHOW_SIGNIN, &model, &index)) {
- continue;
- }
- }
-#endif
-
AddItem(error->MenuItemCommandID(), error->MenuItemLabel());
- int icon_id = error->MenuItemIconResourceID();
- if (icon_id) {
- const gfx::Image& image = rb.GetNativeImageNamed(icon_id);
- SetIcon(GetIndexOfCommandId(error->MenuItemCommandID()),
- image);
- }
+ SetIcon(GetIndexOfCommandId(error->MenuItemCommandID()),
+ error->MenuItemIcon());
menu_items_added = true;
}
}
« no previous file with comments | « chrome/browser/ui/libgtk2ui/native_theme_gtk2.cc ('k') | chrome/browser/ui/views/profiles/new_avatar_button.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698