| Index: chrome/browser/ui/browser_command_controller.cc
|
| diff --git a/chrome/browser/ui/browser_command_controller.cc b/chrome/browser/ui/browser_command_controller.cc
|
| index c007a8ea1eea53b2aaa778ae62d426cb93c9f783..abb123388f0c36b7d5397e6fb790a9d34ad81506 100644
|
| --- a/chrome/browser/ui/browser_command_controller.cc
|
| +++ b/chrome/browser/ui/browser_command_controller.cc
|
| @@ -229,6 +229,11 @@
|
| base::Bind(&BrowserCommandController::UpdateCommandsForFullscreenMode,
|
| base::Unretained(this)));
|
| #endif
|
| + pref_signin_allowed_.Init(
|
| + prefs::kSigninAllowed,
|
| + profile()->GetOriginalProfile()->GetPrefs(),
|
| + base::Bind(&BrowserCommandController::OnSigninAllowedPrefChange,
|
| + base::Unretained(this)));
|
|
|
| InitCommandState();
|
|
|
| @@ -759,6 +764,9 @@
|
| case IDC_HELP_PAGE_VIA_MENU:
|
| ShowHelp(browser_, HELP_SOURCE_MENU);
|
| break;
|
| + case IDC_SHOW_SIGNIN:
|
| + ShowBrowserSigninOrSettings(browser_, signin_metrics::SOURCE_MENU);
|
| + break;
|
| case IDC_TOGGLE_SPEECH_INPUT:
|
| ToggleSpeechInput(browser_);
|
| break;
|
| @@ -775,6 +783,16 @@
|
| LOG(WARNING) << "Received Unimplemented Command: " << id;
|
| break;
|
| }
|
| +}
|
| +
|
| +////////////////////////////////////////////////////////////////////////////////
|
| +// BrowserCommandController, SigninPrefObserver implementation:
|
| +
|
| +void BrowserCommandController::OnSigninAllowedPrefChange() {
|
| + // For unit tests, we don't have a window.
|
| + if (!window())
|
| + return;
|
| + UpdateShowSyncState(IsShowingMainUI());
|
| }
|
|
|
| // BrowserCommandController, TabStripModelObserver implementation:
|
| @@ -966,6 +984,8 @@
|
| }
|
| #endif
|
|
|
| + UpdateShowSyncState(true);
|
| +
|
| // Navigation commands
|
| command_updater_.UpdateCommandEnabled(
|
| IDC_HOME,
|
| @@ -1050,6 +1070,7 @@
|
| command_updater->UpdateCommandEnabled(IDC_IMPORT_SETTINGS, !forced_incognito);
|
| command_updater->UpdateCommandEnabled(IDC_OPTIONS,
|
| !forced_incognito || guest_session);
|
| + command_updater->UpdateCommandEnabled(IDC_SHOW_SIGNIN, !forced_incognito);
|
| }
|
|
|
| void BrowserCommandController::UpdateCommandsForIncognitoAvailability() {
|
| @@ -1228,6 +1249,7 @@
|
| #if defined(GOOGLE_CHROME_BUILD)
|
| command_updater_.UpdateCommandEnabled(IDC_FEEDBACK, show_main_ui);
|
| #endif
|
| + UpdateShowSyncState(show_main_ui);
|
|
|
| // Settings page/subpages are forced to open in normal mode. We disable these
|
| // commands for guest sessions and when incognito is forced.
|
| @@ -1277,6 +1299,11 @@
|
| command_updater_.UpdateCommandEnabled(IDC_SAVE_PAGE, CanSavePage(browser_));
|
| }
|
|
|
| +void BrowserCommandController::UpdateShowSyncState(bool show_main_ui) {
|
| + command_updater_.UpdateCommandEnabled(
|
| + IDC_SHOW_SYNC_SETUP, show_main_ui && pref_signin_allowed_.GetValue());
|
| +}
|
| +
|
| // static
|
| void BrowserCommandController::UpdateOpenFileState(
|
| CommandUpdater* command_updater) {
|
|
|