Index: ui/gfx/font_render_params_win.cc |
diff --git a/ui/gfx/font_render_params_win.cc b/ui/gfx/font_render_params_win.cc |
index 5709feab4c939eaae776aca1880c9e91fef77375..7c9c7d9c17f3f6f33a84f487041fc5abde2eaf62 100644 |
--- a/ui/gfx/font_render_params_win.cc |
+++ b/ui/gfx/font_render_params_win.cc |
@@ -2,6 +2,8 @@ |
// Use of this source code is governed by a BSD-style license that can be |
// found in the LICENSE file. |
+#include "base/bind.h" |
+#include "base/bind_helpers.h" |
#include "base/files/file_path.h" |
#include "base/memory/scoped_ptr.h" |
#include "base/memory/singleton.h" |
@@ -42,7 +44,7 @@ FontRenderParams::SubpixelRendering GetSubpixelRenderingGeometry() { |
} |
// Caches font render params and updates them on system notifications. |
-class CachedFontRenderParams : public gfx::SingletonHwnd::Observer { |
+class CachedFontRenderParams { |
public: |
static CachedFontRenderParams* GetInstance() { |
return Singleton<CachedFontRenderParams>::get(); |
@@ -72,7 +74,9 @@ class CachedFontRenderParams : public gfx::SingletonHwnd::Observer { |
params_->subpixel_rendering = GetSubpixelRenderingGeometry(); |
} |
} |
- gfx::SingletonHwnd::GetInstance()->AddObserver(this); |
+ singletonHwndObserver_.SetWndProc( |
+ base::Bind(&CachedFontRenderParams::OnSettingsChange, |
+ base::Unretained(this))); |
return *params_; |
} |
@@ -85,17 +89,15 @@ class CachedFontRenderParams : public gfx::SingletonHwnd::Observer { |
// been destroyed already (both singletons). |
} |
- void OnWndProc(HWND hwnd, |
- UINT message, |
- WPARAM wparam, |
- LPARAM lparam) override { |
+ void OnSettingsChange(HWND hwnd, UINT message, WPARAM wparam, LPARAM lparam) { |
if (message == WM_SETTINGCHANGE) { |
params_.reset(); |
- gfx::SingletonHwnd::GetInstance()->RemoveObserver(this); |
+ singletonHwndObserver_.ClearWndProc(); |
} |
} |
scoped_ptr<FontRenderParams> params_; |
+ SingletonHwnd::Observer singletonHwndObserver_; |
DISALLOW_COPY_AND_ASSIGN(CachedFontRenderParams); |
}; |