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

Unified Diff: chrome/browser/ui/webui/settings/system_handler.cc

Issue 1814703004: MD Settings: implement "RESTART" button for hardware acceleration to take effect (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: nit Created 4 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/browser/ui/webui/settings/system_handler.h ('k') | chrome/chrome_browser_ui.gypi » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/ui/webui/settings/system_handler.cc
diff --git a/chrome/browser/ui/webui/settings/system_handler.cc b/chrome/browser/ui/webui/settings/system_handler.cc
index 49835c5dc4da15111ff55db243a816f09cbcd219..bbfedae9735e9a5ef39e3a42fa340f506c777b92 100644
--- a/chrome/browser/ui/webui/settings/system_handler.cc
+++ b/chrome/browser/ui/webui/settings/system_handler.cc
@@ -4,14 +4,24 @@
#include "chrome/browser/ui/webui/settings/system_handler.h"
+#if defined(OS_WIN)
+#include <windows.h>
+#endif
+
#include "base/bind.h"
#include "base/bind_helpers.h"
#include "base/metrics/user_metrics.h"
#include "base/metrics/user_metrics_action.h"
+#include "chrome/browser/browser_process.h"
+#include "chrome/browser/gpu/gpu_mode_manager.h"
+#include "chrome/browser/lifetime/application_lifetime.h"
+#include "chrome/browser/ui/webui/settings_utils.h"
#include "content/public/browser/web_ui.h"
+#include "content/public/browser/web_ui_data_source.h"
-#if !defined(OS_CHROMEOS)
-#include "chrome/browser/ui/webui/settings_utils.h"
+#if defined(OS_WIN)
+#include "chrome/browser/metrics/chrome_metrics_service_accessor.h"
+#include "chrome/common/chrome_constants.h"
#endif
namespace settings {
@@ -20,19 +30,45 @@ SystemHandler::SystemHandler() {}
SystemHandler::~SystemHandler() {}
+// static
+void SystemHandler::AddLoadTimeData(content::WebUIDataSource* data_source) {
+ data_source->AddBoolean("hardwareAccelerationEnabledAtStartup",
+ g_browser_process->gpu_mode_manager()->initial_gpu_mode_pref());
+}
+
void SystemHandler::RegisterMessages() {
web_ui()->RegisterMessageCallback("changeProxySettings",
base::Bind(&SystemHandler::HandleChangeProxySettings,
base::Unretained(this)));
+ web_ui()->RegisterMessageCallback("restartBrowser",
+ base::Bind(&SystemHandler::HandleRestartBrowser,
+ base::Unretained(this)));
}
void SystemHandler::HandleChangeProxySettings(const base::ListValue* /*args*/) {
base::RecordAction(base::UserMetricsAction("Options_ShowProxySettings"));
-#if defined(OS_CHROMEOS)
- NOTREACHED();
-#else
settings_utils::ShowNetworkProxySettings(web_ui()->GetWebContents());
+}
+
+void SystemHandler::HandleRestartBrowser(const base::ListValue* /*args*/) {
+#if defined(OS_WIN)
+ // On Windows Breakpad will upload crash reports if the breakpad pipe name
+ // environment variable is defined. So we undefine this environment variable
+ // before restarting, as the restarted processes will inherit their
+ // environment variables from ours, thus suppressing crash uploads.
+ if (!ChromeMetricsServiceAccessor::IsMetricsAndCrashReportingEnabled()) {
+ HMODULE exe_module = GetModuleHandle(chrome::kBrowserProcessExecutableName);
+ if (exe_module) {
+ typedef void (__cdecl *ClearBreakpadPipeEnvVar)();
+ ClearBreakpadPipeEnvVar clear = reinterpret_cast<ClearBreakpadPipeEnvVar>(
+ GetProcAddress(exe_module, "ClearBreakpadPipeEnvironmentVariable"));
+ if (clear)
+ clear();
+ }
+ }
#endif
+
+ chrome::AttemptRestart();
}
} // namespace settings
« no previous file with comments | « chrome/browser/ui/webui/settings/system_handler.h ('k') | chrome/chrome_browser_ui.gypi » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698