| 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 <stddef.h> | 7 #include <stddef.h> |
| 8 | 8 |
| 9 #include <set> | 9 #include <set> |
| 10 #include <utility> | 10 #include <utility> |
| (...skipping 161 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 172 details->SetString("name", extension ? extension->name() : std::string()); | 172 details->SetString("name", extension ? extension->name() : std::string()); |
| 173 dict->Set(key, details.release()); | 173 dict->Set(key, details.release()); |
| 174 } | 174 } |
| 175 | 175 |
| 176 #if !defined(OS_CHROMEOS) | 176 #if !defined(OS_CHROMEOS) |
| 177 bool IsDisabledByPolicy(const BooleanPrefMember& pref) { | 177 bool IsDisabledByPolicy(const BooleanPrefMember& pref) { |
| 178 return pref.IsManaged() && !pref.GetValue(); | 178 return pref.IsManaged() && !pref.GetValue(); |
| 179 } | 179 } |
| 180 #endif // !defined(OS_CHROMEOS) | 180 #endif // !defined(OS_CHROMEOS) |
| 181 | 181 |
| 182 std::string GetSyncErrorAction(sync_ui_util::ActionType action_type) { |
| 183 switch (action_type) { |
| 184 case sync_ui_util::REAUTHENTICATE: |
| 185 return "reauthenticate"; |
| 186 case sync_ui_util::UPGRADE_CLIENT: |
| 187 return "upgradeClient"; |
| 188 case sync_ui_util::ENTER_PASSPHRASE: |
| 189 return "enterPassphrase"; |
| 190 default: |
| 191 return "noAction"; |
| 192 } |
| 193 } |
| 194 |
| 182 } // namespace | 195 } // namespace |
| 183 | 196 |
| 184 namespace options { | 197 namespace options { |
| 185 | 198 |
| 186 BrowserOptionsHandler::BrowserOptionsHandler() | 199 BrowserOptionsHandler::BrowserOptionsHandler() |
| 187 : page_initialized_(false), | 200 : page_initialized_(false), |
| 188 template_url_service_(NULL), | 201 template_url_service_(NULL), |
| 189 cloud_print_mdns_ui_enabled_(false), | 202 cloud_print_mdns_ui_enabled_(false), |
| 190 #if defined(OS_CHROMEOS) | 203 #if defined(OS_CHROMEOS) |
| 191 enable_factory_reset_(false), | 204 enable_factory_reset_(false), |
| (...skipping 1378 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1570 base::string16 link_label; | 1583 base::string16 link_label; |
| 1571 sync_ui_util::ActionType action_type = sync_ui_util::NO_ACTION; | 1584 sync_ui_util::ActionType action_type = sync_ui_util::NO_ACTION; |
| 1572 bool status_has_error = | 1585 bool status_has_error = |
| 1573 sync_ui_util::GetStatusLabels(profile, service, *signin, | 1586 sync_ui_util::GetStatusLabels(profile, service, *signin, |
| 1574 sync_ui_util::WITH_HTML, &status_label, | 1587 sync_ui_util::WITH_HTML, &status_label, |
| 1575 &link_label, &action_type) == | 1588 &link_label, &action_type) == |
| 1576 sync_ui_util::SYNC_ERROR; | 1589 sync_ui_util::SYNC_ERROR; |
| 1577 sync_status->SetString("statusText", status_label); | 1590 sync_status->SetString("statusText", status_label); |
| 1578 sync_status->SetString("actionLinkText", link_label); | 1591 sync_status->SetString("actionLinkText", link_label); |
| 1579 sync_status->SetBoolean("hasError", status_has_error); | 1592 sync_status->SetBoolean("hasError", status_has_error); |
| 1580 | 1593 sync_status->SetString("statusAction", GetSyncErrorAction(action_type)); |
| 1581 sync_status->SetBoolean("managed", service && service->IsManaged()); | 1594 sync_status->SetBoolean("managed", service && service->IsManaged()); |
| 1582 sync_status->SetBoolean("signedIn", signin->IsAuthenticated()); | 1595 sync_status->SetBoolean("signedIn", signin->IsAuthenticated()); |
| 1583 sync_status->SetString("accountInfo", | 1596 sync_status->SetString("accountInfo", |
| 1584 l10n_util::GetStringFUTF16( | 1597 l10n_util::GetStringFUTF16( |
| 1585 IDS_SYNC_ACCOUNT_INFO, | 1598 IDS_SYNC_ACCOUNT_INFO, |
| 1586 signin_ui_util::GetAuthenticatedUsername(signin))); | 1599 signin_ui_util::GetAuthenticatedUsername(signin))); |
| 1587 sync_status->SetBoolean("hasUnrecoverableError", | 1600 sync_status->SetBoolean("hasUnrecoverableError", |
| 1588 service && service->HasUnrecoverableError()); | 1601 service && service->HasUnrecoverableError()); |
| 1589 | 1602 |
| 1590 return sync_status; | 1603 return sync_status; |
| (...skipping 673 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2264 | 2277 |
| 2265 bool BrowserOptionsHandler::IsDeviceOwnerProfile() { | 2278 bool BrowserOptionsHandler::IsDeviceOwnerProfile() { |
| 2266 #if defined(OS_CHROMEOS) | 2279 #if defined(OS_CHROMEOS) |
| 2267 return chromeos::ProfileHelper::IsOwnerProfile(Profile::FromWebUI(web_ui())); | 2280 return chromeos::ProfileHelper::IsOwnerProfile(Profile::FromWebUI(web_ui())); |
| 2268 #else | 2281 #else |
| 2269 return true; | 2282 return true; |
| 2270 #endif | 2283 #endif |
| 2271 } | 2284 } |
| 2272 | 2285 |
| 2273 } // namespace options | 2286 } // namespace options |
| OLD | NEW |