Chromium Code Reviews| Index: chrome/browser/ui/browser.cc |
| diff --git a/chrome/browser/ui/browser.cc b/chrome/browser/ui/browser.cc |
| index e5aa2dcefed02e3b4d23b2b35dedf0d5f0b15b51..69fb4499ffee50d2f5a697f13046fe033e469d54 100644 |
| --- a/chrome/browser/ui/browser.cc |
| +++ b/chrome/browser/ui/browser.cc |
| @@ -70,6 +70,8 @@ |
| #include "chrome/browser/prefs/pref_service.h" |
| #include "chrome/browser/prerender/prerender_tab_helper.h" |
| #include "chrome/browser/printing/background_printing_manager.h" |
| +#include "chrome/browser/printing/cloud_print/cloud_print_proxy_service.h" |
| +#include "chrome/browser/printing/cloud_print/cloud_print_proxy_service_factory.h" |
| #include "chrome/browser/printing/cloud_print/cloud_print_setup_flow.h" |
| #include "chrome/browser/printing/print_preview_tab_controller.h" |
| #include "chrome/browser/printing/print_view_manager.h" |
| @@ -328,6 +330,7 @@ Browser::Browser(Type type, Profile* profile) |
| profile_pref_registrar_.Add(prefs::kInstantEnabled, this); |
| profile_pref_registrar_.Add(prefs::kIncognitoModeAvailability, this); |
| profile_pref_registrar_.Add(prefs::kSearchSuggestEnabled, this); |
| + profile_pref_registrar_.Add(prefs::kCloudPrintProxyEnabled, this); |
| InitCommandState(); |
| BrowserList::AddBrowser(this); |
| @@ -4334,6 +4337,8 @@ void Browser::Observe(int type, |
| } else if (pref_name == prefs::kAllowFileSelectionDialogs) { |
| UpdateSaveAsState(GetContentRestrictionsForSelectedTab()); |
| UpdateOpenFileState(); |
| + } else if (pref_name == prefs::kCloudPrintProxyEnabled) { |
| + UpdateCloudPrintConnectorState(); |
| } else { |
| NOTREACHED(); |
| } |
| @@ -4625,6 +4630,8 @@ void Browser::InitCommandState() { |
| UpdateCommandsForContentRestrictionState(); |
| UpdateCommandsForBookmarkEditing(); |
| + |
| + UpdateCloudPrintConnectorState(); |
|
Peter Kasting
2011/11/01 22:54:10
This seems like the wrong place for this. This fu
Mattias Nissler (ping if slow)
2011/11/02 10:55:56
Agree with Peter. This should probably be hooked o
Scott Byer
2011/11/02 21:33:25
Makes sense - it was a bit trickier, but not too b
|
| } |
| void Browser::UpdateCommandsForFullscreenMode(bool is_fullscreen) { |
| @@ -4777,6 +4784,19 @@ void Browser::UpdatePrintingState(int content_restrictions) { |
| advanced_print_enabled); |
| } |
| +void Browser::UpdateCloudPrintConnectorState() { |
| + if (!profile_->GetPrefs()->GetBoolean(prefs::kCloudPrintProxyEnabled)) { |
| + std::string email; |
| + if (profile_->GetPrefs()->HasPrefPath(prefs::kCloudPrintEmail)) { |
| + email = profile_->GetPrefs()->GetString(prefs::kCloudPrintEmail); |
| + |
| + if (!email.empty()) |
|
Mattias Nissler (ping if slow)
2011/11/02 10:55:56
need curlies.
Scott Byer
2011/11/02 21:33:25
Done.
|
| + CloudPrintProxyServiceFactory::GetForProfile(profile_)-> |
| + DisableForUser(); |
| + } |
| + } |
| +} |
| + |
| void Browser::UpdateReloadStopState(bool is_loading, bool force) { |
| window_->UpdateReloadStopState(is_loading, force); |
| command_updater_.UpdateCommandEnabled(IDC_STOP, is_loading); |