| 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/url_formatter/url_fixer.h" | 26 #include "components/url_fixer/url_fixer.h" |
| 27 #include "content/public/browser/notification_details.h" | 27 #include "content/public/browser/notification_details.h" |
| 28 #include "content/public/browser/notification_types.h" | 28 #include "content/public/browser/notification_types.h" |
| 29 #include "content/public/browser/user_metrics.h" | 29 #include "content/public/browser/user_metrics.h" |
| 30 #include "content/public/browser/web_ui.h" | 30 #include "content/public/browser/web_ui.h" |
| 31 #include "extensions/browser/extension_pref_value_map.h" | 31 #include "extensions/browser/extension_pref_value_map.h" |
| 32 #include "extensions/browser/extension_pref_value_map_factory.h" | 32 #include "extensions/browser/extension_pref_value_map_factory.h" |
| 33 #include "extensions/browser/extension_registry.h" | 33 #include "extensions/browser/extension_registry.h" |
| 34 #include "extensions/browser/extension_system.h" | 34 #include "extensions/browser/extension_system.h" |
| 35 #include "extensions/common/extension.h" | 35 #include "extensions/common/extension.h" |
| 36 #include "grit/components_strings.h" | 36 #include "grit/components_strings.h" |
| (...skipping 531 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 568 NOTREACHED(); | 568 NOTREACHED(); |
| 569 return; | 569 return; |
| 570 } | 570 } |
| 571 break; | 571 break; |
| 572 case TYPE_URL: { | 572 case TYPE_URL: { |
| 573 std::string original; | 573 std::string original; |
| 574 if (!value->GetAsString(&original)) { | 574 if (!value->GetAsString(&original)) { |
| 575 NOTREACHED(); | 575 NOTREACHED(); |
| 576 return; | 576 return; |
| 577 } | 577 } |
| 578 GURL fixed = url_formatter::FixupURL(original, std::string()); | 578 GURL fixed = url_fixer::FixupURL(original, std::string()); |
| 579 temp_value.reset(new base::StringValue(fixed.spec())); | 579 temp_value.reset(new base::StringValue(fixed.spec())); |
| 580 value = temp_value.get(); | 580 value = temp_value.get(); |
| 581 break; | 581 break; |
| 582 } | 582 } |
| 583 case TYPE_LIST: { | 583 case TYPE_LIST: { |
| 584 // In case we have a List pref we got a JSON string. | 584 // In case we have a List pref we got a JSON string. |
| 585 std::string json_string; | 585 std::string json_string; |
| 586 if (!value->GetAsString(&json_string)) { | 586 if (!value->GetAsString(&json_string)) { |
| 587 NOTREACHED(); | 587 NOTREACHED(); |
| 588 return; | 588 return; |
| (...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 652 plugin_status_pref_setter_.IsPepperFlashSettingsEnabled()); | 652 plugin_status_pref_setter_.IsPepperFlashSettingsEnabled()); |
| 653 web_ui()->CallJavascriptFunction( | 653 web_ui()->CallJavascriptFunction( |
| 654 "options.OptionsPage.setPepperFlashSettingsEnabled", enabled); | 654 "options.OptionsPage.setPepperFlashSettingsEnabled", enabled); |
| 655 } | 655 } |
| 656 | 656 |
| 657 bool CoreOptionsHandler::IsUserUnsupervised(const base::Value* to_value) { | 657 bool CoreOptionsHandler::IsUserUnsupervised(const base::Value* to_value) { |
| 658 return !Profile::FromWebUI(web_ui())->IsSupervised(); | 658 return !Profile::FromWebUI(web_ui())->IsSupervised(); |
| 659 } | 659 } |
| 660 | 660 |
| 661 } // namespace options | 661 } // namespace options |
| OLD | NEW |