diff options
author | rogerta@chromium.org <rogerta@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-03-30 19:02:16 +0000 |
---|---|---|
committer | rogerta@chromium.org <rogerta@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-03-30 19:02:16 +0000 |
commit | c6d9422188208e9034891c3cb46d37171e33208c (patch) | |
tree | 82dd7b79d7b1ff2b67f7bf55eedc360e87084a37 | |
parent | b00bbb39365d95b4e8d95302d1e18507997fd1ec (diff) | |
download | chromium_src-c6d9422188208e9034891c3cb46d37171e33208c.zip chromium_src-c6d9422188208e9034891c3cb46d37171e33208c.tar.gz chromium_src-c6d9422188208e9034891c3cb46d37171e33208c.tar.bz2 |
In preparation for NativeTheme refactoring, renaming the class NativeTheme
to NativeThemeWin, since it is windows specific anyway.
BUG=None
TEST=None
R=xiyuan@chromium.org
Review URL: http://codereview.chromium.org/6778009
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@79874 0039d316-1c4b-4281-b951-d872f2087c98
20 files changed, 209 insertions, 211 deletions
diff --git a/chrome/browser/ui/views/list_background.h b/chrome/browser/ui/views/list_background.h index 233910d..00de477 100644 --- a/chrome/browser/ui/views/list_background.h +++ b/chrome/browser/ui/views/list_background.h @@ -16,8 +16,8 @@ class ListBackground : public views::Background { public: explicit ListBackground() { SkColor list_color = - gfx::NativeTheme::instance()->GetThemeColorWithDefault( - gfx::NativeTheme::LIST, 1, TS_NORMAL, TMT_FILLCOLOR, COLOR_WINDOW); + gfx::NativeThemeWin::instance()->GetThemeColorWithDefault( + gfx::NativeThemeWin::LIST, 1, TS_NORMAL, TMT_FILLCOLOR, COLOR_WINDOW); SetNativeControlColor(list_color); } virtual ~ListBackground() {} @@ -25,7 +25,7 @@ class ListBackground : public views::Background { virtual void Paint(gfx::Canvas* canvas, views::View* view) const { HDC dc = canvas->BeginPlatformPaint(); RECT native_lb = view->GetLocalBounds().ToRECT(); - gfx::NativeTheme::instance()->PaintListBackground(dc, true, &native_lb); + gfx::NativeThemeWin::instance()->PaintListBackground(dc, true, &native_lb); canvas->EndPlatformPaint(); } diff --git a/chrome/renderer/renderer_main_platform_delegate_win.cc b/chrome/renderer/renderer_main_platform_delegate_win.cc index 1ad0b1c..ba104f9 100644 --- a/chrome/renderer/renderer_main_platform_delegate_win.cc +++ b/chrome/renderer/renderer_main_platform_delegate_win.cc @@ -11,7 +11,6 @@ #include "chrome/common/chrome_switches.h" #include "content/common/injection_test_dll.h" #include "sandbox/src/sandbox.h" -#include "ui/gfx/native_theme_win.h" #include "unicode/timezone.h" namespace { diff --git a/content/renderer/render_view.cc b/content/renderer/render_view.cc index 8480857..86733e4 100644 --- a/content/renderer/render_view.cc +++ b/content/renderer/render_view.cc @@ -4596,7 +4596,7 @@ void RenderView::OnClosePage(const ViewMsg_ClosePage_Params& params) { void RenderView::OnThemeChanged() { #if defined(OS_WIN) - gfx::NativeTheme::instance()->CloseHandles(); + gfx::NativeThemeWin::instance()->CloseHandles(); if (webview()) webview()->themeChanged(); #else // defined(OS_WIN) diff --git a/ui/gfx/canvas_direct2d_unittest.cc b/ui/gfx/canvas_direct2d_unittest.cc index 3f645b1..9a81f92 100644 --- a/ui/gfx/canvas_direct2d_unittest.cc +++ b/ui/gfx/canvas_direct2d_unittest.cc @@ -225,7 +225,7 @@ TEST(CanvasDirect2D, PlatformPainting) { // Use the system theme engine to draw a native button. This only works on a // GDI device context. RECT r = { 20, 20, 220, 80 }; - gfx::NativeTheme::instance()->PaintButton( + gfx::NativeThemeWin::instance()->PaintButton( dc, BP_PUSHBUTTON, PBS_NORMAL, DFCS_BUTTONPUSH, &r); canvas.EndPlatformPaint(); diff --git a/ui/gfx/native_theme_win.cc b/ui/gfx/native_theme_win.cc index 73f963a..b22973c 100644 --- a/ui/gfx/native_theme_win.cc +++ b/ui/gfx/native_theme_win.cc @@ -55,13 +55,13 @@ void SetCheckerboardShader(SkPaint* paint, const RECT& align_rect) { namespace gfx { /* static */ -const NativeTheme* NativeTheme::instance() { - // The global NativeTheme instance. - static const NativeTheme s_native_theme; +const NativeThemeWin* NativeThemeWin::instance() { + // The global NativeThemeWin instance. + static const NativeThemeWin s_native_theme; return &s_native_theme; } -NativeTheme::NativeTheme() +NativeThemeWin::NativeThemeWin() : theme_dll_(LoadLibrary(L"uxtheme.dll")), draw_theme_(NULL), draw_theme_ex_(NULL), @@ -98,7 +98,7 @@ NativeTheme::NativeTheme() memset(theme_handles_, 0, sizeof(theme_handles_)); } -NativeTheme::~NativeTheme() { +NativeThemeWin::~NativeThemeWin() { if (theme_dll_) { // todo (cpu): fix this soon. // CloseHandles(); @@ -106,11 +106,11 @@ NativeTheme::~NativeTheme() { } } -HRESULT NativeTheme::PaintButton(HDC hdc, - int part_id, - int state_id, - int classic_state, - RECT* rect) const { +HRESULT NativeThemeWin::PaintButton(HDC hdc, + int part_id, + int state_id, + int classic_state, + RECT* rect) const { HANDLE handle = GetThemeHandle(BUTTON); if (handle && draw_theme_) return draw_theme_(handle, hdc, part_id, state_id, rect, NULL); @@ -147,8 +147,8 @@ HRESULT NativeTheme::PaintButton(HDC hdc, return S_OK; } -HRESULT NativeTheme::PaintDialogBackground(HDC hdc, bool active, - RECT* rect) const { +HRESULT NativeThemeWin::PaintDialogBackground(HDC hdc, bool active, + RECT* rect) const { HANDLE handle = GetThemeHandle(WINDOW); if (handle && draw_theme_) { return draw_theme_(handle, hdc, WP_DIALOG, @@ -160,9 +160,9 @@ HRESULT NativeTheme::PaintDialogBackground(HDC hdc, bool active, return S_OK; } -HRESULT NativeTheme::PaintListBackground(HDC hdc, - bool enabled, - RECT* rect) const { +HRESULT NativeThemeWin::PaintListBackground(HDC hdc, + bool enabled, + RECT* rect) const { HANDLE handle = GetThemeHandle(LIST); if (handle && draw_theme_) return draw_theme_(handle, hdc, 1, TS_NORMAL, rect, NULL); @@ -174,13 +174,13 @@ HRESULT NativeTheme::PaintListBackground(HDC hdc, return S_OK; } -HRESULT NativeTheme::PaintMenuArrow(ThemeName theme, - HDC hdc, - int part_id, - int state_id, - RECT* rect, - MenuArrowDirection arrow_direction, - ControlState control_state) const { +HRESULT NativeThemeWin::PaintMenuArrow(ThemeName theme, + HDC hdc, + int part_id, + int state_id, + RECT* rect, + MenuArrowDirection arrow_direction, + ControlState control_state) const { HANDLE handle = GetThemeHandle(MENU); if (handle && draw_theme_) { if (arrow_direction == RIGHT_POINTING_ARROW) { @@ -222,11 +222,11 @@ HRESULT NativeTheme::PaintMenuArrow(ThemeName theme, return PaintFrameControl(hdc, rect, DFC_MENU, state, control_state); } -HRESULT NativeTheme::PaintMenuBackground(ThemeName theme, - HDC hdc, - int part_id, - int state_id, - RECT* rect) const { +HRESULT NativeThemeWin::PaintMenuBackground(ThemeName theme, + HDC hdc, + int part_id, + int state_id, + RECT* rect) const { HANDLE handle = GetThemeHandle(MENU); if (handle && draw_theme_) { HRESULT result = draw_theme_(handle, hdc, part_id, state_id, rect, NULL); @@ -239,11 +239,11 @@ HRESULT NativeTheme::PaintMenuBackground(ThemeName theme, return S_OK; } -HRESULT NativeTheme::PaintMenuCheckBackground(ThemeName theme, - HDC hdc, - int part_id, - int state_id, - RECT* rect) const { +HRESULT NativeThemeWin::PaintMenuCheckBackground(ThemeName theme, + HDC hdc, + int part_id, + int state_id, + RECT* rect) const { HANDLE handle = GetThemeHandle(MENU); if (handle && draw_theme_) return draw_theme_(handle, hdc, part_id, state_id, rect, NULL); @@ -251,12 +251,12 @@ HRESULT NativeTheme::PaintMenuCheckBackground(ThemeName theme, return S_OK; } -HRESULT NativeTheme::PaintMenuCheck(ThemeName theme, - HDC hdc, - int part_id, - int state_id, - RECT* rect, - ControlState control_state) const { +HRESULT NativeThemeWin::PaintMenuCheck(ThemeName theme, + HDC hdc, + int part_id, + int state_id, + RECT* rect, + ControlState control_state) const { HANDLE handle = GetThemeHandle(MENU); if (handle && draw_theme_) { return draw_theme_(handle, hdc, part_id, state_id, rect, NULL); @@ -264,22 +264,22 @@ HRESULT NativeTheme::PaintMenuCheck(ThemeName theme, return PaintFrameControl(hdc, rect, DFC_MENU, DFCS_MENUCHECK, control_state); } -HRESULT NativeTheme::PaintMenuGutter(HDC hdc, - int part_id, - int state_id, - RECT* rect) const { +HRESULT NativeThemeWin::PaintMenuGutter(HDC hdc, + int part_id, + int state_id, + RECT* rect) const { HANDLE handle = GetThemeHandle(MENU); if (handle && draw_theme_) return draw_theme_(handle, hdc, part_id, state_id, rect, NULL); return E_NOTIMPL; } -HRESULT NativeTheme::PaintMenuItemBackground(ThemeName theme, - HDC hdc, - int part_id, - int state_id, - bool selected, - RECT* rect) const { +HRESULT NativeThemeWin::PaintMenuItemBackground(ThemeName theme, + HDC hdc, + int part_id, + int state_id, + bool selected, + RECT* rect) const { HANDLE handle = GetThemeHandle(MENU); if (handle && draw_theme_) return draw_theme_(handle, hdc, part_id, state_id, rect, NULL); @@ -288,11 +288,11 @@ HRESULT NativeTheme::PaintMenuItemBackground(ThemeName theme, return S_OK; } -HRESULT NativeTheme::PaintMenuList(HDC hdc, - int part_id, - int state_id, - int classic_state, - RECT* rect) const { +HRESULT NativeThemeWin::PaintMenuList(HDC hdc, + int part_id, + int state_id, + int classic_state, + RECT* rect) const { HANDLE handle = GetThemeHandle(MENULIST); if (handle && draw_theme_) return draw_theme_(handle, hdc, part_id, state_id, rect, NULL); @@ -302,10 +302,10 @@ HRESULT NativeTheme::PaintMenuList(HDC hdc, return S_OK; } -HRESULT NativeTheme::PaintMenuSeparator(HDC hdc, - int part_id, - int state_id, - RECT* rect) const { +HRESULT NativeThemeWin::PaintMenuSeparator(HDC hdc, + int part_id, + int state_id, + RECT* rect) const { HANDLE handle = GetThemeHandle(MENU); if (handle && draw_theme_) return draw_theme_(handle, hdc, part_id, state_id, rect, NULL); @@ -313,10 +313,10 @@ HRESULT NativeTheme::PaintMenuSeparator(HDC hdc, return S_OK; } -HRESULT NativeTheme::PaintScrollbarArrow(HDC hdc, - int state_id, - int classic_state, - RECT* rect) const { +HRESULT NativeThemeWin::PaintScrollbarArrow(HDC hdc, + int state_id, + int classic_state, + RECT* rect) const { HANDLE handle = GetThemeHandle(SCROLLBAR); if (handle && draw_theme_) return draw_theme_(handle, hdc, SBP_ARROWBTN, state_id, rect, NULL); @@ -326,7 +326,7 @@ HRESULT NativeTheme::PaintScrollbarArrow(HDC hdc, return S_OK; } -HRESULT NativeTheme::PaintScrollbarTrack( +HRESULT NativeThemeWin::PaintScrollbarTrack( HDC hdc, int part_id, int state_id, @@ -354,11 +354,11 @@ HRESULT NativeTheme::PaintScrollbarTrack( return S_OK; } -HRESULT NativeTheme::PaintScrollbarThumb(HDC hdc, - int part_id, - int state_id, - int classic_state, - RECT* rect) const { +HRESULT NativeThemeWin::PaintScrollbarThumb(HDC hdc, + int part_id, + int state_id, + int classic_state, + RECT* rect) const { HANDLE handle = GetThemeHandle(SCROLLBAR); if (handle && draw_theme_) return draw_theme_(handle, hdc, part_id, state_id, rect, NULL); @@ -370,11 +370,11 @@ HRESULT NativeTheme::PaintScrollbarThumb(HDC hdc, return S_OK; } -HRESULT NativeTheme::PaintSpinButton(HDC hdc, - int part_id, - int state_id, - int classic_state, - RECT* rect) const { +HRESULT NativeThemeWin::PaintSpinButton(HDC hdc, + int part_id, + int state_id, + int classic_state, + RECT* rect) const { HANDLE handle = GetThemeHandle(SPIN); if (handle && draw_theme_) return draw_theme_(handle, hdc, part_id, state_id, rect, NULL); @@ -382,11 +382,11 @@ HRESULT NativeTheme::PaintSpinButton(HDC hdc, return S_OK; } -HRESULT NativeTheme::PaintStatusGripper(HDC hdc, - int part_id, - int state_id, - int classic_state, - RECT* rect) const { +HRESULT NativeThemeWin::PaintStatusGripper(HDC hdc, + int part_id, + int state_id, + int classic_state, + RECT* rect) const { HANDLE handle = GetThemeHandle(STATUS); if (handle && draw_theme_) { // Paint the status bar gripper. There doesn't seem to be a @@ -401,7 +401,7 @@ HRESULT NativeTheme::PaintStatusGripper(HDC hdc, return S_OK; } -HRESULT NativeTheme::PaintTabPanelBackground(HDC hdc, RECT* rect) const { +HRESULT NativeThemeWin::PaintTabPanelBackground(HDC hdc, RECT* rect) const { HANDLE handle = GetThemeHandle(TAB); if (handle && draw_theme_) return draw_theme_(handle, hdc, TABP_BODY, 0, rect, NULL); @@ -411,12 +411,12 @@ HRESULT NativeTheme::PaintTabPanelBackground(HDC hdc, RECT* rect) const { return S_OK; } -HRESULT NativeTheme::PaintTrackbar(HDC hdc, - int part_id, - int state_id, - int classic_state, - RECT* rect, - skia::PlatformCanvas* canvas) const { +HRESULT NativeThemeWin::PaintTrackbar(HDC hdc, + int part_id, + int state_id, + int classic_state, + RECT* rect, + skia::PlatformCanvas* canvas) const { // Make the channel be 4 px thick in the center of the supplied rect. (4 px // matches what XP does in various menus; GetThemePartSize() doesn't seem to // return good values here.) @@ -520,12 +520,12 @@ static RECT InsetRect(const RECT* rect, int size) { return result.ToRECT(); } -HRESULT NativeTheme::PaintProgressBar(HDC hdc, - RECT* bar_rect, - RECT* value_rect, - bool determinate, - double animated_seconds, - skia::PlatformCanvas* canvas) const { +HRESULT NativeThemeWin::PaintProgressBar(HDC hdc, + RECT* bar_rect, + RECT* value_rect, + bool determinate, + double animated_seconds, + skia::PlatformCanvas* canvas) const { // There is no documentation about the animation speed, frame-rate, nor // size of moving overlay of the indeterminate progress bar. // So we just observed real-world programs and guessed following parameters. @@ -613,14 +613,14 @@ HRESULT NativeTheme::PaintProgressBar(HDC hdc, return S_OK; } -HRESULT NativeTheme::PaintTextField(HDC hdc, - int part_id, - int state_id, - int classic_state, - RECT* rect, - COLORREF color, - bool fill_content_area, - bool draw_edges) const { +HRESULT NativeThemeWin::PaintTextField(HDC hdc, + int part_id, + int state_id, + int classic_state, + RECT* rect, + COLORREF color, + bool fill_content_area, + bool draw_edges) const { // TODO(ojan): http://b/1210017 Figure out how to give the ability to // exclude individual edges from being drawn. @@ -667,19 +667,19 @@ HRESULT NativeTheme::PaintTextField(HDC hdc, return hr; } -bool NativeTheme::IsThemingActive() const { +bool NativeThemeWin::IsThemingActive() const { if (is_theme_active_) return !!is_theme_active_(); return false; } -HRESULT NativeTheme::GetThemePartSize(ThemeName theme_name, - HDC hdc, - int part_id, - int state_id, - RECT* rect, - int ts, - SIZE* size) const { +HRESULT NativeThemeWin::GetThemePartSize(ThemeName theme_name, + HDC hdc, + int part_id, + int state_id, + RECT* rect, + int ts, + SIZE* size) const { HANDLE handle = GetThemeHandle(theme_name); if (handle && get_theme_part_size_) return get_theme_part_size_(handle, hdc, part_id, state_id, rect, ts, size); @@ -687,11 +687,11 @@ HRESULT NativeTheme::GetThemePartSize(ThemeName theme_name, return E_NOTIMPL; } -HRESULT NativeTheme::GetThemeColor(ThemeName theme, - int part_id, - int state_id, - int prop_id, - SkColor* color) const { +HRESULT NativeThemeWin::GetThemeColor(ThemeName theme, + int part_id, + int state_id, + int prop_id, + SkColor* color) const { HANDLE handle = GetThemeHandle(theme); if (handle && get_theme_color_) { COLORREF color_ref; @@ -704,29 +704,29 @@ HRESULT NativeTheme::GetThemeColor(ThemeName theme, return E_NOTIMPL; } -SkColor NativeTheme::GetThemeColorWithDefault(ThemeName theme, - int part_id, - int state_id, - int prop_id, - int default_sys_color) const { +SkColor NativeThemeWin::GetThemeColorWithDefault(ThemeName theme, + int part_id, + int state_id, + int prop_id, + int default_sys_color) const { SkColor color; if (GetThemeColor(theme, part_id, state_id, prop_id, &color) != S_OK) color = skia::COLORREFToSkColor(GetSysColor(default_sys_color)); return color; } -HRESULT NativeTheme::GetThemeInt(ThemeName theme, - int part_id, - int state_id, - int prop_id, - int *value) const { +HRESULT NativeThemeWin::GetThemeInt(ThemeName theme, + int part_id, + int state_id, + int prop_id, + int *value) const { HANDLE handle = GetThemeHandle(theme); if (handle && get_theme_int_) return get_theme_int_(handle, part_id, state_id, prop_id, value); return E_NOTIMPL; } -Size NativeTheme::GetThemeBorderSize(ThemeName theme) const { +Size NativeThemeWin::GetThemeBorderSize(ThemeName theme) const { // For simplicity use the wildcard state==0, part==0, since it works // for the cases we currently depend on. int border; @@ -737,17 +737,17 @@ Size NativeTheme::GetThemeBorderSize(ThemeName theme) const { } -void NativeTheme::DisableTheming() const { +void NativeThemeWin::DisableTheming() const { if (!set_theme_properties_) return; set_theme_properties_(0); } -HRESULT NativeTheme::PaintFrameControl(HDC hdc, - RECT* rect, - UINT type, - UINT state, - ControlState control_state) const { +HRESULT NativeThemeWin::PaintFrameControl(HDC hdc, + RECT* rect, + UINT type, + UINT state, + ControlState control_state) const { const int width = rect->right - rect->left; const int height = rect->bottom - rect->top; @@ -798,7 +798,7 @@ HRESULT NativeTheme::PaintFrameControl(HDC hdc, return S_OK; } -void NativeTheme::CloseHandles() const +void NativeThemeWin::CloseHandles() const { if (!close_theme_) return; @@ -810,14 +810,14 @@ void NativeTheme::CloseHandles() const } } -bool NativeTheme::IsClassicTheme(ThemeName name) const { +bool NativeThemeWin::IsClassicTheme(ThemeName name) const { if (!theme_dll_) return true; return !GetThemeHandle(name); } -HANDLE NativeTheme::GetThemeHandle(ThemeName theme_name) const +HANDLE NativeThemeWin::GetThemeHandle(ThemeName theme_name) const { if (!open_theme_ || theme_name < 0 || theme_name >= LAST) return 0; diff --git a/ui/gfx/native_theme_win.h b/ui/gfx/native_theme_win.h index 1f99038..e1749c0 100644 --- a/ui/gfx/native_theme_win.h +++ b/ui/gfx/native_theme_win.h @@ -4,7 +4,7 @@ // // A wrapper class for working with custom XP/Vista themes provided in // uxtheme.dll. This is a singleton class that can be grabbed using -// NativeTheme::instance(). +// NativeThemeWin::instance(). // For more information on visual style parts and states, see: // http://msdn.microsoft.com/library/default.asp?url=/library/en-us/shellcc/platform/commctls/userex/topics/partsandstates.asp @@ -31,7 +31,7 @@ namespace gfx { // simplify usage. // TODO: This class should probably be changed to be platform independent at // the same time. -class NativeTheme { +class NativeThemeWin { public: enum ThemeName { BUTTON, @@ -280,11 +280,11 @@ class NativeTheme { bool IsClassicTheme(ThemeName name) const; // Gets our singleton instance. - static const NativeTheme* instance(); + static const NativeThemeWin* instance(); private: - NativeTheme(); - ~NativeTheme(); + NativeThemeWin(); + ~NativeThemeWin(); HRESULT PaintFrameControl(HDC hdc, RECT* rect, @@ -313,7 +313,7 @@ class NativeTheme { // A cache of open theme handles. mutable HANDLE theme_handles_[LAST]; - DISALLOW_COPY_AND_ASSIGN(NativeTheme); + DISALLOW_COPY_AND_ASSIGN(NativeThemeWin); }; } // namespace gfx diff --git a/ui/gfx/native_theme_win_unittest.cc b/ui/gfx/native_theme_win_unittest.cc index 27820ab..cce3861 100644 --- a/ui/gfx/native_theme_win_unittest.cc +++ b/ui/gfx/native_theme_win_unittest.cc @@ -7,5 +7,5 @@ #include "testing/gtest/include/gtest/gtest.h" TEST(NativeThemeTest, Init) { - ASSERT_TRUE(gfx::NativeTheme::instance() != NULL); + ASSERT_TRUE(gfx::NativeThemeWin::instance() != NULL); } diff --git a/views/controls/combobox/native_combobox_win.cc b/views/controls/combobox/native_combobox_win.cc index ebb91b5..7190440 100644 --- a/views/controls/combobox/native_combobox_win.cc +++ b/views/controls/combobox/native_combobox_win.cc @@ -107,8 +107,8 @@ gfx::Size NativeComboboxWin::GetPreferredSize() { GetComboBoxInfo(native_view(), &cbi); gfx::Rect rect_item(cbi.rcItem); gfx::Rect rect_button(cbi.rcButton); - gfx::Size border = gfx::NativeTheme::instance()->GetThemeBorderSize( - gfx::NativeTheme::MENULIST); + gfx::Size border = gfx::NativeThemeWin::instance()->GetThemeBorderSize( + gfx::NativeThemeWin::MENULIST); // The padding value of '3' is the xy offset from the corner of the control // to the corner of rcItem. It does not seem to be queryable from the theme. diff --git a/views/controls/menu/menu_config_win.cc b/views/controls/menu/menu_config_win.cc index 8f1053d..0b4334c 100644 --- a/views/controls/menu/menu_config_win.cc +++ b/views/controls/menu/menu_config_win.cc @@ -13,7 +13,7 @@ #include "ui/base/l10n/l10n_util_win.h" #include "ui/gfx/native_theme_win.h" -using gfx::NativeTheme; +using gfx::NativeThemeWin; namespace views { @@ -21,8 +21,8 @@ namespace views { MenuConfig* MenuConfig::Create() { MenuConfig* config = new MenuConfig(); - config->text_color = NativeTheme::instance()->GetThemeColorWithDefault( - NativeTheme::MENU, MENU_POPUPITEM, MPI_NORMAL, TMT_TEXTCOLOR, + config->text_color = NativeThemeWin::instance()->GetThemeColorWithDefault( + NativeThemeWin::MENU, MENU_POPUPITEM, MPI_NORMAL, TMT_TEXTCOLOR, COLOR_MENUTEXT); NONCLIENTMETRICS metrics; @@ -35,9 +35,9 @@ MenuConfig* MenuConfig::Create() { HDC dc = GetDC(NULL); RECT bounds = { 0, 0, 200, 200 }; SIZE check_size; - if (NativeTheme::instance()->GetThemePartSize( - NativeTheme::MENU, dc, MENU_POPUPCHECK, MC_CHECKMARKNORMAL, &bounds, - TS_TRUE, &check_size) == S_OK) { + if (NativeThemeWin::instance()->GetThemePartSize( + NativeThemeWin::MENU, dc, MENU_POPUPCHECK, MC_CHECKMARKNORMAL, + &bounds, TS_TRUE, &check_size) == S_OK) { config->check_width = check_size.cx; config->check_height = check_size.cy; } else { @@ -46,8 +46,8 @@ MenuConfig* MenuConfig::Create() { } SIZE radio_size; - if (NativeTheme::instance()->GetThemePartSize( - NativeTheme::MENU, dc, MENU_POPUPCHECK, MC_BULLETNORMAL, &bounds, + if (NativeThemeWin::instance()->GetThemePartSize( + NativeThemeWin::MENU, dc, MENU_POPUPCHECK, MC_BULLETNORMAL, &bounds, TS_TRUE, &radio_size) == S_OK) { config->radio_width = radio_size.cx; config->radio_height = radio_size.cy; @@ -57,8 +57,8 @@ MenuConfig* MenuConfig::Create() { } SIZE arrow_size; - if (NativeTheme::instance()->GetThemePartSize( - NativeTheme::MENU, dc, MENU_POPUPSUBMENU, MSM_NORMAL, &bounds, + if (NativeThemeWin::instance()->GetThemePartSize( + NativeThemeWin::MENU, dc, MENU_POPUPSUBMENU, MSM_NORMAL, &bounds, TS_TRUE, &arrow_size) == S_OK) { config->arrow_width = arrow_size.cx; config->arrow_height = arrow_size.cy; @@ -69,8 +69,8 @@ MenuConfig* MenuConfig::Create() { } SIZE gutter_size; - if (NativeTheme::instance()->GetThemePartSize( - NativeTheme::MENU, dc, MENU_POPUPGUTTER, MSM_NORMAL, &bounds, + if (NativeThemeWin::instance()->GetThemePartSize( + NativeThemeWin::MENU, dc, MENU_POPUPGUTTER, MSM_NORMAL, &bounds, TS_TRUE, &gutter_size) == S_OK) { config->gutter_width = gutter_size.cx; config->render_gutter = true; @@ -80,8 +80,8 @@ MenuConfig* MenuConfig::Create() { } SIZE separator_size; - if (NativeTheme::instance()->GetThemePartSize( - NativeTheme::MENU, dc, MENU_POPUPSEPARATOR, MSM_NORMAL, &bounds, + if (NativeThemeWin::instance()->GetThemePartSize( + NativeThemeWin::MENU, dc, MENU_POPUPSEPARATOR, MSM_NORMAL, &bounds, TS_TRUE, &separator_size) == S_OK) { config->separator_height = separator_size.cy; } else { diff --git a/views/controls/menu/menu_item_view.h b/views/controls/menu/menu_item_view.h index 73304cd..936f857 100644 --- a/views/controls/menu/menu_item_view.h +++ b/views/controls/menu/menu_item_view.h @@ -336,7 +336,7 @@ class MenuItemView : public View { // native theme drawing routines. void PaintCheck(HDC dc, int part_id, - gfx::NativeTheme::ControlState control_state, + gfx::NativeThemeWin::ControlState control_state, int icon_width, int icon_height); #endif diff --git a/views/controls/menu/menu_item_view_win.cc b/views/controls/menu/menu_item_view_win.cc index d746855..41fdad8 100644 --- a/views/controls/menu/menu_item_view_win.cc +++ b/views/controls/menu/menu_item_view_win.cc @@ -13,7 +13,7 @@ #include "views/controls/menu/menu_config.h" #include "views/controls/menu/submenu_view.h" -using gfx::NativeTheme; +using gfx::NativeThemeWin; namespace views { @@ -34,13 +34,13 @@ void MenuItemView::PaintButton(gfx::Canvas* canvas, PaintButtonMode mode) { int state = render_selection ? MPI_HOT : (IsEnabled() ? MPI_NORMAL : MPI_DISABLED); HDC dc = canvas->BeginPlatformPaint(); - NativeTheme::ControlState control_state; + NativeThemeWin::ControlState control_state; if (!IsEnabled()) { - control_state = NativeTheme::CONTROL_DISABLED; + control_state = NativeThemeWin::CONTROL_DISABLED; } else { - control_state = render_selection ? NativeTheme::CONTROL_HIGHLIGHTED : - NativeTheme::CONTROL_NORMAL; + control_state = render_selection ? NativeThemeWin::CONTROL_HIGHLIGHTED : + NativeThemeWin::CONTROL_NORMAL; } // The gutter is rendered before the background. @@ -50,8 +50,8 @@ void MenuItemView::PaintButton(gfx::Canvas* canvas, PaintButtonMode mode) { height()); AdjustBoundsForRTLUI(&gutter_bounds); RECT gutter_rect = gutter_bounds.ToRECT(); - NativeTheme::instance()->PaintMenuGutter(dc, MENU_POPUPGUTTER, MPI_NORMAL, - &gutter_rect); + NativeThemeWin::instance()->PaintMenuGutter(dc, MENU_POPUPGUTTER, + MPI_NORMAL, &gutter_rect); } // Render the background. @@ -59,8 +59,8 @@ void MenuItemView::PaintButton(gfx::Canvas* canvas, PaintButtonMode mode) { gfx::Rect item_bounds(0, 0, width(), height()); AdjustBoundsForRTLUI(&item_bounds); RECT item_rect = item_bounds.ToRECT(); - NativeTheme::instance()->PaintMenuItemBackground( - NativeTheme::MENU, dc, MENU_POPUPITEM, state, render_selection, + NativeThemeWin::instance()->PaintMenuItemBackground( + NativeThemeWin::MENU, dc, MENU_POPUPITEM, state, render_selection, &item_rect); } @@ -81,8 +81,8 @@ void MenuItemView::PaintButton(gfx::Canvas* canvas, PaintButtonMode mode) { // get color. int default_sys_color = render_selection ? COLOR_HIGHLIGHTTEXT : (IsEnabled() ? COLOR_MENUTEXT : COLOR_GRAYTEXT); - SkColor fg_color = NativeTheme::instance()->GetThemeColorWithDefault( - NativeTheme::MENU, MENU_POPUPITEM, state, TMT_TEXTCOLOR, + SkColor fg_color = NativeThemeWin::instance()->GetThemeColorWithDefault( + NativeThemeWin::MENU, MENU_POPUPITEM, state, TMT_TEXTCOLOR, default_sys_color); const gfx::Font& font = MenuConfig::instance().font; int accel_width = parent_menu_item_->GetSubmenu()->max_accelerator_width(); @@ -127,15 +127,15 @@ void MenuItemView::PaintButton(gfx::Canvas* canvas, PaintButtonMode mode) { // If our sub menus open from right to left (which is the case when the // locale is RTL) then we should make sure the menu arrow points to the // right direction. - NativeTheme::MenuArrowDirection arrow_direction; + NativeThemeWin::MenuArrowDirection arrow_direction; if (base::i18n::IsRTL()) - arrow_direction = NativeTheme::LEFT_POINTING_ARROW; + arrow_direction = NativeThemeWin::LEFT_POINTING_ARROW; else - arrow_direction = NativeTheme::RIGHT_POINTING_ARROW; + arrow_direction = NativeThemeWin::RIGHT_POINTING_ARROW; RECT arrow_rect = arrow_bounds.ToRECT(); - NativeTheme::instance()->PaintMenuArrow( - NativeTheme::MENU, dc, MENU_POPUPSUBMENU, state_id, &arrow_rect, + NativeThemeWin::instance()->PaintMenuArrow( + NativeThemeWin::MENU, dc, MENU_POPUPSUBMENU, state_id, &arrow_rect, arrow_direction, control_state); } canvas->EndPlatformPaint(); @@ -143,7 +143,7 @@ void MenuItemView::PaintButton(gfx::Canvas* canvas, PaintButtonMode mode) { void MenuItemView::PaintCheck(HDC dc, int state_id, - NativeTheme::ControlState control_state, + NativeThemeWin::ControlState control_state, int icon_width, int icon_height) { int top_margin = GetTopMargin(); @@ -155,16 +155,16 @@ void MenuItemView::PaintCheck(HDC dc, int bg_state = IsEnabled() ? MCB_NORMAL : MCB_DISABLED; AdjustBoundsForRTLUI(&bg_bounds); RECT bg_rect = bg_bounds.ToRECT(); - NativeTheme::instance()->PaintMenuCheckBackground( - NativeTheme::MENU, dc, MENU_POPUPCHECKBACKGROUND, bg_state, + NativeThemeWin::instance()->PaintMenuCheckBackground( + NativeThemeWin::MENU, dc, MENU_POPUPCHECKBACKGROUND, bg_state, &bg_rect); // And the check. gfx::Rect icon_bounds(icon_x / 2, icon_y, icon_width, icon_height); AdjustBoundsForRTLUI(&icon_bounds); RECT icon_rect = icon_bounds.ToRECT(); - NativeTheme::instance()->PaintMenuCheck( - NativeTheme::MENU, dc, MENU_POPUPCHECK, state_id, &icon_rect, + NativeThemeWin::instance()->PaintMenuCheck( + NativeThemeWin::MENU, dc, MENU_POPUPCHECK, state_id, &icon_rect, control_state); } diff --git a/views/controls/menu/menu_scroll_view_container.cc b/views/controls/menu/menu_scroll_view_container.cc index 0797522..94bd75b 100644 --- a/views/controls/menu/menu_scroll_view_container.cc +++ b/views/controls/menu/menu_scroll_view_container.cc @@ -25,7 +25,7 @@ #endif #if defined(OS_WIN) -using gfx::NativeTheme; +using gfx::NativeThemeWin; #endif // Height of the scroll arrow. @@ -88,8 +88,8 @@ class MenuScrollButton : public View { // The background. RECT item_bounds = { 0, 0, width(), height() }; - NativeTheme::instance()->PaintMenuItemBackground( - NativeTheme::MENU, dc, MENU_POPUPITEM, MPI_NORMAL, false, + NativeThemeWin::instance()->PaintMenuItemBackground( + NativeThemeWin::MENU, dc, MENU_POPUPITEM, MPI_NORMAL, false, &item_bounds); canvas->EndPlatformPaint(); @@ -189,8 +189,8 @@ void MenuScrollViewContainer::OnPaintBackground(gfx::Canvas* canvas) { #if defined(OS_WIN) HDC dc = canvas->BeginPlatformPaint(); RECT bounds = {0, 0, width(), height()}; - NativeTheme::instance()->PaintMenuBackground( - NativeTheme::MENU, dc, MENU_POPUPBACKGROUND, 0, &bounds); + NativeThemeWin::instance()->PaintMenuBackground( + NativeThemeWin::MENU, dc, MENU_POPUPBACKGROUND, 0, &bounds); canvas->EndPlatformPaint(); #elif defined(OS_CHROMEOS) static const SkColor kGradientColors[2] = { diff --git a/views/controls/menu/menu_separator_win.cc b/views/controls/menu/menu_separator_win.cc index b2f8a3e..d997dbd 100644 --- a/views/controls/menu/menu_separator_win.cc +++ b/views/controls/menu/menu_separator_win.cc @@ -21,9 +21,9 @@ void MenuSeparator::OnPaint(gfx::Canvas* canvas) { int start_x = 0; int start_y = height() / 3 + 1; // +1 makes separator centered. HDC dc = canvas->BeginPlatformPaint(); - const gfx::NativeTheme* theme = gfx::NativeTheme::instance(); + const gfx::NativeThemeWin* theme = gfx::NativeThemeWin::instance(); // Delta is needed for non-classic to move separator up slightly. - int delta = theme->IsClassicTheme(gfx::NativeTheme::MENU) ? 0 : 1; + int delta = theme->IsClassicTheme(gfx::NativeThemeWin::MENU) ? 0 : 1; if (config.render_gutter) { // If render_gutter is true, we're on Vista and need to render the // gutter, then indent the separator from the gutter. diff --git a/views/controls/native_control.cc b/views/controls/native_control.cc index ebf668e..83a67e5 100644 --- a/views/controls/native_control.cc +++ b/views/controls/native_control.cc @@ -18,7 +18,6 @@ #include "ui/base/l10n/l10n_util_win.h" #include "ui/base/view_prop.h" #include "ui/base/win/hwnd_util.h" -#include "ui/gfx/native_theme_win.h" #include "views/background.h" #include "views/border.h" #include "views/controls/native/native_view_host.h" diff --git a/views/controls/tabbed_pane/native_tabbed_pane_win.cc b/views/controls/tabbed_pane/native_tabbed_pane_win.cc index 333fff0..1b488528 100644 --- a/views/controls/tabbed_pane/native_tabbed_pane_win.cc +++ b/views/controls/tabbed_pane/native_tabbed_pane_win.cc @@ -29,8 +29,8 @@ class TabBackground : public Background { // TMT_FILLCOLORHINT returns a color value that supposedly // approximates the texture drawn by PaintTabPanelBackground. SkColor tab_page_color = - gfx::NativeTheme::instance()->GetThemeColorWithDefault( - gfx::NativeTheme::TAB, TABP_BODY, 0, TMT_FILLCOLORHINT, + gfx::NativeThemeWin::instance()->GetThemeColorWithDefault( + gfx::NativeThemeWin::TAB, TABP_BODY, 0, TMT_FILLCOLORHINT, COLOR_3DFACE); SetNativeControlColor(tab_page_color); } @@ -39,7 +39,7 @@ class TabBackground : public Background { virtual void Paint(gfx::Canvas* canvas, View* view) const { HDC dc = canvas->BeginPlatformPaint(); RECT r = {0, 0, view->width(), view->height()}; - gfx::NativeTheme::instance()->PaintTabPanelBackground(dc, &r); + gfx::NativeThemeWin::instance()->PaintTabPanelBackground(dc, &r); canvas->EndPlatformPaint(); } diff --git a/views/controls/textfield/native_textfield_win.cc b/views/controls/textfield/native_textfield_win.cc index f8b2ea2..a9e6ecb 100644 --- a/views/controls/textfield/native_textfield_win.cc +++ b/views/controls/textfield/native_textfield_win.cc @@ -871,9 +871,9 @@ void NativeTextfieldWin::OnNCPaint(HRGN region) { int classic_state = (!textfield_->IsEnabled() || textfield_->read_only()) ? DFCS_INACTIVE : 0; - gfx::NativeTheme::instance()->PaintTextField(hdc, part, state, classic_state, - &window_rect, bg_color_, false, - true); + gfx::NativeThemeWin::instance()->PaintTextField(hdc, part, state, + classic_state, &window_rect, + bg_color_, false, true); // NOTE: I tried checking the transparent property of the theme and invoking // drawParentBackground, but it didn't seem to make a difference. diff --git a/views/widget/widget_win.cc b/views/widget/widget_win.cc index f57e43b..f50dfbc 100644 --- a/views/widget/widget_win.cc +++ b/views/widget/widget_win.cc @@ -943,8 +943,8 @@ void WidgetWin::OnSysCommand(UINT notification_code, CPoint click) { } void WidgetWin::OnThemeChanged() { - // Notify NativeTheme. - gfx::NativeTheme::instance()->CloseHandles(); + // Notify NativeThemeWin. + gfx::NativeThemeWin::instance()->CloseHandles(); } void WidgetWin::OnVScroll(int scroll_type, short position, HWND scrollbar) { diff --git a/views/window/dialog_client_view.cc b/views/window/dialog_client_view.cc index 99512cb..2f08f96 100644 --- a/views/window/dialog_client_view.cc +++ b/views/window/dialog_client_view.cc @@ -429,8 +429,8 @@ void DialogClientView::PaintSizeBox(gfx::Canvas* canvas) { #if defined(OS_WIN) HDC dc = canvas->BeginPlatformPaint(); SIZE gripper_size = { 0, 0 }; - gfx::NativeTheme::instance()->GetThemePartSize( - gfx::NativeTheme::STATUS, dc, SP_GRIPPER, 1, NULL, TS_TRUE, + gfx::NativeThemeWin::instance()->GetThemePartSize( + gfx::NativeThemeWin::STATUS, dc, SP_GRIPPER, 1, NULL, TS_TRUE, &gripper_size); // TODO(beng): (http://b/1085509) In "classic" rendering mode, there isn't @@ -441,7 +441,7 @@ void DialogClientView::PaintSizeBox(gfx::Canvas* canvas) { size_box_bounds_.set_x(size_box_bounds_.right() - gripper_size.cx); size_box_bounds_.set_y(size_box_bounds_.bottom() - gripper_size.cy); RECT native_bounds = size_box_bounds_.ToRECT(); - gfx::NativeTheme::instance()->PaintStatusGripper( + gfx::NativeThemeWin::instance()->PaintStatusGripper( dc, SP_PANE, 1, 0, &native_bounds); canvas->EndPlatformPaint(); #else diff --git a/webkit/glue/webthemeengine_impl_win.cc b/webkit/glue/webthemeengine_impl_win.cc index a6344b6..dd3f356 100644 --- a/webkit/glue/webthemeengine_impl_win.cc +++ b/webkit/glue/webthemeengine_impl_win.cc @@ -30,7 +30,7 @@ void WebThemeEngineImpl::paintButton( HDC hdc = canvas->beginPlatformPaint(); RECT native_rect = WebRectToRECT(rect); - gfx::NativeTheme::instance()->PaintButton( + gfx::NativeThemeWin::instance()->PaintButton( hdc, part, state, classic_state, &native_rect); canvas->endPlatformPaint(); @@ -42,7 +42,7 @@ void WebThemeEngineImpl::paintMenuList( HDC hdc = canvas->beginPlatformPaint(); RECT native_rect = WebRectToRECT(rect); - gfx::NativeTheme::instance()->PaintMenuList( + gfx::NativeThemeWin::instance()->PaintMenuList( hdc, part, state, classic_state, &native_rect); canvas->endPlatformPaint(); @@ -54,7 +54,7 @@ void WebThemeEngineImpl::paintScrollbarArrow( HDC hdc = canvas->beginPlatformPaint(); RECT native_rect = WebRectToRECT(rect); - gfx::NativeTheme::instance()->PaintScrollbarArrow( + gfx::NativeThemeWin::instance()->PaintScrollbarArrow( hdc, state, classic_state, &native_rect); canvas->endPlatformPaint(); @@ -66,7 +66,7 @@ void WebThemeEngineImpl::paintScrollbarThumb( HDC hdc = canvas->beginPlatformPaint(); RECT native_rect = WebRectToRECT(rect); - gfx::NativeTheme::instance()->PaintScrollbarThumb( + gfx::NativeThemeWin::instance()->PaintScrollbarThumb( hdc, part, state, classic_state, &native_rect); canvas->endPlatformPaint(); @@ -79,7 +79,7 @@ void WebThemeEngineImpl::paintScrollbarTrack( RECT native_rect = WebRectToRECT(rect); RECT native_align_rect = WebRectToRECT(align_rect); - gfx::NativeTheme::instance()->PaintScrollbarTrack( + gfx::NativeThemeWin::instance()->PaintScrollbarTrack( hdc, part, state, classic_state, &native_rect, &native_align_rect, canvas); @@ -92,7 +92,7 @@ void WebThemeEngineImpl::paintSpinButton( HDC hdc = canvas->beginPlatformPaint(); RECT native_rect = WebRectToRECT(rect); - gfx::NativeTheme::instance()->PaintSpinButton( + gfx::NativeThemeWin::instance()->PaintSpinButton( hdc, part, state, classic_state, &native_rect); canvas->endPlatformPaint(); @@ -107,7 +107,7 @@ void WebThemeEngineImpl::paintTextField( RECT native_rect = WebRectToRECT(rect); COLORREF c = skia::SkColorToCOLORREF(color); - gfx::NativeTheme::instance()->PaintTextField( + gfx::NativeThemeWin::instance()->PaintTextField( hdc, part, state, classic_state, &native_rect, c, fill_content_area, draw_edges); @@ -120,7 +120,7 @@ void WebThemeEngineImpl::paintTrackbar( HDC hdc = canvas->beginPlatformPaint(); RECT native_rect = WebRectToRECT(rect); - gfx::NativeTheme::instance()->PaintTrackbar( + gfx::NativeThemeWin::instance()->PaintTrackbar( hdc, part, state, classic_state, &native_rect, canvas); canvas->endPlatformPaint(); @@ -133,7 +133,7 @@ void WebThemeEngineImpl::paintProgressBar( HDC hdc = canvas->beginPlatformPaint(); RECT native_bar_rect = WebRectToRECT(barRect); RECT native_value_rect = WebRectToRECT(valueRect); - gfx::NativeTheme::instance()->PaintProgressBar( + gfx::NativeThemeWin::instance()->PaintProgressBar( hdc, &native_bar_rect, &native_value_rect, determinate, animatedSeconds, canvas); canvas->endPlatformPaint(); diff --git a/webkit/tools/test_shell/test_shell_platform_delegate_win.cc b/webkit/tools/test_shell/test_shell_platform_delegate_win.cc index db3401b..7a2088f 100644 --- a/webkit/tools/test_shell/test_shell_platform_delegate_win.cc +++ b/webkit/tools/test_shell/test_shell_platform_delegate_win.cc @@ -141,7 +141,7 @@ void TestShellPlatformDelegate::InitializeGUI() { } void TestShellPlatformDelegate::SelectUnifiedTheme() { - gfx::NativeTheme::instance()->DisableTheming(); + gfx::NativeThemeWin::instance()->DisableTheming(); } void TestShellPlatformDelegate::SetWindowPositionForRecording( |