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

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

Issue 240453006: Fix sign-in error strings. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix comment Created 6 years, 7 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
« no previous file with comments | « chrome/browser/ui/browser_window.h ('k') | chrome/browser/ui/views/frame/browser_view.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 b49610d303f4b3f4b00d184c5d40c13ff3ebd6cb..ef22c1cfd3a12d59b0ec345bd22a18e533a1ea1b 100644
--- a/chrome/browser/ui/toolbar/wrench_menu_model.cc
+++ b/chrome/browser/ui/toolbar/wrench_menu_model.cc
@@ -39,6 +39,7 @@
#include "chrome/common/pref_names.h"
#include "chrome/common/profiling.h"
#include "components/signin/core/browser/signin_manager.h"
+#include "components/signin/core/common/profile_management_switches.h"
#include "content/public/browser/host_zoom_map.h"
#include "content/public/browser/navigation_entry.h"
#include "content/public/browser/notification_service.h"
@@ -278,7 +279,7 @@ bool WrenchMenuModel::IsItemForCommandIdDynamic(int command_id) const {
command_id == IDC_PIN_TO_START_SCREEN ||
#endif
command_id == IDC_UPGRADE_DIALOG ||
- command_id == IDC_SHOW_SIGNIN;
+ (!switches::IsNewProfileManagement() && command_id == IDC_SHOW_SIGNIN);
}
base::string16 WrenchMenuModel::GetLabelForCommandId(int command_id) const {
@@ -309,6 +310,7 @@ base::string16 WrenchMenuModel::GetLabelForCommandId(int command_id) const {
case IDC_UPGRADE_DIALOG:
return GetUpgradeDialogMenuItemName();
case IDC_SHOW_SIGNIN:
+ DCHECK(!switches::IsNewProfileManagement());
return signin_ui_util::GetSigninMenuLabel(
browser_->profile()->GetOriginalProfile());
default:
@@ -331,15 +333,16 @@ bool WrenchMenuModel::GetIconForCommandId(int command_id,
return false;
}
case IDC_SHOW_SIGNIN: {
- 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;
- }
- }
+ DCHECK(!switches::IsNewProfileManagement());
+ 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:
@@ -356,15 +359,15 @@ void WrenchMenuModel::ExecuteCommand(int command_id, int event_flags) {
return;
}
- if (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;
- }
- }
+ if (!switches::IsNewProfileManagement() && 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;
+ }
+ }
if (command_id == IDC_HELP_PAGE_VIA_MENU)
content::RecordAction(UserMetricsAction("ShowHelpTabViaWrenchMenu"));
@@ -578,17 +581,19 @@ void WrenchMenuModel::Build(bool is_new_menu) {
AddItemWithStringId(IDC_SHOW_DOWNLOADS, IDS_SHOW_DOWNLOADS);
AddSeparator(ui::NORMAL_SEPARATOR);
-#if !defined(OS_CHROMEOS)
- // No "Sign in to Chromium..." menu item on ChromeOS.
- SigninManager* signin = SigninManagerFactory::GetForProfile(
- browser_->profile()->GetOriginalProfile());
- if (signin && signin->IsSigninAllowed()) {
- const base::string16 short_product_name =
- l10n_util::GetStringUTF16(IDS_SHORT_PRODUCT_NAME);
- AddItem(IDC_SHOW_SYNC_SETUP, l10n_util::GetStringFUTF16(
- IDS_SYNC_MENU_PRE_SYNCED_LABEL, short_product_name));
- AddSeparator(ui::NORMAL_SEPARATOR);
- }
+#if !defined(OS_CHROMEOS)
+ if (!switches::IsNewProfileManagement()) {
+ // No "Sign in to Chromium..." menu item on ChromeOS.
+ SigninManager* signin = SigninManagerFactory::GetForProfile(
+ browser_->profile()->GetOriginalProfile());
+ if (signin && signin->IsSigninAllowed()) {
+ const base::string16 short_product_name =
+ l10n_util::GetStringUTF16(IDS_SHORT_PRODUCT_NAME);
+ AddItem(IDC_SHOW_SYNC_SETUP, l10n_util::GetStringFUTF16(
+ IDS_SYNC_MENU_PRE_SYNCED_LABEL, short_product_name));
+ AddSeparator(ui::NORMAL_SEPARATOR);
+ }
+ }
#endif
AddItemWithStringId(IDC_OPTIONS, IDS_SETTINGS);
@@ -658,11 +663,13 @@ void WrenchMenuModel::AddGlobalErrorMenuItems() {
// 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 =
- signin_ui_util::GetSignedInServiceErrors(
+ // GetSignedInServiceErrors() can modify the global error list, so call it
+ // before iterating through that list below.
+ std::vector<GlobalError*> signin_errors;
+ if (!switches::IsNewProfileManagement()) {
+ signin_errors = signin_ui_util::GetSignedInServiceErrors(
browser_->profile()->GetOriginalProfile());
+ }
const GlobalErrorService::GlobalErrorList& errors =
GlobalErrorServiceFactory::GetForProfile(browser_->profile())->errors();
for (GlobalErrorService::GlobalErrorList::const_iterator
@@ -670,17 +677,17 @@ void 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;
- }
- }
+#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());
« no previous file with comments | « chrome/browser/ui/browser_window.h ('k') | chrome/browser/ui/views/frame/browser_view.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698