Chromium Code Reviews| 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 1126 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1137 scoped_ptr<DictionaryValue> BrowserOptionsHandler::GetSyncStateDictionary() { | 1137 scoped_ptr<DictionaryValue> BrowserOptionsHandler::GetSyncStateDictionary() { |
| 1138 scoped_ptr<DictionaryValue> sync_status(new DictionaryValue); | 1138 scoped_ptr<DictionaryValue> sync_status(new DictionaryValue); |
| 1139 Profile* profile = Profile::FromWebUI(web_ui()); | 1139 Profile* profile = Profile::FromWebUI(web_ui()); |
| 1140 if (profile->IsGuestSession()) { | 1140 if (profile->IsGuestSession()) { |
| 1141 // Cannot display signin status when running in guest mode on chromeos | 1141 // Cannot display signin status when running in guest mode on chromeos |
| 1142 // because there is no SigninManager. | 1142 // because there is no SigninManager. |
| 1143 sync_status->SetBoolean("signinAllowed", false); | 1143 sync_status->SetBoolean("signinAllowed", false); |
| 1144 return sync_status.Pass(); | 1144 return sync_status.Pass(); |
| 1145 } | 1145 } |
| 1146 | 1146 |
| 1147 bool signout_prohibited = false; | |
|
Andrew T Wilson (Slow)
2013/04/09 15:39:25
Actually, I think signout should always be prohibi
tim (not reviewing)
2013/04/16 03:28:29
If I understand correctly, the way it works now is
| |
| 1148 #if !defined(OS_CHROMEOS) | |
| 1147 // Signout is not allowed if the user has policy (crbug.com/172204). | 1149 // Signout is not allowed if the user has policy (crbug.com/172204). |
| 1148 SigninManager* signin = SigninManagerFactory::GetForProfile(profile); | 1150 signout_prohibited = |
| 1149 DCHECK(signin); | 1151 SigninManagerFactory::GetForProfile(profile)->IsSignoutProhibited(); |
| 1150 sync_status->SetBoolean("signoutAllowed", !signin->IsSignoutProhibited()); | 1152 #endif |
| 1153 | |
| 1151 ProfileSyncService* service( | 1154 ProfileSyncService* service( |
| 1152 ProfileSyncServiceFactory::GetInstance()->GetForProfile(profile)); | 1155 ProfileSyncServiceFactory::GetInstance()->GetForProfile(profile)); |
| 1156 SigninManagerBase* signin = service->signin(); | |
| 1157 sync_status->SetBoolean("signoutAllowed", !signout_prohibited); | |
| 1153 sync_status->SetBoolean("signinAllowed", signin->IsSigninAllowed()); | 1158 sync_status->SetBoolean("signinAllowed", signin->IsSigninAllowed()); |
| 1154 sync_status->SetBoolean("syncSystemEnabled", !!service); | 1159 sync_status->SetBoolean("syncSystemEnabled", !!service); |
| 1155 sync_status->SetBoolean("setupCompleted", | 1160 sync_status->SetBoolean("setupCompleted", |
| 1156 service && service->HasSyncSetupCompleted()); | 1161 service && service->HasSyncSetupCompleted()); |
| 1157 sync_status->SetBoolean("setupInProgress", | 1162 sync_status->SetBoolean("setupInProgress", |
| 1158 service && !service->IsManaged() && service->FirstSetupInProgress()); | 1163 service && !service->IsManaged() && service->FirstSetupInProgress()); |
| 1159 | 1164 |
| 1160 string16 status_label; | 1165 string16 status_label; |
| 1161 string16 link_label; | 1166 string16 link_label; |
| 1162 DCHECK(signin); | 1167 DCHECK(signin); |
| (...skipping 337 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1500 base::FundamentalValue disabled(profile_pref_registrar_.IsManaged() || | 1505 base::FundamentalValue disabled(profile_pref_registrar_.IsManaged() || |
| 1501 is_extension_controlled); | 1506 is_extension_controlled); |
| 1502 base::FundamentalValue extension_controlled(is_extension_controlled); | 1507 base::FundamentalValue extension_controlled(is_extension_controlled); |
| 1503 web_ui()->CallJavascriptFunction("BrowserOptions.setupProxySettingsSection", | 1508 web_ui()->CallJavascriptFunction("BrowserOptions.setupProxySettingsSection", |
| 1504 disabled, extension_controlled); | 1509 disabled, extension_controlled); |
| 1505 | 1510 |
| 1506 #endif // !defined(OS_CHROMEOS) | 1511 #endif // !defined(OS_CHROMEOS) |
| 1507 } | 1512 } |
| 1508 | 1513 |
| 1509 } // namespace options | 1514 } // namespace options |
| OLD | NEW |