| 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 9ccabe2227a0d83a0a1022d13862ab8160d40bc6..fbd2cfb183af6a0139f4cee9951a4b79c2d267ef 100644
|
| --- a/chrome/browser/ui/browser_command_controller.cc
|
| +++ b/chrome/browser/ui/browser_command_controller.cc
|
| @@ -201,6 +201,11 @@ BrowserCommandController::BrowserCommandController(
|
| prefs::kPrintingEnabled,
|
| base::Bind(&BrowserCommandController::UpdatePrintingState,
|
| base::Unretained(this)));
|
| + pref_signin_allowed_.Init(
|
| + prefs::kSigninAllowed,
|
| + profile()->GetOriginalProfile()->GetPrefs(),
|
| + base::Bind(&BrowserCommandController::OnSigninAllowedPrefChange,
|
| + base::Unretained(this)));
|
|
|
| InitCommandState();
|
|
|
| @@ -740,6 +745,15 @@ void BrowserCommandController::OnProfileAvatarChanged(
|
| }
|
|
|
| ////////////////////////////////////////////////////////////////////////////////
|
| +// BrowserCommandController, SigninPrefObserver implementation:
|
| +
|
| +void BrowserCommandController::OnSigninAllowedPrefChange() {
|
| + // For unit tests, we don't have a window.
|
| + if (!window())
|
| + return;
|
| + UpdateShowSyncState(IsShowingMainUI());
|
| +}
|
| +
|
| // BrowserCommandController, TabStripModelObserver implementation:
|
|
|
| void BrowserCommandController::TabInsertedAt(WebContents* contents,
|
| @@ -878,7 +892,7 @@ void BrowserCommandController::InitCommandState() {
|
| !profile()->IsGuestSession() &&
|
| !profile()->IsOffTheRecord());
|
|
|
| - command_updater_.UpdateCommandEnabled(IDC_SHOW_SIGNIN, true);
|
| + UpdateShowSyncState(true);
|
|
|
| // Initialize other commands based on the window type.
|
| bool normal_window = browser_->is_type_tabbed();
|
| @@ -1108,6 +1122,7 @@ void BrowserCommandController::UpdateCommandsForFullscreenMode(
|
| // Show various bits of UI
|
| command_updater_.UpdateCommandEnabled(IDC_DEVELOPER_MENU, show_main_ui);
|
| command_updater_.UpdateCommandEnabled(IDC_FEEDBACK, show_main_ui);
|
| + UpdateShowSyncState(show_main_ui);
|
|
|
| // Settings page/subpages are forced to open in normal mode. We disable these
|
| // commands when incognito is forced.
|
| @@ -1179,6 +1194,11 @@ void BrowserCommandController::UpdateSaveAsState() {
|
| 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) {
|
|
|