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 <string> | 7 #include <string> |
8 #include <vector> | 8 #include <vector> |
9 | 9 |
10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
11 #include "base/bind.h" | 11 #include "base/bind.h" |
12 #include "base/bind_helpers.h" | 12 #include "base/bind_helpers.h" |
13 #include "base/command_line.h" | 13 #include "base/command_line.h" |
14 #include "base/memory/singleton.h" | 14 #include "base/memory/singleton.h" |
15 #include "base/path_service.h" | 15 #include "base/path_service.h" |
16 #include "base/prefs/pref_service.h" | 16 #include "base/prefs/pref_service.h" |
17 #include "base/stl_util.h" | 17 #include "base/stl_util.h" |
18 #include "base/strings/string_number_conversions.h" | 18 #include "base/strings/string_number_conversions.h" |
19 #include "base/utf_string_conversions.h" | 19 #include "base/utf_string_conversions.h" |
20 #include "base/value_conversions.h" | 20 #include "base/value_conversions.h" |
21 #include "base/values.h" | 21 #include "base/values.h" |
22 #include "chrome/browser/auto_launch_trial.h" | 22 #include "chrome/browser/auto_launch_trial.h" |
23 #include "chrome/browser/browser_process.h" | 23 #include "chrome/browser/browser_process.h" |
24 #include "chrome/browser/chrome_page_zoom.h" | 24 #include "chrome/browser/chrome_page_zoom.h" |
25 #include "chrome/browser/custom_home_pages_table_model.h" | 25 #include "chrome/browser/custom_home_pages_table_model.h" |
26 #include "chrome/browser/download/download_prefs.h" | 26 #include "chrome/browser/download/download_prefs.h" |
27 #include "chrome/browser/lifetime/application_lifetime.h" | |
27 #include "chrome/browser/net/url_fixer_upper.h" | 28 #include "chrome/browser/net/url_fixer_upper.h" |
28 #include "chrome/browser/prefs/session_startup_pref.h" | 29 #include "chrome/browser/prefs/session_startup_pref.h" |
29 #include "chrome/browser/printing/cloud_print/cloud_print_proxy_service.h" | 30 #include "chrome/browser/printing/cloud_print/cloud_print_proxy_service.h" |
30 #include "chrome/browser/printing/cloud_print/cloud_print_proxy_service_factory. h" | 31 #include "chrome/browser/printing/cloud_print/cloud_print_proxy_service_factory. h" |
31 #include "chrome/browser/printing/cloud_print/cloud_print_setup_flow.h" | 32 #include "chrome/browser/printing/cloud_print/cloud_print_setup_flow.h" |
32 #include "chrome/browser/printing/cloud_print/cloud_print_url.h" | 33 #include "chrome/browser/printing/cloud_print/cloud_print_url.h" |
33 #include "chrome/browser/profiles/profile_info_cache.h" | 34 #include "chrome/browser/profiles/profile_info_cache.h" |
34 #include "chrome/browser/profiles/profile_info_util.h" | 35 #include "chrome/browser/profiles/profile_info_util.h" |
35 #include "chrome/browser/profiles/profile_manager.h" | 36 #include "chrome/browser/profiles/profile_manager.h" |
36 #include "chrome/browser/profiles/profile_shortcut_manager.h" | 37 #include "chrome/browser/profiles/profile_shortcut_manager.h" |
(...skipping 322 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
359 #if defined(OS_CHROMEOS) && defined(USE_ASH) | 360 #if defined(OS_CHROMEOS) && defined(USE_ASH) |
360 { "setWallpaper", IDS_SET_WALLPAPER_BUTTON }, | 361 { "setWallpaper", IDS_SET_WALLPAPER_BUTTON }, |
361 #endif | 362 #endif |
362 { "advancedSectionTitleSystem", | 363 { "advancedSectionTitleSystem", |
363 IDS_OPTIONS_ADVANCED_SECTION_TITLE_SYSTEM }, | 364 IDS_OPTIONS_ADVANCED_SECTION_TITLE_SYSTEM }, |
364 #if !defined(OS_MACOSX) && !defined(OS_CHROMEOS) | 365 #if !defined(OS_MACOSX) && !defined(OS_CHROMEOS) |
365 { "backgroundModeCheckbox", IDS_OPTIONS_SYSTEM_ENABLE_BACKGROUND_MODE }, | 366 { "backgroundModeCheckbox", IDS_OPTIONS_SYSTEM_ENABLE_BACKGROUND_MODE }, |
366 #endif | 367 #endif |
367 { "hardwareAccelerationModeCheckbox", | 368 { "hardwareAccelerationModeCheckbox", |
368 IDS_OPTIONS_SYSTEM_ENABLE_HARDWARE_ACCELERATION_MODE }, | 369 IDS_OPTIONS_SYSTEM_ENABLE_HARDWARE_ACCELERATION_MODE }, |
370 { "hardwareAccelerationModeChangeRestartPrefix", | |
371 IDS_OPTIONS_SYSTEM_ENABLE_HARDWARE_ACCELERATION_MODE_RESTART_PREFIX }, | |
372 { "hardwareAccelerationModeChangeRestart", | |
373 IDS_OPTIONS_SYSTEM_ENABLE_HARDWARE_ACCELERATION_MODE_RESTART }, | |
374 { "hardwareAccelerationModeChangeRestartPostfix", | |
375 IDS_OPTIONS_SYSTEM_ENABLE_HARDWARE_ACCELERATION_MODE_RESTART_POSTFIX }, | |
Dan Beam
2013/03/20 22:17:55
shouldn't these be in the
#if !defined(OS_CHROM
Zhenyao Mo
2013/03/20 23:21:49
Done.
| |
369 // Strings with product-name substitutions. | 376 // Strings with product-name substitutions. |
370 #if !defined(OS_CHROMEOS) | 377 #if !defined(OS_CHROMEOS) |
371 { "syncOverview", IDS_SYNC_OVERVIEW, IDS_PRODUCT_NAME }, | 378 { "syncOverview", IDS_SYNC_OVERVIEW, IDS_PRODUCT_NAME }, |
372 { "syncButtonTextStart", IDS_SYNC_START_SYNC_BUTTON_LABEL, | 379 { "syncButtonTextStart", IDS_SYNC_START_SYNC_BUTTON_LABEL, |
373 IDS_SHORT_PRODUCT_NAME }, | 380 IDS_SHORT_PRODUCT_NAME }, |
374 #endif | 381 #endif |
375 { "profilesSingleUser", IDS_PROFILES_SINGLE_USER_MESSAGE, | 382 { "profilesSingleUser", IDS_PROFILES_SINGLE_USER_MESSAGE, |
376 IDS_PRODUCT_NAME }, | 383 IDS_PRODUCT_NAME }, |
377 { "defaultBrowserUnknown", IDS_OPTIONS_DEFAULTBROWSER_UNKNOWN, | 384 { "defaultBrowserUnknown", IDS_OPTIONS_DEFAULTBROWSER_UNKNOWN, |
378 IDS_PRODUCT_NAME }, | 385 IDS_PRODUCT_NAME }, |
(...skipping 216 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
595 base::Unretained(this))); | 602 base::Unretained(this))); |
596 web_ui()->RegisterMessageCallback( | 603 web_ui()->RegisterMessageCallback( |
597 "virtualKeyboardChange", | 604 "virtualKeyboardChange", |
598 base::Bind(&BrowserOptionsHandler::VirtualKeyboardChangeCallback, | 605 base::Bind(&BrowserOptionsHandler::VirtualKeyboardChangeCallback, |
599 base::Unretained(this))); | 606 base::Unretained(this))); |
600 web_ui()->RegisterMessageCallback( | 607 web_ui()->RegisterMessageCallback( |
601 "performFactoryResetRestart", | 608 "performFactoryResetRestart", |
602 base::Bind(&BrowserOptionsHandler::PerformFactoryResetRestart, | 609 base::Bind(&BrowserOptionsHandler::PerformFactoryResetRestart, |
603 base::Unretained(this))); | 610 base::Unretained(this))); |
604 #endif | 611 #endif |
612 web_ui()->RegisterMessageCallback( | |
613 "restartBrowser", | |
614 base::Bind(&BrowserOptionsHandler::HandleRestartBrowser, | |
615 base::Unretained(this))); | |
Dan Beam
2013/03/20 22:17:55
^ shouldn't this be defined only in
#if !define
Zhenyao Mo
2013/03/20 23:21:49
Done.
| |
605 } | 616 } |
606 | 617 |
607 void BrowserOptionsHandler::OnStateChanged() { | 618 void BrowserOptionsHandler::OnStateChanged() { |
608 web_ui()->CallJavascriptFunction("BrowserOptions.updateSyncState", | 619 web_ui()->CallJavascriptFunction("BrowserOptions.updateSyncState", |
609 *GetSyncStateDictionary()); | 620 *GetSyncStateDictionary()); |
610 | 621 |
611 SendProfilesInfo(); | 622 SendProfilesInfo(); |
612 } | 623 } |
613 | 624 |
614 void BrowserOptionsHandler::OnSigninAllowedPrefChange() { | 625 void BrowserOptionsHandler::OnSigninAllowedPrefChange() { |
(...skipping 610 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1225 } | 1236 } |
1226 | 1237 |
1227 void BrowserOptionsHandler::HandleDefaultZoomFactor(const ListValue* args) { | 1238 void BrowserOptionsHandler::HandleDefaultZoomFactor(const ListValue* args) { |
1228 double zoom_factor; | 1239 double zoom_factor; |
1229 if (ExtractDoubleValue(args, &zoom_factor)) { | 1240 if (ExtractDoubleValue(args, &zoom_factor)) { |
1230 default_zoom_level_.SetValue( | 1241 default_zoom_level_.SetValue( |
1231 WebKit::WebView::zoomFactorToZoomLevel(zoom_factor)); | 1242 WebKit::WebView::zoomFactorToZoomLevel(zoom_factor)); |
1232 } | 1243 } |
1233 } | 1244 } |
1234 | 1245 |
1246 void BrowserOptionsHandler::HandleRestartBrowser(const ListValue* args) { | |
1247 chrome::AttemptRestart(); | |
1248 } | |
1249 | |
1235 #if !defined(OS_CHROMEOS) | 1250 #if !defined(OS_CHROMEOS) |
1236 void BrowserOptionsHandler::ShowNetworkProxySettings(const ListValue* args) { | 1251 void BrowserOptionsHandler::ShowNetworkProxySettings(const ListValue* args) { |
1237 content::RecordAction(UserMetricsAction("Options_ShowProxySettings")); | 1252 content::RecordAction(UserMetricsAction("Options_ShowProxySettings")); |
1238 AdvancedOptionsUtilities::ShowNetworkProxySettings( | 1253 AdvancedOptionsUtilities::ShowNetworkProxySettings( |
1239 web_ui()->GetWebContents()); | 1254 web_ui()->GetWebContents()); |
1240 } | 1255 } |
1241 #endif | 1256 #endif |
1242 | 1257 |
1243 #if !defined(USE_NSS) && !defined(USE_OPENSSL) | 1258 #if !defined(USE_NSS) && !defined(USE_OPENSSL) |
1244 void BrowserOptionsHandler::ShowManageSSLCertificates(const ListValue* args) { | 1259 void BrowserOptionsHandler::ShowManageSSLCertificates(const ListValue* args) { |
(...skipping 235 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1480 base::FundamentalValue disabled(profile_pref_registrar_.IsManaged() || | 1495 base::FundamentalValue disabled(profile_pref_registrar_.IsManaged() || |
1481 is_extension_controlled); | 1496 is_extension_controlled); |
1482 base::FundamentalValue extension_controlled(is_extension_controlled); | 1497 base::FundamentalValue extension_controlled(is_extension_controlled); |
1483 web_ui()->CallJavascriptFunction("BrowserOptions.setupProxySettingsSection", | 1498 web_ui()->CallJavascriptFunction("BrowserOptions.setupProxySettingsSection", |
1484 disabled, extension_controlled); | 1499 disabled, extension_controlled); |
1485 | 1500 |
1486 #endif // !defined(OS_CHROMEOS) | 1501 #endif // !defined(OS_CHROMEOS) |
1487 } | 1502 } |
1488 | 1503 |
1489 } // namespace options | 1504 } // namespace options |
OLD | NEW |