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/metrics/metrics_reporting_state.h" | 19 #include "chrome/browser/metrics/metrics_reporting_state.h" |
20 #include "chrome/browser/profiles/profile.h" | 20 #include "chrome/browser/profiles/profile.h" |
| 21 #include "chrome/browser/ui/webui/help/help_utils.h" |
| 22 #include "chrome/common/chrome_switches.h" |
21 #include "chrome/common/pref_names.h" | 23 #include "chrome/common/pref_names.h" |
22 #include "chrome/common/url_constants.h" | 24 #include "chrome/common/url_constants.h" |
23 #include "components/url_fixer/url_fixer.h" | 25 #include "components/url_fixer/url_fixer.h" |
24 #include "content/public/browser/notification_details.h" | 26 #include "content/public/browser/notification_details.h" |
25 #include "content/public/browser/notification_types.h" | 27 #include "content/public/browser/notification_types.h" |
26 #include "content/public/browser/user_metrics.h" | 28 #include "content/public/browser/user_metrics.h" |
27 #include "content/public/browser/web_ui.h" | 29 #include "content/public/browser/web_ui.h" |
28 #include "extensions/browser/extension_pref_value_map.h" | 30 #include "extensions/browser/extension_pref_value_map.h" |
29 #include "extensions/browser/extension_pref_value_map_factory.h" | 31 #include "extensions/browser/extension_pref_value_map_factory.h" |
30 #include "extensions/browser/extension_registry.h" | 32 #include "extensions/browser/extension_registry.h" |
(...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
160 localized_strings->SetString("cancel", | 162 localized_strings->SetString("cancel", |
161 l10n_util::GetStringUTF16(IDS_CANCEL)); | 163 l10n_util::GetStringUTF16(IDS_CANCEL)); |
162 localized_strings->SetString("learnMore", | 164 localized_strings->SetString("learnMore", |
163 l10n_util::GetStringUTF16(IDS_LEARN_MORE)); | 165 l10n_util::GetStringUTF16(IDS_LEARN_MORE)); |
164 localized_strings->SetString("close", | 166 localized_strings->SetString("close", |
165 l10n_util::GetStringUTF16(IDS_CLOSE)); | 167 l10n_util::GetStringUTF16(IDS_CLOSE)); |
166 localized_strings->SetString("done", | 168 localized_strings->SetString("done", |
167 l10n_util::GetStringUTF16(IDS_DONE)); | 169 l10n_util::GetStringUTF16(IDS_DONE)); |
168 localized_strings->SetString("deletableItemDeleteButtonTitle", | 170 localized_strings->SetString("deletableItemDeleteButtonTitle", |
169 l10n_util::GetStringUTF16(IDS_OPTIONS_DELETABLE_ITEM_DELETE_BUTTON)); | 171 l10n_util::GetStringUTF16(IDS_OPTIONS_DELETABLE_ITEM_DELETE_BUTTON)); |
| 172 |
| 173 localized_strings->SetString( |
| 174 "browserVersion", |
| 175 l10n_util::GetStringFUTF16(IDS_ABOUT_PRODUCT_VERSION, |
| 176 help_utils::BuildBrowserVersionString())); |
| 177 localized_strings->SetBoolean("showVersion", |
| 178 ::switches::AboutInSettingsEnabled()); |
170 } | 179 } |
171 | 180 |
172 void CoreOptionsHandler::Uninitialize() { | 181 void CoreOptionsHandler::Uninitialize() { |
173 std::string last_pref; | 182 std::string last_pref; |
174 for (PreferenceCallbackMap::const_iterator iter = pref_callback_map_.begin(); | 183 for (PreferenceCallbackMap::const_iterator iter = pref_callback_map_.begin(); |
175 iter != pref_callback_map_.end(); | 184 iter != pref_callback_map_.end(); |
176 ++iter) { | 185 ++iter) { |
177 if (last_pref != iter->first) { | 186 if (last_pref != iter->first) { |
178 StopObservingPref(iter->first); | 187 StopObservingPref(iter->first); |
179 last_pref = iter->first; | 188 last_pref = iter->first; |
(...skipping 471 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
651 } | 660 } |
652 | 661 |
653 void CoreOptionsHandler::UpdatePepperFlashSettingsEnabled() { | 662 void CoreOptionsHandler::UpdatePepperFlashSettingsEnabled() { |
654 base::FundamentalValue enabled( | 663 base::FundamentalValue enabled( |
655 plugin_status_pref_setter_.IsPepperFlashSettingsEnabled()); | 664 plugin_status_pref_setter_.IsPepperFlashSettingsEnabled()); |
656 web_ui()->CallJavascriptFunction( | 665 web_ui()->CallJavascriptFunction( |
657 "OptionsPage.setPepperFlashSettingsEnabled", enabled); | 666 "OptionsPage.setPepperFlashSettingsEnabled", enabled); |
658 } | 667 } |
659 | 668 |
660 } // namespace options | 669 } // namespace options |
OLD | NEW |