summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorzmo@chromium.org <zmo@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-03-22 23:48:53 +0000
committerzmo@chromium.org <zmo@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-03-22 23:48:53 +0000
commit5837679a4aef83ff76370cc2647966f06b235c27 (patch)
treef4b664cc8d7fbb405745689895c0a798775df13e
parent272c170b76f341a3338c8e82654e2ce24a7becb0 (diff)
downloadchromium_src-5837679a4aef83ff76370cc2647966f06b235c27.zip
chromium_src-5837679a4aef83ff76370cc2647966f06b235c27.tar.gz
chromium_src-5837679a4aef83ff76370cc2647966f06b235c27.tar.bz2
Get the init gpu mode from when chrome starts instead of when settings page starts
If we open settings page, change gpu mode, open a new tab, close the original setting page. Now on the new tab, go to settings page. Without this CL: it didn't show the restart link (which is wrong) With this CL: it shows. BUG=173130 TEST=settings page (as described above) Review URL: https://codereview.chromium.org/12438035 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@189949 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r--chrome/browser/gpu/gpu_mode_manager.cc11
-rw-r--r--chrome/browser/gpu/gpu_mode_manager.h6
-rw-r--r--chrome/browser/ui/webui/options/browser_options_handler.cc5
3 files changed, 17 insertions, 5 deletions
diff --git a/chrome/browser/gpu/gpu_mode_manager.cc b/chrome/browser/gpu/gpu_mode_manager.cc
index 38ec835..f56cb76 100644
--- a/chrome/browser/gpu/gpu_mode_manager.cc
+++ b/chrome/browser/gpu/gpu_mode_manager.cc
@@ -17,7 +17,8 @@ void GpuModeManager::RegisterPrefs(PrefRegistrySimple* registry) {
prefs::kHardwareAccelerationModeEnabled, true);
}
-GpuModeManager::GpuModeManager() {
+GpuModeManager::GpuModeManager()
+ : initial_gpu_mode_pref_(true) {
if (g_browser_process->local_state()) { // Skip for unit tests
pref_registrar_.Init(g_browser_process->local_state());
// Do nothing when the pref changes. It takes effect after
@@ -26,7 +27,9 @@ GpuModeManager::GpuModeManager() {
prefs::kHardwareAccelerationModeEnabled,
base::Bind(&base::DoNothing));
- if (!IsGpuModePrefEnabled()) {
+ initial_gpu_mode_pref_ = IsGpuModePrefEnabled();
+
+ if (!initial_gpu_mode_pref_) {
content::GpuDataManager* gpu_data_manager =
content::GpuDataManager::GetInstance();
DCHECK(gpu_data_manager);
@@ -38,6 +41,10 @@ GpuModeManager::GpuModeManager() {
GpuModeManager::~GpuModeManager() {
}
+bool GpuModeManager::initial_gpu_mode_pref() const {
+ return initial_gpu_mode_pref_;
+}
+
// static
bool GpuModeManager::IsGpuModePrefEnabled() {
PrefService* service = g_browser_process->local_state();
diff --git a/chrome/browser/gpu/gpu_mode_manager.h b/chrome/browser/gpu/gpu_mode_manager.h
index 872c6fd..8dd605b 100644
--- a/chrome/browser/gpu/gpu_mode_manager.h
+++ b/chrome/browser/gpu/gpu_mode_manager.h
@@ -16,11 +16,15 @@ class GpuModeManager {
GpuModeManager();
~GpuModeManager();
- static bool IsGpuModePrefEnabled();
+ bool initial_gpu_mode_pref() const;
private:
+ static bool IsGpuModePrefEnabled();
+
PrefChangeRegistrar pref_registrar_;
+ bool initial_gpu_mode_pref_;
+
DISALLOW_COPY_AND_ASSIGN(GpuModeManager);
};
diff --git a/chrome/browser/ui/webui/options/browser_options_handler.cc b/chrome/browser/ui/webui/options/browser_options_handler.cc
index 4757370..8c17095 100644
--- a/chrome/browser/ui/webui/options/browser_options_handler.cc
+++ b/chrome/browser/ui/webui/options/browser_options_handler.cc
@@ -495,8 +495,9 @@ void BrowserOptionsHandler::GetLocalizedValues(DictionaryValue* values) {
#endif
#if !defined(OS_CHROMEOS)
- values->SetBoolean("gpuEnabledAtStart",
- GpuModeManager::IsGpuModePrefEnabled());
+ values->SetBoolean(
+ "gpuEnabledAtStart",
+ g_browser_process->gpu_mode_manager()->initial_gpu_mode_pref());
#endif
}