OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/core_options_handler.h" | 5 #include "chrome/browser/ui/webui/options/core_options_handler.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/bind_helpers.h" | 8 #include "base/bind_helpers.h" |
9 #include "base/json/json_reader.h" | 9 #include "base/json/json_reader.h" |
10 #include "base/memory/scoped_ptr.h" | 10 #include "base/memory/scoped_ptr.h" |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
55 l10n_util::GetStringUTF16(IDS_SETTINGS_TITLE)); | 55 l10n_util::GetStringUTF16(IDS_SETTINGS_TITLE)); |
56 | 56 |
57 // Managed prefs | 57 // Managed prefs |
58 localized_strings->SetString("policyManagedPrefsBannerText", | 58 localized_strings->SetString("policyManagedPrefsBannerText", |
59 l10n_util::GetStringUTF16(IDS_OPTIONS_POLICY_MANAGED_PREFS)); | 59 l10n_util::GetStringUTF16(IDS_OPTIONS_POLICY_MANAGED_PREFS)); |
60 localized_strings->SetString("extensionManagedPrefsBannerText", | 60 localized_strings->SetString("extensionManagedPrefsBannerText", |
61 l10n_util::GetStringUTF16(IDS_OPTIONS_EXTENSION_MANAGED_PREFS)); | 61 l10n_util::GetStringUTF16(IDS_OPTIONS_EXTENSION_MANAGED_PREFS)); |
62 localized_strings->SetString("policyAndExtensionManagedPrefsBannerText", | 62 localized_strings->SetString("policyAndExtensionManagedPrefsBannerText", |
63 l10n_util::GetStringUTF16(IDS_OPTIONS_POLICY_EXTENSION_MANAGED_PREFS)); | 63 l10n_util::GetStringUTF16(IDS_OPTIONS_POLICY_EXTENSION_MANAGED_PREFS)); |
64 | 64 |
| 65 // Controlled settings bubble. |
| 66 localized_strings->SetString("controlledSettingPolicy", |
| 67 l10n_util::GetStringUTF16(IDS_OPTIONS_CONTROLLED_SETTING_POLICY)); |
| 68 localized_strings->SetString("controlledSettingExtension", |
| 69 l10n_util::GetStringUTF16(IDS_OPTIONS_CONTROLLED_SETTING_EXTENSION)); |
| 70 localized_strings->SetString("controlledSettingRecommended", |
| 71 l10n_util::GetStringUTF16(IDS_OPTIONS_CONTROLLED_SETTING_RECOMMENDED)); |
| 72 localized_strings->SetString("controlledSettingApplyRecommendation", |
| 73 l10n_util::GetStringUTF16( |
| 74 IDS_OPTIONS_CONTROLLED_SETTING_APPLY_RECOMMENDATION)); |
| 75 |
65 // Search | 76 // Search |
66 RegisterTitle(localized_strings, "searchPage", IDS_OPTIONS_SEARCH_PAGE_TITLE); | 77 RegisterTitle(localized_strings, "searchPage", IDS_OPTIONS_SEARCH_PAGE_TITLE); |
67 localized_strings->SetString("searchPlaceholder", | 78 localized_strings->SetString("searchPlaceholder", |
68 l10n_util::GetStringUTF16(IDS_OPTIONS_SEARCH_PLACEHOLDER)); | 79 l10n_util::GetStringUTF16(IDS_OPTIONS_SEARCH_PLACEHOLDER)); |
69 localized_strings->SetString("searchPageNoMatches", | 80 localized_strings->SetString("searchPageNoMatches", |
70 l10n_util::GetStringUTF16(IDS_OPTIONS_SEARCH_PAGE_NO_MATCHES)); | 81 l10n_util::GetStringUTF16(IDS_OPTIONS_SEARCH_PAGE_NO_MATCHES)); |
71 localized_strings->SetString("searchPageHelpLabel", | 82 localized_strings->SetString("searchPageHelpLabel", |
72 l10n_util::GetStringUTF16(IDS_OPTIONS_SEARCH_PAGE_HELP_LABEL)); | 83 l10n_util::GetStringUTF16(IDS_OPTIONS_SEARCH_PAGE_HELP_LABEL)); |
73 localized_strings->SetString("searchPageHelpTitle", | 84 localized_strings->SetString("searchPageHelpTitle", |
74 l10n_util::GetStringFUTF16(IDS_OPTIONS_SEARCH_PAGE_HELP_TITLE, | 85 l10n_util::GetStringFUTF16(IDS_OPTIONS_SEARCH_PAGE_HELP_TITLE, |
(...skipping 179 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
254 const PrefService::Preference* pref, | 265 const PrefService::Preference* pref, |
255 const PrefService::Preference* controlling_pref) { | 266 const PrefService::Preference* controlling_pref) { |
256 DictionaryValue* dict = new DictionaryValue; | 267 DictionaryValue* dict = new DictionaryValue; |
257 dict->Set("value", pref->GetValue()->DeepCopy()); | 268 dict->Set("value", pref->GetValue()->DeepCopy()); |
258 if (!controlling_pref) // No controlling pref is managing actual pref. | 269 if (!controlling_pref) // No controlling pref is managing actual pref. |
259 controlling_pref = pref; // This means pref is controlling itself. | 270 controlling_pref = pref; // This means pref is controlling itself. |
260 if (controlling_pref->IsManaged()) { | 271 if (controlling_pref->IsManaged()) { |
261 dict->SetString("controlledBy", "policy"); | 272 dict->SetString("controlledBy", "policy"); |
262 } else if (controlling_pref->IsExtensionControlled()) { | 273 } else if (controlling_pref->IsExtensionControlled()) { |
263 dict->SetString("controlledBy", "extension"); | 274 dict->SetString("controlledBy", "extension"); |
| 275 } else if (controlling_pref->IsUserModifiable() && |
| 276 !controlling_pref->IsDefaultValue()) { |
| 277 dict->SetString("controlledBy", "recommended"); |
264 } | 278 } |
265 dict->SetBoolean("disabled", !controlling_pref->IsUserModifiable()); | 279 dict->SetBoolean("disabled", !controlling_pref->IsUserModifiable()); |
266 return dict; | 280 return dict; |
267 } | 281 } |
268 | 282 |
269 void CoreOptionsHandler::StopObservingPref(const std::string& path) { | 283 void CoreOptionsHandler::StopObservingPref(const std::string& path) { |
270 registrar_.Remove(path.c_str(), this); | 284 registrar_.Remove(path.c_str(), this); |
271 } | 285 } |
272 | 286 |
273 void CoreOptionsHandler::HandleFetchPrefs(const ListValue* args) { | 287 void CoreOptionsHandler::HandleFetchPrefs(const ListValue* args) { |
(...skipping 168 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
442 UserMetrics::RecordComputedAction(metric); | 456 UserMetrics::RecordComputedAction(metric); |
443 } | 457 } |
444 | 458 |
445 void CoreOptionsHandler::UpdateClearPluginLSOData() { | 459 void CoreOptionsHandler::UpdateClearPluginLSOData() { |
446 scoped_ptr<base::Value> enabled( | 460 scoped_ptr<base::Value> enabled( |
447 base::Value::CreateBooleanValue( | 461 base::Value::CreateBooleanValue( |
448 clear_plugin_lso_data_enabled_.GetValue())); | 462 clear_plugin_lso_data_enabled_.GetValue())); |
449 web_ui_->CallJavascriptFunction( | 463 web_ui_->CallJavascriptFunction( |
450 "OptionsPage.setClearPluginLSODataEnabled", *enabled); | 464 "OptionsPage.setClearPluginLSODataEnabled", *enabled); |
451 } | 465 } |
OLD | NEW |