Index: chrome/browser/ui/webui/media_router/media_router_webui_message_handler.cc |
diff --git a/chrome/browser/ui/webui/media_router/media_router_webui_message_handler.cc b/chrome/browser/ui/webui/media_router/media_router_webui_message_handler.cc |
index 4806d28b6d694b190d44aace4e1bfd2c1234798d..dc9c475f6f9dc46518bb0795aeb7e3b78ae88c81 100644 |
--- a/chrome/browser/ui/webui/media_router/media_router_webui_message_handler.cc |
+++ b/chrome/browser/ui/webui/media_router/media_router_webui_message_handler.cc |
@@ -27,6 +27,8 @@ |
#if defined(GOOGLE_CHROME_BUILD) |
#include "chrome/browser/signin/signin_manager_factory.h" |
+#include "chrome/browser/sync/profile_sync_service_factory.h" |
+#include "components/browser_sync/browser/profile_sync_service.h" |
#include "components/signin/core/browser/signin_manager.h" |
#endif // defined(GOOGLE_CHROME_BUILD) |
@@ -804,19 +806,20 @@ |
pref_service->GetBoolean(prefs::kMediaRouterFirstRunFlowAcknowledged); |
bool show_cloud_pref = false; |
#if defined(GOOGLE_CHROME_BUILD) |
- // Cloud services preference is shown if user is logged in. If the user |
- // enables sync after acknowledging the first run flow, this is treated as |
- // the user opting into Google services, including cloud services, if the |
- // browser is a Chrome branded build. |
- if (!pref_service->GetBoolean(prefs::kMediaRouterCloudServicesPrefSet)) { |
+ // Cloud services preference is shown if user is logged in and has sync |
+ // enabled. If the user enables sync after acknowledging the first run flow, |
+ // this is treated as the user opting into Google services, including cloud |
+ // services, if the browser is a Chrome branded build. |
+ if (!pref_service->GetBoolean(prefs::kMediaRouterCloudServicesPrefSet) && |
+ profile->IsSyncAllowed()) { |
SigninManagerBase* signin_manager = |
SigninManagerFactory::GetForProfile(profile); |
- if (signin_manager && signin_manager->IsAuthenticated()) { |
+ if (signin_manager && signin_manager->IsAuthenticated() && |
+ ProfileSyncServiceFactory::GetForProfile(profile)->IsSyncActive()) { |
// If the user had previously acknowledged the first run flow without |
// being shown the cloud services option, and is now logged in with sync |
// enabled, turn on cloud services. |
- if (first_run_flow_acknowledged && |
- ProfileSyncServiceFactory::GetForProfile(profile)->IsSyncActive()) { |
+ if (first_run_flow_acknowledged) { |
pref_service->SetBoolean(prefs::kMediaRouterEnableCloudServices, true); |
pref_service->SetBoolean(prefs::kMediaRouterCloudServicesPrefSet, |
true); |