OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/options/browser_options_handler.h" | 5 #include "chrome/browser/ui/webui/options/browser_options_handler.h" |
6 | 6 |
7 #include <string> | 7 #include <string> |
8 #include <vector> | 8 #include <vector> |
9 | 9 |
10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
(...skipping 1065 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1076 scoped_ptr<DictionaryValue> sync_status(new DictionaryValue); | 1076 scoped_ptr<DictionaryValue> sync_status(new DictionaryValue); |
1077 Profile* profile = Profile::FromWebUI(web_ui()); | 1077 Profile* profile = Profile::FromWebUI(web_ui()); |
1078 sync_status->SetBoolean("signinAllowed", !profile->IsGuestSession()); | 1078 sync_status->SetBoolean("signinAllowed", !profile->IsGuestSession()); |
1079 if (profile->IsGuestSession()) { | 1079 if (profile->IsGuestSession()) { |
1080 // Cannot display signin status when running in guest mode on chromeos | 1080 // Cannot display signin status when running in guest mode on chromeos |
1081 // because there is no SigninManager. | 1081 // because there is no SigninManager. |
1082 return sync_status.Pass(); | 1082 return sync_status.Pass(); |
1083 } | 1083 } |
1084 | 1084 |
1085 // Signout is not allowed if the user has policy (crbug.com/172204). | 1085 // Signout is not allowed if the user has policy (crbug.com/172204). |
1086 bool signout_allowed = true; | 1086 SigninManager* signin = SigninManagerFactory::GetForProfile(profile); |
1087 #if defined(ENABLE_CONFIGURATION_POLICY) && !defined(OS_CHROMEOS) | 1087 sync_status->SetBoolean("signoutAllowed", !signin->IsSignoutProhibited()); |
1088 policy::UserCloudPolicyManager* policy_manager = | |
1089 policy::UserCloudPolicyManagerFactory::GetForProfile(profile); | |
1090 if (policy_manager) | |
1091 signout_allowed = !policy_manager->IsClientRegistered(); | |
1092 #endif | |
1093 sync_status->SetBoolean("signoutAllowed", signout_allowed); | |
1094 ProfileSyncService* service( | 1088 ProfileSyncService* service( |
1095 ProfileSyncServiceFactory::GetInstance()->GetForProfile(profile)); | 1089 ProfileSyncServiceFactory::GetInstance()->GetForProfile(profile)); |
1096 sync_status->SetBoolean("syncSystemEnabled", !!service); | 1090 sync_status->SetBoolean("syncSystemEnabled", !!service); |
1097 sync_status->SetBoolean("setupCompleted", | 1091 sync_status->SetBoolean("setupCompleted", |
1098 service && service->HasSyncSetupCompleted()); | 1092 service && service->HasSyncSetupCompleted()); |
1099 sync_status->SetBoolean("setupInProgress", | 1093 sync_status->SetBoolean("setupInProgress", |
1100 service && !service->IsManaged() && service->FirstSetupInProgress()); | 1094 service && !service->IsManaged() && service->FirstSetupInProgress()); |
1101 | 1095 |
1102 string16 status_label; | 1096 string16 status_label; |
1103 string16 link_label; | 1097 string16 link_label; |
1104 SigninManager* signin = SigninManagerFactory::GetForProfile(profile); | |
1105 DCHECK(signin); | 1098 DCHECK(signin); |
1106 bool status_has_error = sync_ui_util::GetStatusLabels( | 1099 bool status_has_error = sync_ui_util::GetStatusLabels( |
1107 service, *signin, sync_ui_util::WITH_HTML, &status_label, &link_label) == | 1100 service, *signin, sync_ui_util::WITH_HTML, &status_label, &link_label) == |
1108 sync_ui_util::SYNC_ERROR; | 1101 sync_ui_util::SYNC_ERROR; |
1109 sync_status->SetString("statusText", status_label); | 1102 sync_status->SetString("statusText", status_label); |
1110 sync_status->SetString("actionLinkText", link_label); | 1103 sync_status->SetString("actionLinkText", link_label); |
1111 sync_status->SetBoolean("hasError", status_has_error); | 1104 sync_status->SetBoolean("hasError", status_has_error); |
1112 | 1105 |
1113 sync_status->SetBoolean("managed", service && service->IsManaged()); | 1106 sync_status->SetBoolean("managed", service && service->IsManaged()); |
1114 sync_status->SetBoolean("signedIn", | 1107 sync_status->SetBoolean("signedIn", |
(...skipping 324 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1439 base::FundamentalValue disabled(proxy_prefs_.IsManaged() || | 1432 base::FundamentalValue disabled(proxy_prefs_.IsManaged() || |
1440 is_extension_controlled); | 1433 is_extension_controlled); |
1441 base::FundamentalValue extension_controlled(is_extension_controlled); | 1434 base::FundamentalValue extension_controlled(is_extension_controlled); |
1442 web_ui()->CallJavascriptFunction("BrowserOptions.setupProxySettingsSection", | 1435 web_ui()->CallJavascriptFunction("BrowserOptions.setupProxySettingsSection", |
1443 disabled, extension_controlled); | 1436 disabled, extension_controlled); |
1444 | 1437 |
1445 #endif // !defined(OS_CHROMEOS) | 1438 #endif // !defined(OS_CHROMEOS) |
1446 } | 1439 } |
1447 | 1440 |
1448 } // namespace options | 1441 } // namespace options |
OLD | NEW |