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 1153 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1164 scoped_ptr<DictionaryValue> BrowserOptionsHandler::GetSyncStateDictionary() { | 1164 scoped_ptr<DictionaryValue> BrowserOptionsHandler::GetSyncStateDictionary() { |
1165 scoped_ptr<DictionaryValue> sync_status(new DictionaryValue); | 1165 scoped_ptr<DictionaryValue> sync_status(new DictionaryValue); |
1166 Profile* profile = Profile::FromWebUI(web_ui()); | 1166 Profile* profile = Profile::FromWebUI(web_ui()); |
1167 if (profile->IsGuestSession()) { | 1167 if (profile->IsGuestSession()) { |
1168 // Cannot display signin status when running in guest mode on chromeos | 1168 // Cannot display signin status when running in guest mode on chromeos |
1169 // because there is no SigninManager. | 1169 // because there is no SigninManager. |
1170 sync_status->SetBoolean("signinAllowed", false); | 1170 sync_status->SetBoolean("signinAllowed", false); |
1171 return sync_status.Pass(); | 1171 return sync_status.Pass(); |
1172 } | 1172 } |
1173 | 1173 |
| 1174 bool signout_prohibited = false; |
| 1175 #if !defined(OS_CHROMEOS) |
1174 // Signout is not allowed if the user has policy (crbug.com/172204). | 1176 // Signout is not allowed if the user has policy (crbug.com/172204). |
1175 SigninManager* signin = SigninManagerFactory::GetForProfile(profile); | 1177 signout_prohibited = |
1176 DCHECK(signin); | 1178 SigninManagerFactory::GetForProfile(profile)->IsSignoutProhibited(); |
1177 sync_status->SetBoolean("signoutAllowed", !signin->IsSignoutProhibited()); | 1179 #endif |
| 1180 |
1178 ProfileSyncService* service( | 1181 ProfileSyncService* service( |
1179 ProfileSyncServiceFactory::GetInstance()->GetForProfile(profile)); | 1182 ProfileSyncServiceFactory::GetInstance()->GetForProfile(profile)); |
| 1183 SigninManagerBase* signin = service->signin(); |
| 1184 sync_status->SetBoolean("signoutAllowed", !signout_prohibited); |
1180 sync_status->SetBoolean("signinAllowed", signin->IsSigninAllowed()); | 1185 sync_status->SetBoolean("signinAllowed", signin->IsSigninAllowed()); |
1181 sync_status->SetBoolean("syncSystemEnabled", !!service); | 1186 sync_status->SetBoolean("syncSystemEnabled", !!service); |
1182 sync_status->SetBoolean("setupCompleted", | 1187 sync_status->SetBoolean("setupCompleted", |
1183 service && service->HasSyncSetupCompleted()); | 1188 service && service->HasSyncSetupCompleted()); |
1184 sync_status->SetBoolean("setupInProgress", | 1189 sync_status->SetBoolean("setupInProgress", |
1185 service && !service->IsManaged() && service->FirstSetupInProgress()); | 1190 service && !service->IsManaged() && service->FirstSetupInProgress()); |
1186 | 1191 |
1187 string16 status_label; | 1192 string16 status_label; |
1188 string16 link_label; | 1193 string16 link_label; |
1189 DCHECK(signin); | 1194 DCHECK(signin); |
(...skipping 341 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1531 base::FundamentalValue disabled(profile_pref_registrar_.IsManaged() || | 1536 base::FundamentalValue disabled(profile_pref_registrar_.IsManaged() || |
1532 is_extension_controlled); | 1537 is_extension_controlled); |
1533 base::FundamentalValue extension_controlled(is_extension_controlled); | 1538 base::FundamentalValue extension_controlled(is_extension_controlled); |
1534 web_ui()->CallJavascriptFunction("BrowserOptions.setupProxySettingsSection", | 1539 web_ui()->CallJavascriptFunction("BrowserOptions.setupProxySettingsSection", |
1535 disabled, extension_controlled); | 1540 disabled, extension_controlled); |
1536 | 1541 |
1537 #endif // !defined(OS_CHROMEOS) | 1542 #endif // !defined(OS_CHROMEOS) |
1538 } | 1543 } |
1539 | 1544 |
1540 } // namespace options | 1545 } // namespace options |
OLD | NEW |