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 320 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
357 { "proxiesConfigureButton", IDS_OPTIONS_PROXIES_CONFIGURE_BUTTON }, | 358 { "proxiesConfigureButton", IDS_OPTIONS_PROXIES_CONFIGURE_BUTTON }, |
358 #endif | 359 #endif |
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 #if !defined(OS_CHROMEOS) |
369 { "gpuModeCheckbox", | |
368 IDS_OPTIONS_SYSTEM_ENABLE_HARDWARE_ACCELERATION_MODE }, | 370 IDS_OPTIONS_SYSTEM_ENABLE_HARDWARE_ACCELERATION_MODE }, |
371 { "gpuModeResetRestart", | |
372 IDS_OPTIONS_SYSTEM_ENABLE_HARDWARE_ACCELERATION_MODE_RESTART }, | |
369 // Strings with product-name substitutions. | 373 // Strings with product-name substitutions. |
370 #if !defined(OS_CHROMEOS) | |
371 { "syncOverview", IDS_SYNC_OVERVIEW, IDS_PRODUCT_NAME }, | 374 { "syncOverview", IDS_SYNC_OVERVIEW, IDS_PRODUCT_NAME }, |
372 { "syncButtonTextStart", IDS_SYNC_START_SYNC_BUTTON_LABEL, | 375 { "syncButtonTextStart", IDS_SYNC_START_SYNC_BUTTON_LABEL, |
373 IDS_SHORT_PRODUCT_NAME }, | 376 IDS_SHORT_PRODUCT_NAME }, |
374 #endif | 377 #endif |
375 { "profilesSingleUser", IDS_PROFILES_SINGLE_USER_MESSAGE, | 378 { "profilesSingleUser", IDS_PROFILES_SINGLE_USER_MESSAGE, |
376 IDS_PRODUCT_NAME }, | 379 IDS_PRODUCT_NAME }, |
377 { "defaultBrowserUnknown", IDS_OPTIONS_DEFAULTBROWSER_UNKNOWN, | 380 { "defaultBrowserUnknown", IDS_OPTIONS_DEFAULTBROWSER_UNKNOWN, |
378 IDS_PRODUCT_NAME }, | 381 IDS_PRODUCT_NAME }, |
379 { "defaultBrowserUseAsDefault", IDS_OPTIONS_DEFAULTBROWSER_USEASDEFAULT, | 382 { "defaultBrowserUseAsDefault", IDS_OPTIONS_DEFAULTBROWSER_USEASDEFAULT, |
380 IDS_PRODUCT_NAME }, | 383 IDS_PRODUCT_NAME }, |
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
481 g_browser_process->profile_manager()->GetNumberOfProfiles() > 1); | 484 g_browser_process->profile_manager()->GetNumberOfProfiles() > 1); |
482 #endif | 485 #endif |
483 | 486 |
484 if (ShouldShowMultiProfilesUserList()) | 487 if (ShouldShowMultiProfilesUserList()) |
485 values->Set("profilesInfo", GetProfilesInfoList().release()); | 488 values->Set("profilesInfo", GetProfilesInfoList().release()); |
486 | 489 |
487 #if defined(ENABLE_MANAGED_USERS) | 490 #if defined(ENABLE_MANAGED_USERS) |
488 ManagedUserService* service = | 491 ManagedUserService* service = |
489 ManagedUserServiceFactory::GetForProfile(Profile::FromWebUI(web_ui())); | 492 ManagedUserServiceFactory::GetForProfile(Profile::FromWebUI(web_ui())); |
490 values->SetBoolean("profileIsManaged", service->ProfileIsManaged()); | 493 values->SetBoolean("profileIsManaged", service->ProfileIsManaged()); |
491 #endif | 494 #endif |
Dan Beam
2013/03/21 22:42:44
values->SetBoolean("gpuModeAtStart", gpu_thinger::
Dan Beam
2013/03/21 22:43:33
er, I mean
#if !defined(OS_CHROME)
values->SetB
Dan Beam
2013/03/21 22:43:50
OS_CHROMEOS**
| |
492 } | 495 } |
493 | 496 |
494 void BrowserOptionsHandler::RegisterCloudPrintValues(DictionaryValue* values) { | 497 void BrowserOptionsHandler::RegisterCloudPrintValues(DictionaryValue* values) { |
495 #if defined(OS_CHROMEOS) | 498 #if defined(OS_CHROMEOS) |
496 values->SetString("cloudPrintChromeosOptionLabel", | 499 values->SetString("cloudPrintChromeosOptionLabel", |
497 l10n_util::GetStringFUTF16( | 500 l10n_util::GetStringFUTF16( |
498 IDS_CLOUD_PRINT_CHROMEOS_OPTION_LABEL, | 501 IDS_CLOUD_PRINT_CHROMEOS_OPTION_LABEL, |
499 l10n_util::GetStringUTF16(IDS_GOOGLE_CLOUD_PRINT))); | 502 l10n_util::GetStringUTF16(IDS_GOOGLE_CLOUD_PRINT))); |
500 values->SetString("cloudPrintChromeosOptionButton", | 503 values->SetString("cloudPrintChromeosOptionButton", |
501 l10n_util::GetStringFUTF16( | 504 l10n_util::GetStringFUTF16( |
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
594 base::Bind(&BrowserOptionsHandler::HighContrastChangeCallback, | 597 base::Bind(&BrowserOptionsHandler::HighContrastChangeCallback, |
595 base::Unretained(this))); | 598 base::Unretained(this))); |
596 web_ui()->RegisterMessageCallback( | 599 web_ui()->RegisterMessageCallback( |
597 "virtualKeyboardChange", | 600 "virtualKeyboardChange", |
598 base::Bind(&BrowserOptionsHandler::VirtualKeyboardChangeCallback, | 601 base::Bind(&BrowserOptionsHandler::VirtualKeyboardChangeCallback, |
599 base::Unretained(this))); | 602 base::Unretained(this))); |
600 web_ui()->RegisterMessageCallback( | 603 web_ui()->RegisterMessageCallback( |
601 "performFactoryResetRestart", | 604 "performFactoryResetRestart", |
602 base::Bind(&BrowserOptionsHandler::PerformFactoryResetRestart, | 605 base::Bind(&BrowserOptionsHandler::PerformFactoryResetRestart, |
603 base::Unretained(this))); | 606 base::Unretained(this))); |
607 #else | |
608 web_ui()->RegisterMessageCallback( | |
609 "restartBrowser", | |
610 base::Bind(&BrowserOptionsHandler::HandleRestartBrowser, | |
611 base::Unretained(this))); | |
604 #endif | 612 #endif |
605 } | 613 } |
606 | 614 |
607 void BrowserOptionsHandler::OnStateChanged() { | 615 void BrowserOptionsHandler::OnStateChanged() { |
608 web_ui()->CallJavascriptFunction("BrowserOptions.updateSyncState", | 616 web_ui()->CallJavascriptFunction("BrowserOptions.updateSyncState", |
609 *GetSyncStateDictionary()); | 617 *GetSyncStateDictionary()); |
610 | 618 |
611 SendProfilesInfo(); | 619 SendProfilesInfo(); |
612 } | 620 } |
613 | 621 |
(...skipping 611 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1225 } | 1233 } |
1226 | 1234 |
1227 void BrowserOptionsHandler::HandleDefaultZoomFactor(const ListValue* args) { | 1235 void BrowserOptionsHandler::HandleDefaultZoomFactor(const ListValue* args) { |
1228 double zoom_factor; | 1236 double zoom_factor; |
1229 if (ExtractDoubleValue(args, &zoom_factor)) { | 1237 if (ExtractDoubleValue(args, &zoom_factor)) { |
1230 default_zoom_level_.SetValue( | 1238 default_zoom_level_.SetValue( |
1231 WebKit::WebView::zoomFactorToZoomLevel(zoom_factor)); | 1239 WebKit::WebView::zoomFactorToZoomLevel(zoom_factor)); |
1232 } | 1240 } |
1233 } | 1241 } |
1234 | 1242 |
1243 void BrowserOptionsHandler::HandleRestartBrowser(const ListValue* args) { | |
1244 chrome::AttemptRestart(); | |
1245 } | |
1246 | |
1235 #if !defined(OS_CHROMEOS) | 1247 #if !defined(OS_CHROMEOS) |
1236 void BrowserOptionsHandler::ShowNetworkProxySettings(const ListValue* args) { | 1248 void BrowserOptionsHandler::ShowNetworkProxySettings(const ListValue* args) { |
1237 content::RecordAction(UserMetricsAction("Options_ShowProxySettings")); | 1249 content::RecordAction(UserMetricsAction("Options_ShowProxySettings")); |
1238 AdvancedOptionsUtilities::ShowNetworkProxySettings( | 1250 AdvancedOptionsUtilities::ShowNetworkProxySettings( |
1239 web_ui()->GetWebContents()); | 1251 web_ui()->GetWebContents()); |
1240 } | 1252 } |
1241 #endif | 1253 #endif |
1242 | 1254 |
1243 #if !defined(USE_NSS) && !defined(USE_OPENSSL) | 1255 #if !defined(USE_NSS) && !defined(USE_OPENSSL) |
1244 void BrowserOptionsHandler::ShowManageSSLCertificates(const ListValue* args) { | 1256 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() || | 1492 base::FundamentalValue disabled(profile_pref_registrar_.IsManaged() || |
1481 is_extension_controlled); | 1493 is_extension_controlled); |
1482 base::FundamentalValue extension_controlled(is_extension_controlled); | 1494 base::FundamentalValue extension_controlled(is_extension_controlled); |
1483 web_ui()->CallJavascriptFunction("BrowserOptions.setupProxySettingsSection", | 1495 web_ui()->CallJavascriptFunction("BrowserOptions.setupProxySettingsSection", |
1484 disabled, extension_controlled); | 1496 disabled, extension_controlled); |
1485 | 1497 |
1486 #endif // !defined(OS_CHROMEOS) | 1498 #endif // !defined(OS_CHROMEOS) |
1487 } | 1499 } |
1488 | 1500 |
1489 } // namespace options | 1501 } // namespace options |
OLD | NEW |