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

Side by Side Diff: ui/gfx/font_smoothing_win.cc

Issue 23769011: Move a bunch of windows stuff from ui/base/win to ui/gfx/win (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Moar bustage. Created 7 years, 3 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 | « ui/gfx/dpi_win.cc ('k') | ui/gfx/platform_font_win.cc » ('j') | 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 "ui/gfx/font_smoothing_win.h" 5 #include "ui/gfx/font_smoothing_win.h"
6 6
7 #include "base/memory/singleton.h" 7 #include "base/memory/singleton.h"
8 #include "ui/base/win/singleton_hwnd.h" 8 #include "ui/gfx/win/singleton_hwnd.h"
9 9
10 namespace { 10 namespace {
11 11
12 // Helper class to cache font smoothing settings and listen for notifications 12 // Helper class to cache font smoothing settings and listen for notifications
13 // to re-query them from the system. 13 // to re-query them from the system.
14 class CachedFontSmoothingSettings : public ui::SingletonHwnd::Observer { 14 class CachedFontSmoothingSettings : public gfx::SingletonHwnd::Observer {
15 public: 15 public:
16 static CachedFontSmoothingSettings* GetInstance(); 16 static CachedFontSmoothingSettings* GetInstance();
17 17
18 // Returns the cached Windows font smoothing settings. Queries the settings 18 // Returns the cached Windows font smoothing settings. Queries the settings
19 // via Windows APIs and begins listening for changes when called for the 19 // via Windows APIs and begins listening for changes when called for the
20 // first time. 20 // first time.
21 void GetFontSmoothingSettings(bool* smoothing_enabled, 21 void GetFontSmoothingSettings(bool* smoothing_enabled,
22 bool* cleartype_enabled); 22 bool* cleartype_enabled);
23 23
24 private: 24 private:
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
59 59
60 void CachedFontSmoothingSettings::GetFontSmoothingSettings( 60 void CachedFontSmoothingSettings::GetFontSmoothingSettings(
61 bool* smoothing_enabled, 61 bool* smoothing_enabled,
62 bool* cleartype_enabled) { 62 bool* cleartype_enabled) {
63 // If cached settings are stale, query them from the OS. 63 // If cached settings are stale, query them from the OS.
64 if (need_to_query_settings_) { 64 if (need_to_query_settings_) {
65 QueryFontSettings(); 65 QueryFontSettings();
66 need_to_query_settings_ = false; 66 need_to_query_settings_ = false;
67 } 67 }
68 if (!observer_added_) { 68 if (!observer_added_) {
69 ui::SingletonHwnd::GetInstance()->AddObserver(this); 69 gfx::SingletonHwnd::GetInstance()->AddObserver(this);
70 observer_added_ = true; 70 observer_added_ = true;
71 } 71 }
72 *smoothing_enabled = smoothing_enabled_; 72 *smoothing_enabled = smoothing_enabled_;
73 *cleartype_enabled = cleartype_enabled_; 73 *cleartype_enabled = cleartype_enabled_;
74 } 74 }
75 75
76 CachedFontSmoothingSettings::CachedFontSmoothingSettings() 76 CachedFontSmoothingSettings::CachedFontSmoothingSettings()
77 : observer_added_(false), 77 : observer_added_(false),
78 need_to_query_settings_(true), 78 need_to_query_settings_(true),
79 smoothing_enabled_(false), 79 smoothing_enabled_(false),
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
112 namespace gfx { 112 namespace gfx {
113 113
114 void GetCachedFontSmoothingSettings(bool* smoothing_enabled, 114 void GetCachedFontSmoothingSettings(bool* smoothing_enabled,
115 bool* cleartype_enabled) { 115 bool* cleartype_enabled) {
116 CachedFontSmoothingSettings::GetInstance()->GetFontSmoothingSettings( 116 CachedFontSmoothingSettings::GetInstance()->GetFontSmoothingSettings(
117 smoothing_enabled, 117 smoothing_enabled,
118 cleartype_enabled); 118 cleartype_enabled);
119 } 119 }
120 120
121 } // namespace gfx 121 } // namespace gfx
OLDNEW
« no previous file with comments | « ui/gfx/dpi_win.cc ('k') | ui/gfx/platform_font_win.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698