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/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" |
11 #include "base/strings/string16.h" | 11 #include "base/strings/string16.h" |
12 #include "base/strings/string_number_conversions.h" | 12 #include "base/strings/string_number_conversions.h" |
13 #include "base/strings/utf_string_conversions.h" | 13 #include "base/strings/utf_string_conversions.h" |
14 #include "base/values.h" | 14 #include "base/values.h" |
15 #include "chrome/browser/browser_process.h" | 15 #include "chrome/browser/browser_process.h" |
16 #include "chrome/browser/chrome_notification_types.h" | 16 #include "chrome/browser/chrome_notification_types.h" |
17 #include "chrome/browser/extensions/extension_service.h" | 17 #include "chrome/browser/extensions/extension_service.h" |
18 #include "chrome/browser/extensions/extension_util.h" | 18 #include "chrome/browser/extensions/extension_util.h" |
19 #include "chrome/browser/profiles/profile.h" | 19 #include "chrome/browser/profiles/profile.h" |
20 #include "chrome/common/chrome_switches.h" | 20 #include "chrome/common/chrome_switches.h" |
21 #include "chrome/common/pref_names.h" | 21 #include "chrome/common/pref_names.h" |
22 #include "chrome/common/url_constants.h" | 22 #include "chrome/common/url_constants.h" |
23 #include "chrome/grit/chromium_strings.h" | 23 #include "chrome/grit/chromium_strings.h" |
24 #include "chrome/grit/generated_resources.h" | 24 #include "chrome/grit/generated_resources.h" |
25 #include "chrome/grit/locale_settings.h" | 25 #include "chrome/grit/locale_settings.h" |
| 26 #include "components/proxy_config/proxy_config_pref_names.h" |
26 #include "components/url_formatter/url_fixer.h" | 27 #include "components/url_formatter/url_fixer.h" |
27 #include "content/public/browser/notification_details.h" | 28 #include "content/public/browser/notification_details.h" |
28 #include "content/public/browser/notification_types.h" | 29 #include "content/public/browser/notification_types.h" |
29 #include "content/public/browser/user_metrics.h" | 30 #include "content/public/browser/user_metrics.h" |
30 #include "content/public/browser/web_ui.h" | 31 #include "content/public/browser/web_ui.h" |
31 #include "extensions/browser/extension_pref_value_map.h" | 32 #include "extensions/browser/extension_pref_value_map.h" |
32 #include "extensions/browser/extension_pref_value_map_factory.h" | 33 #include "extensions/browser/extension_pref_value_map_factory.h" |
33 #include "extensions/browser/extension_registry.h" | 34 #include "extensions/browser/extension_registry.h" |
34 #include "extensions/browser/extension_system.h" | 35 #include "extensions/browser/extension_system.h" |
35 #include "extensions/common/extension.h" | 36 #include "extensions/common/extension.h" |
(...skipping 373 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
409 return dict; | 410 return dict; |
410 } | 411 } |
411 | 412 |
412 PrefService* CoreOptionsHandler::FindServiceForPref( | 413 PrefService* CoreOptionsHandler::FindServiceForPref( |
413 const std::string& pref_name) { | 414 const std::string& pref_name) { |
414 // Proxy is a peculiar case: on ChromeOS, settings exist in both user | 415 // Proxy is a peculiar case: on ChromeOS, settings exist in both user |
415 // prefs and local state, but chrome://settings should affect only user prefs. | 416 // prefs and local state, but chrome://settings should affect only user prefs. |
416 // Elsewhere the proxy settings are stored in local state. | 417 // Elsewhere the proxy settings are stored in local state. |
417 // See http://crbug.com/157147 | 418 // See http://crbug.com/157147 |
418 PrefService* user_prefs = Profile::FromWebUI(web_ui())->GetPrefs(); | 419 PrefService* user_prefs = Profile::FromWebUI(web_ui())->GetPrefs(); |
419 if (pref_name == prefs::kProxy) | 420 if (pref_name == proxy_config::prefs::kProxy) |
420 #if defined(OS_CHROMEOS) | 421 #if defined(OS_CHROMEOS) |
421 return user_prefs; | 422 return user_prefs; |
422 #else | 423 #else |
423 return g_browser_process->local_state(); | 424 return g_browser_process->local_state(); |
424 #endif | 425 #endif |
425 | 426 |
426 // Find which PrefService contains the given pref. Pref names should not | 427 // Find which PrefService contains the given pref. Pref names should not |
427 // be duplicated across services, however if they are, prefer the user's | 428 // be duplicated across services, however if they are, prefer the user's |
428 // prefs. | 429 // prefs. |
429 if (user_prefs->FindPreference(pref_name.c_str())) | 430 if (user_prefs->FindPreference(pref_name.c_str())) |
(...skipping 222 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
652 plugin_status_pref_setter_.IsPepperFlashSettingsEnabled()); | 653 plugin_status_pref_setter_.IsPepperFlashSettingsEnabled()); |
653 web_ui()->CallJavascriptFunction( | 654 web_ui()->CallJavascriptFunction( |
654 "options.OptionsPage.setPepperFlashSettingsEnabled", enabled); | 655 "options.OptionsPage.setPepperFlashSettingsEnabled", enabled); |
655 } | 656 } |
656 | 657 |
657 bool CoreOptionsHandler::IsUserUnsupervised(const base::Value* to_value) { | 658 bool CoreOptionsHandler::IsUserUnsupervised(const base::Value* to_value) { |
658 return !Profile::FromWebUI(web_ui())->IsSupervised(); | 659 return !Profile::FromWebUI(web_ui())->IsSupervised(); |
659 } | 660 } |
660 | 661 |
661 } // namespace options | 662 } // namespace options |
OLD | NEW |