OLD | NEW |
---|---|
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "chrome/browser/ui/webui/media_router/media_router_webui_message_handle r.h" | 5 #include "chrome/browser/ui/webui/media_router/media_router_webui_message_handle r.h" |
6 | 6 |
7 #include <string> | 7 #include <string> |
8 #include <utility> | 8 #include <utility> |
9 | 9 |
10 #include "base/bind.h" | 10 #include "base/bind.h" |
(...skipping 788 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
799 void MediaRouterWebUIMessageHandler::MaybeUpdateFirstRunFlowData() { | 799 void MediaRouterWebUIMessageHandler::MaybeUpdateFirstRunFlowData() { |
800 base::DictionaryValue first_run_flow_data; | 800 base::DictionaryValue first_run_flow_data; |
801 | 801 |
802 Profile* profile = Profile::FromWebUI(web_ui()); | 802 Profile* profile = Profile::FromWebUI(web_ui()); |
803 PrefService* pref_service = profile->GetPrefs(); | 803 PrefService* pref_service = profile->GetPrefs(); |
804 | 804 |
805 bool first_run_flow_acknowledged = | 805 bool first_run_flow_acknowledged = |
806 pref_service->GetBoolean(prefs::kMediaRouterFirstRunFlowAcknowledged); | 806 pref_service->GetBoolean(prefs::kMediaRouterFirstRunFlowAcknowledged); |
807 bool show_cloud_pref = false; | 807 bool show_cloud_pref = false; |
808 #if defined(GOOGLE_CHROME_BUILD) | 808 #if defined(GOOGLE_CHROME_BUILD) |
809 // Cloud services preference is shown if user is logged in and has sync | 809 // Cloud services preference is shown if user is logged in. If the user |
810 // enabled. If the user enables sync after acknowledging the first run flow, | 810 // enables sync after acknowledging the first run flow, this is treated as |
811 // this is treated as the user opting into Google services, including cloud | 811 // the user opting into Google services, including cloud services, if the |
812 // services, if the browser is a Chrome branded build. | 812 // browser is a Chrome branded build. |
813 if (!pref_service->GetBoolean(prefs::kMediaRouterCloudServicesPrefSet) && | 813 if (!pref_service->GetBoolean(prefs::kMediaRouterCloudServicesPrefSet)) { |
814 profile->IsSyncAllowed()) { | |
815 SigninManagerBase* signin_manager = | 814 SigninManagerBase* signin_manager = |
816 SigninManagerFactory::GetForProfile(profile); | 815 SigninManagerFactory::GetForProfile(profile); |
817 if (signin_manager && signin_manager->IsAuthenticated() && | 816 if (signin_manager && signin_manager->IsAuthenticated()) { |
818 ProfileSyncServiceFactory::GetForProfile(profile)->IsSyncActive()) { | |
819 // If the user had previously acknowledged the first run flow without | 817 // If the user had previously acknowledged the first run flow without |
820 // being shown the cloud services option, and is now logged in with sync | 818 // being shown the cloud services option, and is now logged in with sync |
821 // enabled, turn on cloud services. | 819 // enabled, turn on cloud services. |
822 if (first_run_flow_acknowledged) { | 820 if (first_run_flow_acknowledged && |
821 ProfileSyncServiceFactory::GetForProfile(profile)->IsSyncActive()) { | |
msw
2016/06/27 19:10:23
q: Are these automatically propagated if/when sync
apacible
2016/06/28 17:01:38
Correct.
| |
823 pref_service->SetBoolean(prefs::kMediaRouterEnableCloudServices, true); | 822 pref_service->SetBoolean(prefs::kMediaRouterEnableCloudServices, true); |
824 pref_service->SetBoolean(prefs::kMediaRouterCloudServicesPrefSet, | 823 pref_service->SetBoolean(prefs::kMediaRouterCloudServicesPrefSet, |
825 true); | 824 true); |
826 // Return early since the first run flow won't be surfaced. | 825 // Return early since the first run flow won't be surfaced. |
827 return; | 826 return; |
828 } | 827 } |
829 | 828 |
830 show_cloud_pref = true; | 829 show_cloud_pref = true; |
831 // "Casting to a Hangout from Chrome" Chromecast help center page. | 830 // "Casting to a Hangout from Chrome" Chromecast help center page. |
832 first_run_flow_data.SetString("firstRunFlowCloudPrefLearnMoreUrl", | 831 first_run_flow_data.SetString("firstRunFlowCloudPrefLearnMoreUrl", |
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
890 } | 889 } |
891 | 890 |
892 return value; | 891 return value; |
893 } | 892 } |
894 | 893 |
895 void MediaRouterWebUIMessageHandler::SetWebUIForTest(content::WebUI* web_ui) { | 894 void MediaRouterWebUIMessageHandler::SetWebUIForTest(content::WebUI* web_ui) { |
896 set_web_ui(web_ui); | 895 set_web_ui(web_ui); |
897 } | 896 } |
898 | 897 |
899 } // namespace media_router | 898 } // namespace media_router |
OLD | NEW |