Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(80)

Side by Side Diff: chrome/browser/ui/webui/options/browser_options_handler.cc

Issue 12494033: Provide a link to restart chrome when changing gpu settings (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 7 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « chrome/browser/ui/webui/options/browser_options_handler.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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/gpu/gpu_mode_manager.h"
28 #include "chrome/browser/lifetime/application_lifetime.h"
27 #include "chrome/browser/net/url_fixer_upper.h" 29 #include "chrome/browser/net/url_fixer_upper.h"
28 #include "chrome/browser/prefs/session_startup_pref.h" 30 #include "chrome/browser/prefs/session_startup_pref.h"
29 #include "chrome/browser/printing/cloud_print/cloud_print_proxy_service.h" 31 #include "chrome/browser/printing/cloud_print/cloud_print_proxy_service.h"
30 #include "chrome/browser/printing/cloud_print/cloud_print_proxy_service_factory. h" 32 #include "chrome/browser/printing/cloud_print/cloud_print_proxy_service_factory. h"
31 #include "chrome/browser/printing/cloud_print/cloud_print_setup_flow.h" 33 #include "chrome/browser/printing/cloud_print/cloud_print_setup_flow.h"
32 #include "chrome/browser/printing/cloud_print/cloud_print_url.h" 34 #include "chrome/browser/printing/cloud_print/cloud_print_url.h"
33 #include "chrome/browser/profiles/profile_info_cache.h" 35 #include "chrome/browser/profiles/profile_info_cache.h"
34 #include "chrome/browser/profiles/profile_info_util.h" 36 #include "chrome/browser/profiles/profile_info_util.h"
35 #include "chrome/browser/profiles/profile_manager.h" 37 #include "chrome/browser/profiles/profile_manager.h"
36 #include "chrome/browser/profiles/profile_shortcut_manager.h" 38 #include "chrome/browser/profiles/profile_shortcut_manager.h"
(...skipping 320 matching lines...) Expand 10 before | Expand all | Expand 10 after
357 { "proxiesConfigureButton", IDS_OPTIONS_PROXIES_CONFIGURE_BUTTON }, 359 { "proxiesConfigureButton", IDS_OPTIONS_PROXIES_CONFIGURE_BUTTON },
358 #endif 360 #endif
359 #if defined(OS_CHROMEOS) && defined(USE_ASH) 361 #if defined(OS_CHROMEOS) && defined(USE_ASH)
360 { "setWallpaper", IDS_SET_WALLPAPER_BUTTON }, 362 { "setWallpaper", IDS_SET_WALLPAPER_BUTTON },
361 #endif 363 #endif
362 { "advancedSectionTitleSystem", 364 { "advancedSectionTitleSystem",
363 IDS_OPTIONS_ADVANCED_SECTION_TITLE_SYSTEM }, 365 IDS_OPTIONS_ADVANCED_SECTION_TITLE_SYSTEM },
364 #if !defined(OS_MACOSX) && !defined(OS_CHROMEOS) 366 #if !defined(OS_MACOSX) && !defined(OS_CHROMEOS)
365 { "backgroundModeCheckbox", IDS_OPTIONS_SYSTEM_ENABLE_BACKGROUND_MODE }, 367 { "backgroundModeCheckbox", IDS_OPTIONS_SYSTEM_ENABLE_BACKGROUND_MODE },
366 #endif 368 #endif
367 { "hardwareAccelerationModeCheckbox", 369 #if !defined(OS_CHROMEOS)
370 { "gpuModeCheckbox",
368 IDS_OPTIONS_SYSTEM_ENABLE_HARDWARE_ACCELERATION_MODE }, 371 IDS_OPTIONS_SYSTEM_ENABLE_HARDWARE_ACCELERATION_MODE },
372 { "gpuModeResetRestart",
373 IDS_OPTIONS_SYSTEM_ENABLE_HARDWARE_ACCELERATION_MODE_RESTART },
369 // Strings with product-name substitutions. 374 // Strings with product-name substitutions.
370 #if !defined(OS_CHROMEOS)
371 { "syncOverview", IDS_SYNC_OVERVIEW, IDS_PRODUCT_NAME }, 375 { "syncOverview", IDS_SYNC_OVERVIEW, IDS_PRODUCT_NAME },
372 { "syncButtonTextStart", IDS_SYNC_START_SYNC_BUTTON_LABEL, 376 { "syncButtonTextStart", IDS_SYNC_START_SYNC_BUTTON_LABEL,
373 IDS_SHORT_PRODUCT_NAME }, 377 IDS_SHORT_PRODUCT_NAME },
374 #endif 378 #endif
375 { "profilesSingleUser", IDS_PROFILES_SINGLE_USER_MESSAGE, 379 { "profilesSingleUser", IDS_PROFILES_SINGLE_USER_MESSAGE,
376 IDS_PRODUCT_NAME }, 380 IDS_PRODUCT_NAME },
377 { "defaultBrowserUnknown", IDS_OPTIONS_DEFAULTBROWSER_UNKNOWN, 381 { "defaultBrowserUnknown", IDS_OPTIONS_DEFAULTBROWSER_UNKNOWN,
378 IDS_PRODUCT_NAME }, 382 IDS_PRODUCT_NAME },
379 { "defaultBrowserUseAsDefault", IDS_OPTIONS_DEFAULTBROWSER_USEASDEFAULT, 383 { "defaultBrowserUseAsDefault", IDS_OPTIONS_DEFAULTBROWSER_USEASDEFAULT,
380 IDS_PRODUCT_NAME }, 384 IDS_PRODUCT_NAME },
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after
482 #endif 486 #endif
483 487
484 if (ShouldShowMultiProfilesUserList()) 488 if (ShouldShowMultiProfilesUserList())
485 values->Set("profilesInfo", GetProfilesInfoList().release()); 489 values->Set("profilesInfo", GetProfilesInfoList().release());
486 490
487 #if defined(ENABLE_MANAGED_USERS) 491 #if defined(ENABLE_MANAGED_USERS)
488 ManagedUserService* service = 492 ManagedUserService* service =
489 ManagedUserServiceFactory::GetForProfile(Profile::FromWebUI(web_ui())); 493 ManagedUserServiceFactory::GetForProfile(Profile::FromWebUI(web_ui()));
490 values->SetBoolean("profileIsManaged", service->ProfileIsManaged()); 494 values->SetBoolean("profileIsManaged", service->ProfileIsManaged());
491 #endif 495 #endif
496
497 #if !defined(OS_CHROMEOS)
498 values->SetBoolean("gpuEnabledAtStart",
499 GpuModeManager::IsGpuModePrefEnabled());
500 #endif
492 } 501 }
493 502
494 void BrowserOptionsHandler::RegisterCloudPrintValues(DictionaryValue* values) { 503 void BrowserOptionsHandler::RegisterCloudPrintValues(DictionaryValue* values) {
495 #if defined(OS_CHROMEOS) 504 #if defined(OS_CHROMEOS)
496 values->SetString("cloudPrintChromeosOptionLabel", 505 values->SetString("cloudPrintChromeosOptionLabel",
497 l10n_util::GetStringFUTF16( 506 l10n_util::GetStringFUTF16(
498 IDS_CLOUD_PRINT_CHROMEOS_OPTION_LABEL, 507 IDS_CLOUD_PRINT_CHROMEOS_OPTION_LABEL,
499 l10n_util::GetStringUTF16(IDS_GOOGLE_CLOUD_PRINT))); 508 l10n_util::GetStringUTF16(IDS_GOOGLE_CLOUD_PRINT)));
500 values->SetString("cloudPrintChromeosOptionButton", 509 values->SetString("cloudPrintChromeosOptionButton",
501 l10n_util::GetStringFUTF16( 510 l10n_util::GetStringFUTF16(
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after
594 base::Bind(&BrowserOptionsHandler::HighContrastChangeCallback, 603 base::Bind(&BrowserOptionsHandler::HighContrastChangeCallback,
595 base::Unretained(this))); 604 base::Unretained(this)));
596 web_ui()->RegisterMessageCallback( 605 web_ui()->RegisterMessageCallback(
597 "virtualKeyboardChange", 606 "virtualKeyboardChange",
598 base::Bind(&BrowserOptionsHandler::VirtualKeyboardChangeCallback, 607 base::Bind(&BrowserOptionsHandler::VirtualKeyboardChangeCallback,
599 base::Unretained(this))); 608 base::Unretained(this)));
600 web_ui()->RegisterMessageCallback( 609 web_ui()->RegisterMessageCallback(
601 "performFactoryResetRestart", 610 "performFactoryResetRestart",
602 base::Bind(&BrowserOptionsHandler::PerformFactoryResetRestart, 611 base::Bind(&BrowserOptionsHandler::PerformFactoryResetRestart,
603 base::Unretained(this))); 612 base::Unretained(this)));
613 #else
614 web_ui()->RegisterMessageCallback(
615 "restartBrowser",
616 base::Bind(&BrowserOptionsHandler::HandleRestartBrowser,
617 base::Unretained(this)));
604 #endif 618 #endif
605 } 619 }
606 620
607 void BrowserOptionsHandler::OnStateChanged() { 621 void BrowserOptionsHandler::OnStateChanged() {
608 web_ui()->CallJavascriptFunction("BrowserOptions.updateSyncState", 622 web_ui()->CallJavascriptFunction("BrowserOptions.updateSyncState",
609 *GetSyncStateDictionary()); 623 *GetSyncStateDictionary());
610 624
611 SendProfilesInfo(); 625 SendProfilesInfo();
612 } 626 }
613 627
(...skipping 611 matching lines...) Expand 10 before | Expand all | Expand 10 after
1225 } 1239 }
1226 1240
1227 void BrowserOptionsHandler::HandleDefaultZoomFactor(const ListValue* args) { 1241 void BrowserOptionsHandler::HandleDefaultZoomFactor(const ListValue* args) {
1228 double zoom_factor; 1242 double zoom_factor;
1229 if (ExtractDoubleValue(args, &zoom_factor)) { 1243 if (ExtractDoubleValue(args, &zoom_factor)) {
1230 default_zoom_level_.SetValue( 1244 default_zoom_level_.SetValue(
1231 WebKit::WebView::zoomFactorToZoomLevel(zoom_factor)); 1245 WebKit::WebView::zoomFactorToZoomLevel(zoom_factor));
1232 } 1246 }
1233 } 1247 }
1234 1248
1249 void BrowserOptionsHandler::HandleRestartBrowser(const ListValue* args) {
1250 chrome::AttemptRestart();
1251 }
1252
1235 #if !defined(OS_CHROMEOS) 1253 #if !defined(OS_CHROMEOS)
1236 void BrowserOptionsHandler::ShowNetworkProxySettings(const ListValue* args) { 1254 void BrowserOptionsHandler::ShowNetworkProxySettings(const ListValue* args) {
1237 content::RecordAction(UserMetricsAction("Options_ShowProxySettings")); 1255 content::RecordAction(UserMetricsAction("Options_ShowProxySettings"));
1238 AdvancedOptionsUtilities::ShowNetworkProxySettings( 1256 AdvancedOptionsUtilities::ShowNetworkProxySettings(
1239 web_ui()->GetWebContents()); 1257 web_ui()->GetWebContents());
1240 } 1258 }
1241 #endif 1259 #endif
1242 1260
1243 #if !defined(USE_NSS) && !defined(USE_OPENSSL) 1261 #if !defined(USE_NSS) && !defined(USE_OPENSSL)
1244 void BrowserOptionsHandler::ShowManageSSLCertificates(const ListValue* args) { 1262 void BrowserOptionsHandler::ShowManageSSLCertificates(const ListValue* args) {
(...skipping 235 matching lines...) Expand 10 before | Expand all | Expand 10 after
1480 base::FundamentalValue disabled(profile_pref_registrar_.IsManaged() || 1498 base::FundamentalValue disabled(profile_pref_registrar_.IsManaged() ||
1481 is_extension_controlled); 1499 is_extension_controlled);
1482 base::FundamentalValue extension_controlled(is_extension_controlled); 1500 base::FundamentalValue extension_controlled(is_extension_controlled);
1483 web_ui()->CallJavascriptFunction("BrowserOptions.setupProxySettingsSection", 1501 web_ui()->CallJavascriptFunction("BrowserOptions.setupProxySettingsSection",
1484 disabled, extension_controlled); 1502 disabled, extension_controlled);
1485 1503
1486 #endif // !defined(OS_CHROMEOS) 1504 #endif // !defined(OS_CHROMEOS)
1487 } 1505 }
1488 1506
1489 } // namespace options 1507 } // namespace options
OLDNEW
« no previous file with comments | « chrome/browser/ui/webui/options/browser_options_handler.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698