diff options
Diffstat (limited to 'ui')
50 files changed, 422 insertions, 415 deletions
@@ -1,5 +1,6 @@ include_rules = [ "+grit/app_locale_settings.h", + "+grit/gfx_resources.h", "+grit/ui_resources_standard.h", "+grit/ui_strings.h", "+net", diff --git a/ui/gfx/native_theme.cc b/ui/base/native_theme/native_theme.cc index 331d429..c467d7e 100644 --- a/ui/gfx/native_theme.cc +++ b/ui/base/native_theme/native_theme.cc @@ -1,12 +1,10 @@ -// Copyright (c) 2011 The Chromium Authors. All rights reserved. +// Copyright (c) 2012 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "ui/gfx/native_theme.h" +#include "ui/base/native_theme/native_theme.h" -#include "ui/gfx/size.h" - -namespace gfx { +namespace ui { unsigned int NativeTheme::thumb_inactive_color_ = 0xeaeaea; unsigned int NativeTheme::thumb_active_color_ = 0xf4f4f4; @@ -23,4 +21,4 @@ void NativeTheme::SetScrollbarColors(unsigned inactive_color, // NativeTheme::instance() is implemented in the platform specific source files, // such as native_theme_win.cc or native_theme_linux.cc -} // namespace gfx +} // namespace ui diff --git a/ui/gfx/native_theme.h b/ui/base/native_theme/native_theme.h index 2a83dba..b37b1e7 100644 --- a/ui/gfx/native_theme.h +++ b/ui/base/native_theme/native_theme.h @@ -2,8 +2,8 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#ifndef UI_GFX_NATIVE_THEME_H_ -#define UI_GFX_NATIVE_THEME_H_ +#ifndef UI_BASE_NATIVE_THEME_NATIVE_THEME_H_ +#define UI_BASE_NATIVE_THEME_NATIVE_THEME_H_ #pragma once #include "third_party/skia/include/core/SkColor.h" @@ -13,9 +13,11 @@ class SkCanvas; namespace gfx { - class Rect; class Size; +} + +namespace ui { // This class supports drawing UI controls (like buttons, text fields, lists, // comboboxes, etc) that look like the native UI controls of the underlying @@ -198,9 +200,9 @@ class UI_EXPORT NativeTheme { }; // Return the size of the part. - virtual Size GetPartSize(Part part, - State state, - const ExtraParams& extra) const = 0; + virtual gfx::Size GetPartSize(Part part, + State state, + const ExtraParams& extra) const = 0; // Paint the part to the canvas. virtual void Paint(SkCanvas* canvas, @@ -266,6 +268,6 @@ class UI_EXPORT NativeTheme { DISALLOW_COPY_AND_ASSIGN(NativeTheme); }; -} // namespace gfx +} // namespace ui -#endif // UI_GFX_NATIVE_THEME_H_ +#endif // UI_BASE_NATIVE_THEME_NATIVE_THEME_H_ diff --git a/ui/gfx/native_theme_android.cc b/ui/base/native_theme/native_theme_android.cc index ca5cde1..56e0dea 100644 --- a/ui/gfx/native_theme_android.cc +++ b/ui/base/native_theme/native_theme_android.cc @@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "ui/gfx/native_theme_android.h" +#include "ui/base/native_theme/native_theme_android.h" #include <limits> @@ -15,32 +15,30 @@ #include "ui/gfx/rect.h" #include "ui/gfx/size.h" -namespace gfx { +namespace ui { -static const unsigned int kButtonLength = 14; -static const unsigned int kScrollbarWidth = 15; -static const unsigned int kThumbInactiveColor = 0xeaeaea; -static const unsigned int kTrackColor= 0xd3d3d3; +const unsigned int kButtonLength = 14; +const unsigned int kScrollbarWidth = 15; +const unsigned int kThumbInactiveColor = 0xeaeaea; +const unsigned int kTrackColor= 0xd3d3d3; // These are the default dimensions of radio buttons and checkboxes. -static const int kCheckboxAndRadioWidth = 13; -static const int kCheckboxAndRadioHeight = 13; +const int kCheckboxAndRadioWidth = 13; +const int kCheckboxAndRadioHeight = 13; // These sizes match the sizes in Chromium Win. -static const int kSliderThumbWidth = 11; -static const int kSliderThumbHeight = 21; +const int kSliderThumbWidth = 11; +const int kSliderThumbHeight = 21; -static const SkColor kSliderTrackBackgroundColor = - SkColorSetRGB(0xe3, 0xdd, 0xd8); -static const SkColor kSliderThumbLightGrey = SkColorSetRGB(0xf4, 0xf2, 0xef); -static const SkColor kSliderThumbDarkGrey = SkColorSetRGB(0xea, 0xe5, 0xe0); -static const SkColor kSliderThumbBorderDarkGrey = - SkColorSetRGB(0x9d, 0x96, 0x8e); +const SkColor kSliderTrackBackgroundColor = SkColorSetRGB(0xe3, 0xdd, 0xd8); +const SkColor kSliderThumbLightGrey = SkColorSetRGB(0xf4, 0xf2, 0xef); +const SkColor kSliderThumbDarkGrey = SkColorSetRGB(0xea, 0xe5, 0xe0); +const SkColor kSliderThumbBorderDarkGrey = SkColorSetRGB(0x9d, 0x96, 0x8e); // Get lightness adjusted color. -static SkColor BrightenColor(const color_utils::HSL& hsl, - SkAlpha alpha, - double lightness_amount) { +SkColor BrightenColor(const color_utils::HSL& hsl, + SkAlpha alpha, + double lightness_amount) { color_utils::HSL adjusted = hsl; adjusted.l += lightness_amount; if (adjusted.l > 1.0) @@ -801,4 +799,4 @@ SkColor NativeThemeAndroid::OutlineColor(SkScalar* hsv1, SkScalar* hsv2) const { return SaturateAndBrighten(hsv2, -0.2, diff); } -} // namespace gfx +} // namespace ui diff --git a/ui/gfx/native_theme_android.h b/ui/base/native_theme/native_theme_android.h index 800c320..601a4f8 100644 --- a/ui/gfx/native_theme_android.h +++ b/ui/base/native_theme/native_theme_android.h @@ -2,17 +2,21 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#ifndef UI_GFX_NATIVE_THEME_ANDROID_H_ -#define UI_GFX_NATIVE_THEME_ANDROID_H_ +#ifndef UI_BASE_NATIVE_THEME_NATIVE_THEME_ANDROID_H_ +#define UI_BASE_NATIVE_THEME_NATIVE_THEME_ANDROID_H_ +#pragma once #include "base/basictypes.h" #include "base/compiler_specific.h" #include "skia/ext/platform_canvas.h" -#include "ui/gfx/native_theme.h" +#include "ui/base/native_theme/native_theme.h" namespace gfx { class Rect; class Size; +} + +namespace ui { // Android theming API. class NativeThemeAndroid : public NativeTheme { @@ -21,9 +25,9 @@ class NativeThemeAndroid : public NativeTheme { static const NativeThemeAndroid* instance(); // Return the size of the part. - virtual Size GetPartSize(Part part, - State state, - const ExtraParams& extra) const OVERRIDE; + virtual gfx::Size GetPartSize(Part part, + State state, + const ExtraParams& extra) const OVERRIDE; // Paint the part to the canvas. virtual void Paint(SkCanvas* canvas, @@ -167,6 +171,6 @@ class NativeThemeAndroid : public NativeTheme { DISALLOW_COPY_AND_ASSIGN(NativeThemeAndroid); }; -} // namespace gfx +} // namespace ui -#endif // UI_GFX_NATIVE_THEME_ANDROID_H_ +#endif // UI_BASE_NATIVE_THEME_NATIVE_THEME_ANDROID_H_ diff --git a/ui/gfx/native_theme_aura.cc b/ui/base/native_theme/native_theme_aura.cc index b3be18b..56336c0 100644 --- a/ui/gfx/native_theme_aura.cc +++ b/ui/base/native_theme/native_theme_aura.cc @@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "ui/gfx/native_theme_aura.h" +#include "ui/base/native_theme/native_theme_aura.h" #include "base/logging.h" #include "grit/gfx_resources.h" @@ -49,7 +49,7 @@ const SkColor kTextfieldSelectionColor = } // namespace -namespace gfx { +namespace ui { // static const NativeTheme* NativeTheme::instance() { @@ -292,4 +292,4 @@ void NativeThemeAura::PaintScrollbarThumb(SkCanvas* canvas, } } -} // namespace gfx +} // namespace ui diff --git a/ui/gfx/native_theme_aura.h b/ui/base/native_theme/native_theme_aura.h index de4b10d..077a42a 100644 --- a/ui/gfx/native_theme_aura.h +++ b/ui/base/native_theme/native_theme_aura.h @@ -2,15 +2,15 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#ifndef UI_GFX_NATIVE_THEME_AURA_H_ -#define UI_GFX_NATIVE_THEME_AURA_H_ +#ifndef UI_BASE_NATIVE_THEME_NATIVE_THEME_AURA_H_ +#define UI_BASE_NATIVE_THEME_NATIVE_THEME_AURA_H_ #pragma once #include "base/basictypes.h" #include "base/compiler_specific.h" -#include "ui/gfx/native_theme_base.h" +#include "ui/base/native_theme/native_theme_base.h" -namespace gfx { +namespace ui { // Aura implementation of native theme support. class NativeThemeAura : public NativeThemeBase { @@ -43,6 +43,6 @@ class NativeThemeAura : public NativeThemeBase { DISALLOW_COPY_AND_ASSIGN(NativeThemeAura); }; -} // namespace gfx +} // namespace ui -#endif // UI_GFX_NATIVE_THEME_AURA_H_ +#endif // UI_BASE_NATIVE_THEME_NATIVE_THEME_AURA_H_ diff --git a/ui/gfx/native_theme_base.cc b/ui/base/native_theme/native_theme_base.cc index 6168382..4f86670 100644 --- a/ui/gfx/native_theme_base.cc +++ b/ui/base/native_theme/native_theme_base.cc @@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "ui/gfx/native_theme_base.h" +#include "ui/base/native_theme/native_theme_base.h" #include <limits> @@ -51,7 +51,7 @@ SkColor BrightenColor(const color_utils::HSL& hsl, SkAlpha alpha, } // namespace -namespace gfx { +namespace ui { gfx::Size NativeThemeBase::GetPartSize(Part part, State state, @@ -970,4 +970,4 @@ SkColor NativeThemeBase::OutlineColor(SkScalar* hsv1, SkScalar* hsv2) const { return SaturateAndBrighten(hsv2, -0.2f, diff); } -} // namespace gfx +} // namespace ui diff --git a/ui/gfx/native_theme_base.h b/ui/base/native_theme/native_theme_base.h index 562f934..5cc86fe 100644 --- a/ui/gfx/native_theme_base.h +++ b/ui/base/native_theme/native_theme_base.h @@ -2,17 +2,21 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#ifndef UI_GFX_NATIVE_THEME_BASE_H_ -#define UI_GFX_NATIVE_THEME_BASE_H_ +#ifndef UI_BASE_NATIVE_THEME_NATIVE_THEME_BASE_H_ +#define UI_BASE_NATIVE_THEME_NATIVE_THEME_BASE_H_ +#pragma once #include "base/basictypes.h" #include "base/compiler_specific.h" #include "skia/ext/platform_canvas.h" -#include "ui/gfx/native_theme.h" +#include "ui/base/native_theme/native_theme.h" namespace gfx { class Rect; class Size; +} + +namespace ui { // Theme support for non-Windows toolkits. class NativeThemeBase : public NativeTheme { @@ -162,6 +166,6 @@ class NativeThemeBase : public NativeTheme { DISALLOW_COPY_AND_ASSIGN(NativeThemeBase); }; -} // namespace gfx +} // namespace ui -#endif // UI_GFX_NATIVE_THEME_BASE_H_ +#endif // UI_BASE_NATIVE_THEME_NATIVE_THEME_BASE_H_ diff --git a/ui/gfx/native_theme_gtk.cc b/ui/base/native_theme/native_theme_gtk.cc index 53d2636..d8eab30 100644 --- a/ui/gfx/native_theme_gtk.cc +++ b/ui/base/native_theme/native_theme_gtk.cc @@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "ui/gfx/native_theme_gtk.h" +#include "ui/base/native_theme/native_theme_gtk.h" #include <gtk/gtk.h> @@ -29,7 +29,7 @@ const SkColor kTextButtonHoverColor = kTextButtonEnabledColor; } // namespace -namespace gfx { +namespace ui { // static const NativeTheme* NativeTheme::instance() { @@ -84,4 +84,4 @@ NativeThemeGtk::NativeThemeGtk() { NativeThemeGtk::~NativeThemeGtk() { } -} // namespace gfx +} // namespace ui diff --git a/ui/gfx/native_theme_gtk.h b/ui/base/native_theme/native_theme_gtk.h index 2fb205c..257d49f 100644 --- a/ui/gfx/native_theme_gtk.h +++ b/ui/base/native_theme/native_theme_gtk.h @@ -1,14 +1,14 @@ -// Copyright (c) 2011 The Chromium Authors. All rights reserved. +// Copyright (c) 2012 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#ifndef UI_GFX_NATIVE_THEME_GTK_H_ -#define UI_GFX_NATIVE_THEME_GTK_H_ +#ifndef UI_BASE_NATIVE_THEME_NATIVE_THEME_GTK_H_ +#define UI_BASE_NATIVE_THEME_NATIVE_THEME_GTK_H_ #pragma once -#include "ui/gfx/native_theme_base.h" +#include "ui/base/native_theme/native_theme_base.h" -namespace gfx { +namespace ui { // GTK implementation of native theme support. class NativeThemeGtk : public NativeThemeBase { @@ -22,6 +22,6 @@ class NativeThemeGtk : public NativeThemeBase { virtual ~NativeThemeGtk(); }; -} // namespace gfx +} // namespace ui -#endif // UI_GFX_NATIVE_THEME_GTK_H_ +#endif // UI_BASE_NATIVE_THEME_NATIVE_THEME_GTK_H_ diff --git a/ui/gfx/native_theme_win.cc b/ui/base/native_theme/native_theme_win.cc index 28574a2..abe605f 100644 --- a/ui/gfx/native_theme_win.cc +++ b/ui/base/native_theme/native_theme_win.cc @@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "ui/gfx/native_theme_win.h" +#include "ui/base/native_theme/native_theme_win.h" #include <windows.h> #include <uxtheme.h> @@ -120,7 +120,7 @@ RECT InsetRect(const RECT* rect, int size) { } // namespace -namespace gfx { +namespace ui { bool NativeThemeWin::IsThemingActive() const { if (is_theme_active_) @@ -156,14 +156,14 @@ SkColor NativeThemeWin::GetThemeColorWithDefault(ThemeName theme, return color; } -Size NativeThemeWin::GetThemeBorderSize(ThemeName theme) const { +gfx::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; if (GetThemeInt(theme, 0, 0, TMT_BORDERSIZE, &border) == S_OK) - return Size(border, border); + return gfx::Size(border, border); else - return Size(GetSystemMetrics(SM_CXEDGE), GetSystemMetrics(SM_CYEDGE)); + return gfx::Size(GetSystemMetrics(SM_CXEDGE), GetSystemMetrics(SM_CYEDGE)); } void NativeThemeWin::DisableTheming() const { @@ -279,7 +279,7 @@ gfx::Size NativeThemeWin::GetPartSize(Part part, } } - return Size(size.cx, size.cy); + return gfx::Size(size.cx, size.cy); } void NativeThemeWin::Paint(SkCanvas* canvas, @@ -648,7 +648,7 @@ HRESULT NativeThemeWin::PaintMenuArrow(HDC hdc, // it doesn't have a flag equivalent to DFCS_MENUARROWRIGHT. But they // are needed for RTL locales on Vista. So use a memory DC and mirror // the region with GDI's StretchBlt. - Rect r(rect); + gfx::Rect r(rect); base::win::ScopedCreateDC mem_dc(CreateCompatibleDC(hdc)); base::win::ScopedBitmap mem_bitmap(CreateCompatibleBitmap(hdc, r.width(), r.height())); @@ -984,16 +984,16 @@ HRESULT NativeThemeWin::PaintScrollbarThumb( int state_id; switch (part) { - case gfx::NativeTheme::kScrollbarHorizontalThumb: + case NativeTheme::kScrollbarHorizontalThumb: part_id = SBP_THUMBBTNHORZ; break; - case gfx::NativeTheme::kScrollbarVerticalThumb: + case NativeTheme::kScrollbarVerticalThumb: part_id = SBP_THUMBBTNVERT; break; - case gfx::NativeTheme::kScrollbarHorizontalGripper: + case NativeTheme::kScrollbarHorizontalGripper: part_id = SBP_GRIPPERHORZ; break; - case gfx::NativeTheme::kScrollbarVerticalGripper: + case NativeTheme::kScrollbarVerticalGripper: part_id = SBP_GRIPPERVERT; break; default: @@ -1042,10 +1042,10 @@ HRESULT NativeThemeWin::PaintScrollbarTrack( int state_id; switch (part) { - case gfx::NativeTheme::kScrollbarHorizontalTrack: + case NativeTheme::kScrollbarHorizontalTrack: part_id = extra.is_upper ? SBP_UPPERTRACKHORZ : SBP_LOWERTRACKHORZ; break; - case gfx::NativeTheme::kScrollbarVerticalTrack: + case NativeTheme::kScrollbarVerticalTrack: part_id = extra.is_upper ? SBP_UPPERTRACKVERT : SBP_LOWERTRACKVERT; break; default: @@ -1696,15 +1696,15 @@ HRESULT NativeThemeWin::PaintFrameControl(HDC hdc, int bg_color_key; int text_color_key; switch (control_state) { - case gfx::NativeTheme::kHovered: + case NativeTheme::kHovered: bg_color_key = COLOR_HIGHLIGHT; text_color_key = COLOR_HIGHLIGHTTEXT; break; - case gfx::NativeTheme::kNormal: + case NativeTheme::kNormal: bg_color_key = COLOR_MENU; text_color_key = COLOR_MENUTEXT; break; - case gfx::NativeTheme::kDisabled: + case NativeTheme::kDisabled: bg_color_key = is_selected ? COLOR_HIGHLIGHT : COLOR_MENU; text_color_key = COLOR_GRAYTEXT; break; @@ -1776,4 +1776,4 @@ HANDLE NativeThemeWin::GetThemeHandle(ThemeName theme_name) const { return handle; } -} // namespace gfx +} // namespace ui diff --git a/ui/gfx/native_theme_win.h b/ui/base/native_theme/native_theme_win.h index 8427442..260de8d 100644 --- a/ui/gfx/native_theme_win.h +++ b/ui/base/native_theme/native_theme_win.h @@ -1,29 +1,29 @@ -// Copyright (c) 2011 The Chromium Authors. All rights reserved. +// Copyright (c) 2012 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -// + +#ifndef UI_BASE_NATIVE_THEME_NATIVE_THEME_WIN_H_ +#define UI_BASE_NATIVE_THEME_NATIVE_THEME_WIN_H_ +#pragma once + // A wrapper class for working with custom XP/Vista themes provided in // uxtheme.dll. This is a singleton class that can be grabbed using // 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 -#ifndef UI_GFX_NATIVE_THEME_WIN_H_ -#define UI_GFX_NATIVE_THEME_WIN_H_ -#pragma once - #include <windows.h> #include <uxtheme.h> #include "base/basictypes.h" #include "base/compiler_specific.h" #include "third_party/skia/include/core/SkColor.h" -#include "ui/gfx/native_theme.h" +#include "ui/base/native_theme/native_theme.h" #include "ui/gfx/size.h" class SkCanvas; -namespace gfx { +namespace ui { // Windows implementation of native theme class. // @@ -69,7 +69,7 @@ class UI_EXPORT NativeThemeWin : public NativeTheme { // Get the thickness of the border associated with the specified theme, // defaulting to GetSystemMetrics edge size if themes are disabled. // In Classic Windows, borders are typically 2px; on XP+, they are 1px. - Size GetThemeBorderSize(ThemeName theme) const; + gfx::Size GetThemeBorderSize(ThemeName theme) const; // Disables all theming for top-level windows in the entire process, from // when this method is called until the process exits. All the other @@ -326,6 +326,6 @@ class UI_EXPORT NativeThemeWin : public NativeTheme { DISALLOW_COPY_AND_ASSIGN(NativeThemeWin); }; -} // namespace gfx +} // namespace ui -#endif // UI_GFX_NATIVE_THEME_WIN_H_ +#endif // UI_BASE_NATIVE_THEME_NATIVE_THEME_WIN_H_ diff --git a/ui/base/native_theme/native_theme_win_unittest.cc b/ui/base/native_theme/native_theme_win_unittest.cc new file mode 100644 index 0000000..b711921 --- /dev/null +++ b/ui/base/native_theme/native_theme_win_unittest.cc @@ -0,0 +1,15 @@ +// Copyright (c) 2012 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "ui/base/native_theme/native_theme_win.h" + +#include "testing/gtest/include/gtest/gtest.h" + +namespace ui { + +TEST(NativeThemeTest, Init) { + ASSERT_TRUE(NativeThemeWin::instance() != NULL); +} + +} // namespace ui diff --git a/ui/gfx/native_theme_win_unittest.cc b/ui/gfx/native_theme_win_unittest.cc deleted file mode 100644 index cce3861..0000000 --- a/ui/gfx/native_theme_win_unittest.cc +++ /dev/null @@ -1,11 +0,0 @@ -// Copyright (c) 2009 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#include "ui/gfx/native_theme_win.h" - -#include "testing/gtest/include/gtest/gtest.h" - -TEST(NativeThemeTest, Init) { - ASSERT_TRUE(gfx::NativeThemeWin::instance() != NULL); -} @@ -212,6 +212,18 @@ 'base/models/tree_model.h', 'base/models/tree_node_iterator.h', 'base/models/tree_node_model.h', + 'base/native_theme/native_theme.cc', + 'base/native_theme/native_theme.h', + 'base/native_theme/native_theme_android.cc', + 'base/native_theme/native_theme_android.h', + 'base/native_theme/native_theme_aura.cc', + 'base/native_theme/native_theme_aura.h', + 'base/native_theme/native_theme_base.cc', + 'base/native_theme/native_theme_base.h', + 'base/native_theme/native_theme_gtk.cc', + 'base/native_theme/native_theme_gtk.h', + 'base/native_theme/native_theme_win.cc', + 'base/native_theme/native_theme_win.h', 'base/range/range.cc', 'base/range/range.h', 'base/range/range_mac.mm', @@ -332,18 +344,6 @@ 'gfx/mac/scoped_ns_disable_screen_updates.h', 'gfx/monitor.cc', 'gfx/monitor.h', - 'gfx/native_theme.cc', - 'gfx/native_theme.h', - 'gfx/native_theme_android.cc', - 'gfx/native_theme_android.h', - 'gfx/native_theme_aura.cc', - 'gfx/native_theme_aura.h', - 'gfx/native_theme_base.cc', - 'gfx/native_theme_base.h', - 'gfx/native_theme_gtk.cc', - 'gfx/native_theme_gtk.h', - 'gfx/native_theme_win.cc', - 'gfx/native_theme_win.h', 'gfx/native_widget_types.h', 'gfx/pango_util.h', 'gfx/pango_util.cc', @@ -452,20 +452,20 @@ ], }, { # use_aura!=1 'sources!': [ - 'gfx/native_theme_aura.cc', - 'gfx/native_theme_aura.h', 'base/cursor/cursor.cc', 'base/cursor/cursor.h', 'base/cursor/cursor_win.cc', 'base/cursor/cursor_x11.cc', + 'base/native_theme/native_theme_aura.cc', + 'base/native_theme/native_theme_aura.h', ] }], ['use_aura==1 and OS=="win"', { 'sources/': [ ['exclude', 'base/dragdrop/os_exchange_data_provider_win.cc'], ['exclude', 'base/dragdrop/os_exchange_data_provider_win.h'], - ['exclude', 'gfx/native_theme_win.cc'], - ['exclude', 'gfx/native_theme_win.h'], + ['exclude', 'base/native_theme/native_theme_win.cc'], + ['exclude', 'base/native_theme/native_theme_win.h'], ['exclude', 'gfx/path_win.cc'], ], }], @@ -534,8 +534,8 @@ ], }, { # toolkit_uses_gtk != 1 'sources!': [ - 'gfx/native_theme_gtk.cc', - 'gfx/native_theme_gtk.h', + 'base/native_theme/native_theme_gtk.cc', + 'base/native_theme/native_theme_gtk.h', ] }], ['OS=="win"', { @@ -544,8 +544,8 @@ 'gfx/gdi_util.h', 'gfx/icon_util.cc', 'gfx/icon_util.h', - 'gfx/native_theme_win.cc', - 'gfx/native_theme_win.h', + 'base/native_theme/native_theme_win.cc', + 'base/native_theme/native_theme_win.h', ], 'sources!': [ 'base/touch/touch_factory.cc', @@ -594,8 +594,8 @@ 'base/dragdrop/drop_target.cc', 'base/dragdrop/drop_target.h', 'base/dragdrop/os_exchange_data.cc', - 'gfx/native_theme_win.cc', - 'gfx/native_theme_win.h', + 'base/native_theme/native_theme_win.cc', + 'base/native_theme/native_theme_win.h', ], 'sources/': [ ['exclude', '^base/win/*'], diff --git a/ui/ui_unittests.gypi b/ui/ui_unittests.gypi index 0f6d293..2a0a121 100644 --- a/ui/ui_unittests.gypi +++ b/ui/ui_unittests.gypi @@ -111,9 +111,9 @@ ['OS == "win"', { 'sources': [ 'base/dragdrop/os_exchange_data_win_unittest.cc', + 'base/native_theme/native_theme_win_unittest.cc', 'base/win/hwnd_subclass_unittest.cc', 'gfx/icon_util_unittest.cc', - 'gfx/native_theme_win_unittest.cc', 'gfx/platform_font_win_unittest.cc', ], 'include_dirs': [ @@ -199,9 +199,9 @@ }], ['use_aura==1', { 'sources!': [ - 'gfx/screen_unittest.cc', - 'gfx/native_theme_win_unittest.cc', 'base/dragdrop/os_exchange_data_win_unittest.cc', + 'base/native_theme/native_theme_win_unittest.cc', + 'gfx/screen_unittest.cc', ], }], ['use_aura==1 or toolkit_views==1', { diff --git a/ui/views/controls/button/checkbox.cc b/ui/views/controls/button/checkbox.cc index 8e85a2d..cfedcce 100644 --- a/ui/views/controls/button/checkbox.cc +++ b/ui/views/controls/button/checkbox.cc @@ -1,4 +1,4 @@ -// Copyright (c) 2011 The Chromium Authors. All rights reserved. +// Copyright (c) 2012 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -36,11 +36,10 @@ void Checkbox::SetChecked(bool checked) { gfx::Size Checkbox::GetPreferredSize() { gfx::Size prefsize(TextButtonBase::GetPreferredSize()); - gfx::NativeTheme::ExtraParams extra; - gfx::NativeTheme::State state = GetThemeState(&extra); - gfx::Size size = gfx::NativeTheme::instance()->GetPartSize(GetThemePart(), - state, - extra); + ui::NativeTheme::ExtraParams extra; + ui::NativeTheme::State state = GetThemeState(&extra); + gfx::Size size = ui::NativeTheme::instance()->GetPartSize(GetThemePart(), + state, extra); prefsize.Enlarge(size.width(), 0); prefsize.set_height(std::max(prefsize.height(), size.height())); @@ -76,16 +75,15 @@ void Checkbox::NotifyClick(const views::Event& event) { TextButtonBase::NotifyClick(event); } -gfx::NativeTheme::Part Checkbox::GetThemePart() const { - return gfx::NativeTheme::kCheckbox; +ui::NativeTheme::Part Checkbox::GetThemePart() const { + return ui::NativeTheme::kCheckbox; } gfx::Rect Checkbox::GetThemePaintRect() const { - gfx::NativeTheme::ExtraParams extra; - gfx::NativeTheme::State state = GetThemeState(&extra); - gfx::Size size(gfx::NativeTheme::instance()->GetPartSize(GetThemePart(), - state, - extra)); + ui::NativeTheme::ExtraParams extra; + ui::NativeTheme::State state = GetThemeState(&extra); + gfx::Size size(ui::NativeTheme::instance()->GetPartSize(GetThemePart(), state, + extra)); gfx::Insets insets = GetInsets(); int y_offset = (height() - size.height()) / 2; gfx::Rect rect(insets.left(), y_offset, size.width(), size.height()); @@ -93,18 +91,17 @@ gfx::Rect Checkbox::GetThemePaintRect() const { return rect; } -void Checkbox::GetExtraParams(gfx::NativeTheme::ExtraParams* params) const { +void Checkbox::GetExtraParams(ui::NativeTheme::ExtraParams* params) const { TextButtonBase::GetExtraParams(params); params->button.checked = checked_; } gfx::Rect Checkbox::GetTextBounds() const { gfx::Rect bounds(TextButtonBase::GetTextBounds()); - gfx::NativeTheme::ExtraParams extra; - gfx::NativeTheme::State state = GetThemeState(&extra); - gfx::Size size(gfx::NativeTheme::instance()->GetPartSize(GetThemePart(), - state, - extra)); + ui::NativeTheme::ExtraParams extra; + ui::NativeTheme::State state = GetThemeState(&extra); + gfx::Size size(ui::NativeTheme::instance()->GetPartSize(GetThemePart(), state, + extra)); bounds.Offset(size.width() + kCheckboxLabelSpacing, 0); return bounds; } diff --git a/ui/views/controls/button/checkbox.h b/ui/views/controls/button/checkbox.h index b86c7c6..7554cfd 100644 --- a/ui/views/controls/button/checkbox.h +++ b/ui/views/controls/button/checkbox.h @@ -1,4 +1,4 @@ -// Copyright (c) 2011 The Chromium Authors. All rights reserved. +// Copyright (c) 2012 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -43,10 +43,10 @@ class VIEWS_EXPORT Checkbox : public TextButtonBase { virtual void NotifyClick(const views::Event& event) OVERRIDE; // Overridden from TextButtonBase: - virtual gfx::NativeTheme::Part GetThemePart() const OVERRIDE; + virtual ui::NativeTheme::Part GetThemePart() const OVERRIDE; virtual gfx::Rect GetThemePaintRect() const OVERRIDE; virtual void GetExtraParams( - gfx::NativeTheme::ExtraParams* params) const OVERRIDE; + ui::NativeTheme::ExtraParams* params) const OVERRIDE; virtual gfx::Rect GetTextBounds() const OVERRIDE; // True if the checkbox is checked. diff --git a/ui/views/controls/button/radio_button.cc b/ui/views/controls/button/radio_button.cc index 1c3352cd..5218bcf 100644 --- a/ui/views/controls/button/radio_button.cc +++ b/ui/views/controls/button/radio_button.cc @@ -1,4 +1,4 @@ -// Copyright (c) 2011 The Chromium Authors. All rights reserved. +// Copyright (c) 2012 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -97,8 +97,8 @@ void RadioButton::NotifyClick(const views::Event& event) { TextButtonBase::NotifyClick(event); } -gfx::NativeTheme::Part RadioButton::GetThemePart() const { - return gfx::NativeTheme::kRadio; +ui::NativeTheme::Part RadioButton::GetThemePart() const { + return ui::NativeTheme::kRadio; } } // namespace views diff --git a/ui/views/controls/button/radio_button.h b/ui/views/controls/button/radio_button.h index 19ef602..2fa9a97 100644 --- a/ui/views/controls/button/radio_button.h +++ b/ui/views/controls/button/radio_button.h @@ -1,4 +1,4 @@ -// Copyright (c) 2011 The Chromium Authors. All rights reserved. +// Copyright (c) 2012 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -32,7 +32,7 @@ class VIEWS_EXPORT RadioButton : public Checkbox { virtual void NotifyClick(const views::Event& event) OVERRIDE; // Overridden from TextButtonBase: - virtual gfx::NativeTheme::Part GetThemePart() const OVERRIDE; + virtual ui::NativeTheme::Part GetThemePart() const OVERRIDE; // Overridden from Checkbox: virtual void SetChecked(bool checked) OVERRIDE; diff --git a/ui/views/controls/button/text_button.cc b/ui/views/controls/button/text_button.cc index 89aa97d..1e616da 100644 --- a/ui/views/controls/button/text_button.cc +++ b/ui/views/controls/button/text_button.cc @@ -18,7 +18,7 @@ #if defined(OS_WIN) #include "skia/ext/skia_utils_win.h" -#include "ui/gfx/native_theme_win.h" +#include "ui/base/native_theme/native_theme_win.h" #include "ui/gfx/platform_font_win.h" #endif @@ -208,30 +208,30 @@ TextButtonNativeThemeBorder::~TextButtonNativeThemeBorder() { void TextButtonNativeThemeBorder::Paint(const View& view, gfx::Canvas* canvas) const { const TextButtonBase* tb = static_cast<const TextButton*>(&view); - const gfx::NativeTheme* native_theme = gfx::NativeTheme::instance(); - gfx::NativeTheme::Part part = delegate_->GetThemePart(); + const ui::NativeTheme* native_theme = ui::NativeTheme::instance(); + ui::NativeTheme::Part part = delegate_->GetThemePart(); gfx::Rect rect(delegate_->GetThemePaintRect()); if (tb->show_multiple_icon_states() && delegate_->GetThemeAnimation() != NULL && delegate_->GetThemeAnimation()->is_animating()) { // Paint background state. - gfx::NativeTheme::ExtraParams prev_extra; - gfx::NativeTheme::State prev_state = + ui::NativeTheme::ExtraParams prev_extra; + ui::NativeTheme::State prev_state = delegate_->GetBackgroundThemeState(&prev_extra); native_theme->Paint(canvas->sk_canvas(), part, prev_state, rect, prev_extra); // Composite foreground state above it. - gfx::NativeTheme::ExtraParams extra; - gfx::NativeTheme::State state = delegate_->GetForegroundThemeState(&extra); + ui::NativeTheme::ExtraParams extra; + ui::NativeTheme::State state = delegate_->GetForegroundThemeState(&extra); int alpha = delegate_->GetThemeAnimation()->CurrentValueBetween(0, 255); canvas->SaveLayerAlpha(static_cast<uint8>(alpha)); native_theme->Paint(canvas->sk_canvas(), part, state, rect, extra); canvas->Restore(); } else { - gfx::NativeTheme::ExtraParams extra; - gfx::NativeTheme::State state = delegate_->GetThemeState(&extra); + ui::NativeTheme::ExtraParams extra; + ui::NativeTheme::State state = delegate_->GetThemeState(&extra); native_theme->Paint(canvas->sk_canvas(), part, state, rect, extra); } } @@ -252,16 +252,16 @@ TextButtonBase::TextButtonBase(ButtonListener* listener, const string16& text) alignment_(ALIGN_LEFT), font_(ResourceBundle::GetSharedInstance().GetFont( ResourceBundle::BaseFont)), - color_(gfx::NativeTheme::instance()->GetSystemColor( - gfx::NativeTheme::kColorId_TextButtonEnabledColor)), - color_enabled_(gfx::NativeTheme::instance()->GetSystemColor( - gfx::NativeTheme::kColorId_TextButtonEnabledColor)), - color_disabled_(gfx::NativeTheme::instance()->GetSystemColor( - gfx::NativeTheme::kColorId_TextButtonDisabledColor)), - color_highlight_(gfx::NativeTheme::instance()->GetSystemColor( - gfx::NativeTheme::kColorId_TextButtonHighlightColor)), - color_hover_(gfx::NativeTheme::instance()->GetSystemColor( - gfx::NativeTheme::kColorId_TextButtonHoverColor)), + color_(ui::NativeTheme::instance()->GetSystemColor( + ui::NativeTheme::kColorId_TextButtonEnabledColor)), + color_enabled_(ui::NativeTheme::instance()->GetSystemColor( + ui::NativeTheme::kColorId_TextButtonEnabledColor)), + color_disabled_(ui::NativeTheme::instance()->GetSystemColor( + ui::NativeTheme::kColorId_TextButtonDisabledColor)), + color_highlight_(ui::NativeTheme::instance()->GetSystemColor( + ui::NativeTheme::kColorId_TextButtonHighlightColor)), + color_hover_(ui::NativeTheme::instance()->GetSystemColor( + ui::NativeTheme::kColorId_TextButtonHoverColor)), text_halo_color_(0), has_text_halo_(false), active_text_shadow_color_(0), @@ -458,15 +458,15 @@ int TextButtonBase::ComputeCanvasStringFlags() const { } void TextButtonBase::GetExtraParams( - gfx::NativeTheme::ExtraParams* params) const { + ui::NativeTheme::ExtraParams* params) const { params->button.checked = false; params->button.indeterminate = false; params->button.is_default = false; params->button.has_border = false; params->button.classic_state = 0; params->button.background_color = - gfx::NativeTheme::instance()->GetSystemColor( - gfx::NativeTheme::kColorId_TextButtonBackgroundColor); + ui::NativeTheme::instance()->GetSystemColor( + ui::NativeTheme::kColorId_TextButtonBackgroundColor); } gfx::Rect TextButtonBase::GetContentBounds(int extra_width) const { @@ -608,21 +608,21 @@ gfx::Rect TextButtonBase::GetThemePaintRect() const { return GetLocalBounds(); } -gfx::NativeTheme::State TextButtonBase::GetThemeState( - gfx::NativeTheme::ExtraParams* params) const { +ui::NativeTheme::State TextButtonBase::GetThemeState( + ui::NativeTheme::ExtraParams* params) const { GetExtraParams(params); switch(state()) { case BS_DISABLED: - return gfx::NativeTheme::kDisabled; + return ui::NativeTheme::kDisabled; case BS_NORMAL: - return gfx::NativeTheme::kNormal; + return ui::NativeTheme::kNormal; case BS_HOT: - return gfx::NativeTheme::kHovered; + return ui::NativeTheme::kHovered; case BS_PUSHED: - return gfx::NativeTheme::kPressed; + return ui::NativeTheme::kPressed; default: NOTREACHED() << "Unknown state: " << state(); - return gfx::NativeTheme::kNormal; + return ui::NativeTheme::kNormal; } } @@ -630,23 +630,23 @@ const ui::Animation* TextButtonBase::GetThemeAnimation() const { #if defined(USE_AURA) return hover_animation_.get(); #elif defined(OS_WIN) - return gfx::NativeThemeWin::instance()->IsThemingActive() + return ui::NativeThemeWin::instance()->IsThemingActive() ? hover_animation_.get() : NULL; #else return hover_animation_.get(); #endif } -gfx::NativeTheme::State TextButtonBase::GetBackgroundThemeState( - gfx::NativeTheme::ExtraParams* params) const { +ui::NativeTheme::State TextButtonBase::GetBackgroundThemeState( + ui::NativeTheme::ExtraParams* params) const { GetExtraParams(params); - return gfx::NativeTheme::kNormal; + return ui::NativeTheme::kNormal; } -gfx::NativeTheme::State TextButtonBase::GetForegroundThemeState( - gfx::NativeTheme::ExtraParams* params) const { +ui::NativeTheme::State TextButtonBase::GetForegroundThemeState( + ui::NativeTheme::ExtraParams* params) const { GetExtraParams(params); - return gfx::NativeTheme::kHovered; + return ui::NativeTheme::kHovered; } //////////////////////////////////////////////////////////////////////////////// @@ -756,11 +756,11 @@ void TextButton::OnPaintFocusBorder(gfx::Canvas* canvas) { } } -gfx::NativeTheme::Part TextButton::GetThemePart() const { - return gfx::NativeTheme::kPushButton; +ui::NativeTheme::Part TextButton::GetThemePart() const { + return ui::NativeTheme::kPushButton; } -void TextButton::GetExtraParams(gfx::NativeTheme::ExtraParams* params) const { +void TextButton::GetExtraParams(ui::NativeTheme::ExtraParams* params) const { TextButtonBase::GetExtraParams(params); params->button.is_default = is_default_; } @@ -848,7 +848,7 @@ void NativeTextButton::OnPaintFocusBorder(gfx::Canvas* canvas) { } void NativeTextButton::GetExtraParams( - gfx::NativeTheme::ExtraParams* params) const { + ui::NativeTheme::ExtraParams* params) const { TextButton::GetExtraParams(params); params->button.has_border = true; } diff --git a/ui/views/controls/button/text_button.h b/ui/views/controls/button/text_button.h index 2e1f285..2dd1cb8 100644 --- a/ui/views/controls/button/text_button.h +++ b/ui/views/controls/button/text_button.h @@ -225,15 +225,15 @@ class VIEWS_EXPORT TextButtonBase : public CustomButton, // Overridden from NativeThemeDelegate: virtual gfx::Rect GetThemePaintRect() const OVERRIDE; - virtual gfx::NativeTheme::State GetThemeState( - gfx::NativeTheme::ExtraParams* params) const OVERRIDE; + virtual ui::NativeTheme::State GetThemeState( + ui::NativeTheme::ExtraParams* params) const OVERRIDE; virtual const ui::Animation* GetThemeAnimation() const OVERRIDE; - virtual gfx::NativeTheme::State GetBackgroundThemeState( - gfx::NativeTheme::ExtraParams* params) const OVERRIDE; - virtual gfx::NativeTheme::State GetForegroundThemeState( - gfx::NativeTheme::ExtraParams* params) const OVERRIDE; + virtual ui::NativeTheme::State GetBackgroundThemeState( + ui::NativeTheme::ExtraParams* params) const OVERRIDE; + virtual ui::NativeTheme::State GetForegroundThemeState( + ui::NativeTheme::ExtraParams* params) const OVERRIDE; - virtual void GetExtraParams(gfx::NativeTheme::ExtraParams* params) const; + virtual void GetExtraParams(ui::NativeTheme::ExtraParams* params) const; virtual gfx::Rect GetTextBounds() const; @@ -353,11 +353,11 @@ class VIEWS_EXPORT TextButton : public TextButtonBase { virtual const SkBitmap& GetImageToPaint() const; // Overridden from NativeThemeDelegate: - virtual gfx::NativeTheme::Part GetThemePart() const OVERRIDE; + virtual ui::NativeTheme::Part GetThemePart() const OVERRIDE; // Overridden from TextButtonBase: virtual void GetExtraParams( - gfx::NativeTheme::ExtraParams* params) const OVERRIDE; + ui::NativeTheme::ExtraParams* params) const OVERRIDE; virtual gfx::Rect GetTextBounds() const OVERRIDE; private: @@ -413,7 +413,7 @@ class VIEWS_EXPORT NativeTextButton : public TextButton { // Overridden from TextButton: virtual void GetExtraParams( - gfx::NativeTheme::ExtraParams* params) const OVERRIDE; + ui::NativeTheme::ExtraParams* params) const OVERRIDE; DISALLOW_COPY_AND_ASSIGN(NativeTextButton); }; diff --git a/ui/views/controls/combobox/native_combobox_win.cc b/ui/views/controls/combobox/native_combobox_win.cc index fbf7adf..8a472dd 100644 --- a/ui/views/controls/combobox/native_combobox_win.cc +++ b/ui/views/controls/combobox/native_combobox_win.cc @@ -10,7 +10,7 @@ #include "ui/base/resource/resource_bundle.h" #include "ui/base/win/hwnd_util.h" #include "ui/gfx/font.h" -#include "ui/gfx/native_theme_win.h" +#include "ui/base/native_theme/native_theme_win.h" #include "ui/views/controls/combobox/combobox.h" #include "ui/views/controls/combobox/native_combobox_views.h" #include "ui/views/widget/widget.h" @@ -109,8 +109,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::NativeThemeWin::instance()->GetThemeBorderSize( - gfx::NativeThemeWin::MENULIST); + gfx::Size border = ui::NativeThemeWin::instance()->GetThemeBorderSize( + ui::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/ui/views/controls/focusable_border.cc b/ui/views/controls/focusable_border.cc index 6cdd1c3..de35299 100644 --- a/ui/views/controls/focusable_border.cc +++ b/ui/views/controls/focusable_border.cc @@ -6,7 +6,7 @@ #include "ui/gfx/canvas.h" #include "ui/gfx/insets.h" -#include "ui/gfx/native_theme.h" +#include "ui/base/native_theme/native_theme.h" #include "ui/gfx/skia_util.h" namespace { @@ -32,9 +32,9 @@ void FocusableBorder::Paint(const View& view, gfx::Canvas* canvas) const { path.addRect(gfx::RectToSkRect(view.GetLocalBounds()), SkPath::kCW_Direction); SkPaint paint; paint.setStyle(SkPaint::kStroke_Style); - SkColor focus_color = gfx::NativeTheme::instance()->GetSystemColor( - has_focus_ ? gfx::NativeTheme::kColorId_FocusedBorderColor - : gfx::NativeTheme::kColorId_UnfocusedBorderColor); + SkColor focus_color = ui::NativeTheme::instance()->GetSystemColor( + has_focus_ ? ui::NativeTheme::kColorId_FocusedBorderColor + : ui::NativeTheme::kColorId_UnfocusedBorderColor); paint.setColor(focus_color); paint.setStrokeWidth(SkIntToScalar(2)); diff --git a/ui/views/controls/label.cc b/ui/views/controls/label.cc index ac40fe5..21bf14d7 100644 --- a/ui/views/controls/label.cc +++ b/ui/views/controls/label.cc @@ -21,7 +21,7 @@ #include "ui/gfx/color_utils.h" #include "ui/gfx/font.h" #include "ui/gfx/insets.h" -#include "ui/gfx/native_theme.h" +#include "ui/base/native_theme/native_theme.h" #include "ui/views/background.h" namespace views { @@ -359,12 +359,12 @@ void Label::Init(const string16& text, const gfx::Font& font) { contains_mouse_ = false; font_ = font; text_size_valid_ = false; - requested_enabled_color_ = gfx::NativeTheme::instance()->GetSystemColor( - gfx::NativeTheme::kColorId_LabelEnabledColor); - requested_disabled_color_ = gfx::NativeTheme::instance()->GetSystemColor( - gfx::NativeTheme::kColorId_LabelDisabledColor); - background_color_ = gfx::NativeTheme::instance()->GetSystemColor( - gfx::NativeTheme::kColorId_LabelBackgroundColor); + requested_enabled_color_ = ui::NativeTheme::instance()->GetSystemColor( + ui::NativeTheme::kColorId_LabelEnabledColor); + requested_disabled_color_ = ui::NativeTheme::instance()->GetSystemColor( + ui::NativeTheme::kColorId_LabelDisabledColor); + background_color_ = ui::NativeTheme::instance()->GetSystemColor( + ui::NativeTheme::kColorId_LabelBackgroundColor); auto_color_readability_ = true; RecalculateColors(); horiz_alignment_ = ALIGN_CENTER; diff --git a/ui/views/controls/menu/menu_config_views.cc b/ui/views/controls/menu/menu_config_views.cc index 0142240..b35a090 100644 --- a/ui/views/controls/menu/menu_config_views.cc +++ b/ui/views/controls/menu/menu_config_views.cc @@ -8,15 +8,15 @@ #include "third_party/skia/include/core/SkBitmap.h" #include "ui/base/resource/resource_bundle.h" #include "ui/gfx/image/image.h" -#include "ui/gfx/native_theme_aura.h" +#include "ui/base/native_theme/native_theme_aura.h" namespace views { // static MenuConfig* MenuConfig::Create() { MenuConfig* config = new MenuConfig(); - config->text_color = gfx::NativeTheme::instance()->GetSystemColor( - gfx::NativeTheme::kColorId_EnabledMenuItemForegroundColor); + config->text_color = ui::NativeTheme::instance()->GetSystemColor( + ui::NativeTheme::kColorId_EnabledMenuItemForegroundColor); config->submenu_horizontal_margin_size = 0; config->submenu_vertical_margin_size = 2; config->submenu_horizontal_inset = 1; diff --git a/ui/views/controls/menu/menu_config_win.cc b/ui/views/controls/menu/menu_config_win.cc index 07681fe..86d4b64 100644 --- a/ui/views/controls/menu/menu_config_win.cc +++ b/ui/views/controls/menu/menu_config_win.cc @@ -1,4 +1,4 @@ -// Copyright (c) 2011 The Chromium Authors. All rights reserved. +// Copyright (c) 2012 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -12,10 +12,10 @@ #include "base/win/scoped_gdi_object.h" #include "base/win/win_util.h" #include "ui/base/l10n/l10n_util_win.h" -#include "ui/gfx/native_theme_win.h" +#include "ui/base/native_theme/native_theme_win.h" -using gfx::NativeTheme; -using gfx::NativeThemeWin; +using ui::NativeTheme; +using ui::NativeThemeWin; namespace views { diff --git a/ui/views/controls/menu/menu_item_view.cc b/ui/views/controls/menu/menu_item_view.cc index 74d458c..d07d7a4 100644 --- a/ui/views/controls/menu/menu_item_view.cc +++ b/ui/views/controls/menu/menu_item_view.cc @@ -686,8 +686,8 @@ void MenuItemView::PaintAccelerator(gfx::Canvas* canvas) { else flags |= gfx::Canvas::TEXT_ALIGN_RIGHT; canvas->DrawStringInt( - accel_text, font, gfx::NativeTheme::instance()->GetSystemColor( - gfx::NativeTheme::kColorId_TextButtonDisabledColor), + accel_text, font, ui::NativeTheme::instance()->GetSystemColor( + ui::NativeTheme::kColorId_TextButtonDisabledColor), accel_bounds.x(), accel_bounds.y(), accel_bounds.width(), accel_bounds.height(), flags); } diff --git a/ui/views/controls/menu/menu_item_view.h b/ui/views/controls/menu/menu_item_view.h index dbc22f6..f61453a 100644 --- a/ui/views/controls/menu/menu_item_view.h +++ b/ui/views/controls/menu/menu_item_view.h @@ -19,7 +19,7 @@ #if defined(OS_WIN) #include <windows.h> -#include "ui/gfx/native_theme.h" +#include "ui/base/native_theme/native_theme.h" #endif namespace gfx { @@ -362,7 +362,7 @@ class VIEWS_EXPORT MenuItemView : public View { // Paints the check/radio button indicator. void PaintCheck(gfx::Canvas* canvas, - gfx::NativeTheme::State state, + ui::NativeTheme::State state, SelectionState selection_state, const MenuConfig& config); #endif diff --git a/ui/views/controls/menu/menu_item_view_views.cc b/ui/views/controls/menu/menu_item_view_views.cc index 6942dc9..00beeb9 100644 --- a/ui/views/controls/menu/menu_item_view_views.cc +++ b/ui/views/controls/menu/menu_item_view_views.cc @@ -11,7 +11,7 @@ #include "ui/gfx/canvas.h" #include "ui/gfx/favicon_size.h" #include "ui/gfx/image/image.h" -#include "ui/gfx/native_theme.h" +#include "ui/base/native_theme/native_theme.h" #include "ui/views/controls/menu/menu_config.h" #include "ui/views/controls/menu/menu_image_util.h" #include "ui/views/controls/menu/submenu_view.h" @@ -37,8 +37,8 @@ void MenuItemView::PaintButton(gfx::Canvas* canvas, PaintButtonMode mode) { // only need the background when we want it to look different, as when we're // selected. if (render_selection) { - SkColor bg_color = gfx::NativeTheme::instance()->GetSystemColor( - gfx::NativeTheme::kColorId_FocusedMenuItemBackgroundColor); + SkColor bg_color = ui::NativeTheme::instance()->GetSystemColor( + ui::NativeTheme::kColorId_FocusedMenuItemBackgroundColor); canvas->DrawColor(bg_color, SkXfermode::kSrc_Mode); } @@ -64,9 +64,9 @@ void MenuItemView::PaintButton(gfx::Canvas* canvas, PaintButtonMode mode) { } // Render the foreground. - SkColor fg_color = gfx::NativeTheme::instance()->GetSystemColor( - enabled() ? gfx::NativeTheme::kColorId_EnabledMenuItemForegroundColor - : gfx::NativeTheme::kColorId_DisabledMenuItemForegroundColor); + SkColor fg_color = ui::NativeTheme::instance()->GetSystemColor( + enabled() ? ui::NativeTheme::kColorId_EnabledMenuItemForegroundColor + : ui::NativeTheme::kColorId_DisabledMenuItemForegroundColor); const gfx::Font& font = GetFont(); int accel_width = parent_menu_item_->GetSubmenu()->max_accelerator_width(); diff --git a/ui/views/controls/menu/menu_item_view_win.cc b/ui/views/controls/menu/menu_item_view_win.cc index 8458e22..ba6f9d7 100644 --- a/ui/views/controls/menu/menu_item_view_win.cc +++ b/ui/views/controls/menu/menu_item_view_win.cc @@ -9,11 +9,11 @@ #include "grit/ui_strings.h" #include "ui/gfx/canvas.h" -#include "ui/gfx/native_theme_win.h" +#include "ui/base/native_theme/native_theme_win.h" #include "ui/views/controls/menu/menu_config.h" #include "ui/views/controls/menu/submenu_view.h" -using gfx::NativeTheme; +using ui::NativeTheme; namespace views { @@ -79,8 +79,8 @@ void MenuItemView::PaintButton(gfx::Canvas* canvas, PaintButtonMode mode) { // Render the foreground. // Menu color is specific to Vista, fallback to classic colors if can't // get color. - SkColor fg_color = gfx::NativeThemeWin::instance()->GetThemeColorWithDefault( - gfx::NativeThemeWin::MENU, MENU_POPUPITEM, state, TMT_TEXTCOLOR, + SkColor fg_color = ui::NativeThemeWin::instance()->GetThemeColorWithDefault( + ui::NativeThemeWin::MENU, MENU_POPUPITEM, state, TMT_TEXTCOLOR, default_sys_color); const gfx::Font& font = GetFont(); int accel_width = parent_menu_item_->GetSubmenu()->max_accelerator_width(); @@ -124,11 +124,11 @@ 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. - gfx::NativeTheme::ExtraParams extra; + ui::NativeTheme::ExtraParams extra; extra.menu_arrow.pointing_right = !base::i18n::IsRTL(); extra.menu_arrow.is_selected = render_selection; - gfx::NativeTheme::instance()->Paint(canvas->sk_canvas(), - gfx::NativeTheme::kMenuPopupArrow, control_state, arrow_bounds, extra); + ui::NativeTheme::instance()->Paint(canvas->sk_canvas(), + ui::NativeTheme::kMenuPopupArrow, control_state, arrow_bounds, extra); } } diff --git a/ui/views/controls/menu/menu_scroll_view_container.cc b/ui/views/controls/menu/menu_scroll_view_container.cc index f8f36b8..4442328 100644 --- a/ui/views/controls/menu/menu_scroll_view_container.cc +++ b/ui/views/controls/menu/menu_scroll_view_container.cc @@ -13,14 +13,14 @@ #include "ui/base/accessibility/accessible_view_state.h" #include "ui/gfx/canvas.h" #include "ui/gfx/color_utils.h" -#include "ui/gfx/native_theme.h" +#include "ui/base/native_theme/native_theme.h" #include "ui/views/border.h" #include "ui/views/controls/menu/menu_config.h" #include "ui/views/controls/menu/menu_controller.h" #include "ui/views/controls/menu/menu_item_view.h" #include "ui/views/controls/menu/submenu_view.h" -using gfx::NativeTheme; +using ui::NativeTheme; // Height of the scroll arrow. // This goes up to 4 with large fonts, but this is close enough for now. diff --git a/ui/views/controls/menu/menu_separator_views.cc b/ui/views/controls/menu/menu_separator_views.cc index 484825f..1ef788d 100644 --- a/ui/views/controls/menu/menu_separator_views.cc +++ b/ui/views/controls/menu/menu_separator_views.cc @@ -6,7 +6,7 @@ #include "third_party/skia/include/core/SkColor.h" #include "ui/gfx/canvas.h" -#include "ui/gfx/native_theme.h" +#include "ui/base/native_theme/native_theme.h" #include "ui/views/controls/menu/menu_config.h" namespace { @@ -19,8 +19,8 @@ namespace views { void MenuSeparator::OnPaint(gfx::Canvas* canvas) { canvas->FillRect(gfx::Rect(0, height() / 2, width(), kSeparatorHeight), - gfx::NativeTheme::instance()->GetSystemColor( - gfx::NativeTheme::kColorId_MenuSeparatorColor)); + ui::NativeTheme::instance()->GetSystemColor( + ui::NativeTheme::kColorId_MenuSeparatorColor)); } gfx::Size MenuSeparator::GetPreferredSize() { diff --git a/ui/views/controls/menu/menu_separator_win.cc b/ui/views/controls/menu/menu_separator_win.cc index a5769140..6979a50 100644 --- a/ui/views/controls/menu/menu_separator_win.cc +++ b/ui/views/controls/menu/menu_separator_win.cc @@ -9,7 +9,7 @@ #include <Vssym32.h> #include "ui/gfx/canvas.h" -#include "ui/gfx/native_theme.h" +#include "ui/base/native_theme/native_theme.h" #include "ui/gfx/rect.h" #include "ui/views/controls/menu/menu_config.h" #include "ui/views/controls/menu/menu_item_view.h" @@ -20,24 +20,24 @@ void MenuSeparator::OnPaint(gfx::Canvas* canvas) { const MenuConfig& config = MenuConfig::instance(); // The gutter is rendered before the background. int start_x = 0; - const gfx::NativeTheme* theme = gfx::NativeTheme::instance(); + const ui::NativeTheme* theme = ui::NativeTheme::instance(); 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. gfx::Rect gutter_bounds(MenuItemView::label_start() - config.gutter_to_label - config.gutter_width, 0, config.gutter_width, height()); - gfx::NativeTheme::ExtraParams extra; - theme->Paint(canvas->sk_canvas(), gfx::NativeTheme::kMenuPopupGutter, - gfx::NativeTheme::kNormal, gutter_bounds, extra); + ui::NativeTheme::ExtraParams extra; + theme->Paint(canvas->sk_canvas(), ui::NativeTheme::kMenuPopupGutter, + ui::NativeTheme::kNormal, gutter_bounds, extra); start_x = gutter_bounds.x() + config.gutter_width; } gfx::Rect separator_bounds(start_x, 0, width(), height()); - gfx::NativeTheme::ExtraParams extra; + ui::NativeTheme::ExtraParams extra; extra.menu_separator.has_gutter = config.render_gutter; - theme->Paint(canvas->sk_canvas(), gfx::NativeTheme::kMenuPopupSeparator, - gfx::NativeTheme::kNormal, separator_bounds, extra); + theme->Paint(canvas->sk_canvas(), ui::NativeTheme::kMenuPopupSeparator, + ui::NativeTheme::kNormal, separator_bounds, extra); } gfx::Size MenuSeparator::GetPreferredSize() { diff --git a/ui/views/controls/menu/native_menu_win.cc b/ui/views/controls/menu/native_menu_win.cc index ba60cab..8a9ab0c 100644 --- a/ui/views/controls/menu/native_menu_win.cc +++ b/ui/views/controls/menu/native_menu_win.cc @@ -21,13 +21,13 @@ #include "ui/base/win/hwnd_util.h" #include "ui/gfx/canvas.h" #include "ui/gfx/font.h" -#include "ui/gfx/native_theme.h" +#include "ui/base/native_theme/native_theme.h" #include "ui/gfx/rect.h" #include "ui/views/controls/menu/menu_2.h" #include "ui/views/controls/menu/menu_config.h" #include "ui/views/controls/menu/menu_listener.h" -using gfx::NativeTheme; +using ui::NativeTheme; namespace views { diff --git a/ui/views/controls/scrollbar/native_scroll_bar_views.cc b/ui/views/controls/scrollbar/native_scroll_bar_views.cc index 7eb2a08..72f47c3 100644 --- a/ui/views/controls/scrollbar/native_scroll_bar_views.cc +++ b/ui/views/controls/scrollbar/native_scroll_bar_views.cc @@ -41,9 +41,9 @@ class ScrollBarButton : public BaseScrollBarButton { virtual void OnPaint(gfx::Canvas* canvas) OVERRIDE; private: - gfx::NativeTheme::ExtraParams GetNativeThemeParams() const; - gfx::NativeTheme::Part GetNativeThemePart() const; - gfx::NativeTheme::State GetNativeThemeState() const; + ui::NativeTheme::ExtraParams GetNativeThemeParams() const; + ui::NativeTheme::Part GetNativeThemePart() const; + ui::NativeTheme::State GetNativeThemeState() const; Type type_; }; @@ -63,9 +63,9 @@ class ScrollBarThumb : public BaseScrollBarThumb { virtual void OnPaint(gfx::Canvas* canvas) OVERRIDE; private: - gfx::NativeTheme::ExtraParams GetNativeThemeParams() const; - gfx::NativeTheme::Part GetNativeThemePart() const; - gfx::NativeTheme::State GetNativeThemeState() const; + ui::NativeTheme::ExtraParams GetNativeThemeParams() const; + ui::NativeTheme::Part GetNativeThemePart() const; + ui::NativeTheme::State GetNativeThemeState() const; ScrollBar* scroll_bar_; }; @@ -86,22 +86,22 @@ ScrollBarButton::~ScrollBarButton() { } gfx::Size ScrollBarButton::GetPreferredSize() { - const gfx::NativeTheme* native_theme = gfx::NativeTheme::instance(); + const ui::NativeTheme* native_theme = ui::NativeTheme::instance(); return native_theme->GetPartSize(GetNativeThemePart(), GetNativeThemeState(), GetNativeThemeParams()); } void ScrollBarButton::OnPaint(gfx::Canvas* canvas) { - const gfx::NativeTheme* native_theme = gfx::NativeTheme::instance(); + const ui::NativeTheme* native_theme = ui::NativeTheme::instance(); gfx::Rect bounds(GetPreferredSize()); native_theme->Paint(canvas->sk_canvas(), GetNativeThemePart(), GetNativeThemeState(), bounds, GetNativeThemeParams()); } -gfx::NativeTheme::ExtraParams +ui::NativeTheme::ExtraParams ScrollBarButton::GetNativeThemeParams() const { - gfx::NativeTheme::ExtraParams params; + ui::NativeTheme::ExtraParams params; switch (state_) { case CustomButton::BS_HOT: @@ -115,39 +115,39 @@ gfx::NativeTheme::ExtraParams return params; } -gfx::NativeTheme::Part +ui::NativeTheme::Part ScrollBarButton::GetNativeThemePart() const { switch (type_) { case UP: - return gfx::NativeTheme::kScrollbarUpArrow; + return ui::NativeTheme::kScrollbarUpArrow; case DOWN: - return gfx::NativeTheme::kScrollbarDownArrow; + return ui::NativeTheme::kScrollbarDownArrow; case LEFT: - return gfx::NativeTheme::kScrollbarLeftArrow; + return ui::NativeTheme::kScrollbarLeftArrow; case RIGHT: - return gfx::NativeTheme::kScrollbarRightArrow; + return ui::NativeTheme::kScrollbarRightArrow; default: - return gfx::NativeTheme::kScrollbarUpArrow; + return ui::NativeTheme::kScrollbarUpArrow; } } -gfx::NativeTheme::State +ui::NativeTheme::State ScrollBarButton::GetNativeThemeState() const { - gfx::NativeTheme::State state; + ui::NativeTheme::State state; switch (state_) { case CustomButton::BS_HOT: - state = gfx::NativeTheme::kHovered; + state = ui::NativeTheme::kHovered; break; case CustomButton::BS_PUSHED: - state = gfx::NativeTheme::kPressed; + state = ui::NativeTheme::kPressed; break; case CustomButton::BS_DISABLED: - state = gfx::NativeTheme::kDisabled; + state = ui::NativeTheme::kDisabled; break; case CustomButton::BS_NORMAL: default: - state = gfx::NativeTheme::kNormal; + state = ui::NativeTheme::kNormal; break; } @@ -168,14 +168,14 @@ ScrollBarThumb::~ScrollBarThumb() { } gfx::Size ScrollBarThumb::GetPreferredSize() { - const gfx::NativeTheme* native_theme = gfx::NativeTheme::instance(); + const ui::NativeTheme* native_theme = ui::NativeTheme::instance(); return native_theme->GetPartSize(GetNativeThemePart(), GetNativeThemeState(), GetNativeThemeParams()); } void ScrollBarThumb::OnPaint(gfx::Canvas* canvas) { - const gfx::NativeTheme* native_theme = gfx::NativeTheme::instance(); + const ui::NativeTheme* native_theme = ui::NativeTheme::instance(); native_theme->Paint(canvas->sk_canvas(), GetNativeThemePart(), @@ -184,9 +184,9 @@ void ScrollBarThumb::OnPaint(gfx::Canvas* canvas) { GetNativeThemeParams()); } -gfx::NativeTheme::ExtraParams +ui::NativeTheme::ExtraParams ScrollBarThumb::GetNativeThemeParams() const { - gfx::NativeTheme::ExtraParams params; + ui::NativeTheme::ExtraParams params; switch (GetState()) { case CustomButton::BS_HOT: @@ -200,28 +200,28 @@ gfx::NativeTheme::ExtraParams return params; } -gfx::NativeTheme::Part ScrollBarThumb::GetNativeThemePart() const { +ui::NativeTheme::Part ScrollBarThumb::GetNativeThemePart() const { if (scroll_bar_->IsHorizontal()) - return gfx::NativeTheme::kScrollbarHorizontalThumb; - return gfx::NativeTheme::kScrollbarVerticalThumb; + return ui::NativeTheme::kScrollbarHorizontalThumb; + return ui::NativeTheme::kScrollbarVerticalThumb; } -gfx::NativeTheme::State ScrollBarThumb::GetNativeThemeState() const { - gfx::NativeTheme::State state; +ui::NativeTheme::State ScrollBarThumb::GetNativeThemeState() const { + ui::NativeTheme::State state; switch (GetState()) { case CustomButton::BS_HOT: - state = gfx::NativeTheme::kHovered; + state = ui::NativeTheme::kHovered; break; case CustomButton::BS_PUSHED: - state = gfx::NativeTheme::kPressed; + state = ui::NativeTheme::kPressed; break; case CustomButton::BS_DISABLED: - state = gfx::NativeTheme::kDisabled; + state = ui::NativeTheme::kDisabled; break; case CustomButton::BS_NORMAL: default: - state = gfx::NativeTheme::kNormal; + state = ui::NativeTheme::kNormal; break; } @@ -246,15 +246,15 @@ NativeScrollBarViews::NativeScrollBarViews(NativeScrollBar* scroll_bar) prev_button_ = new ScrollBarButton(this, ScrollBarButton::LEFT); next_button_ = new ScrollBarButton(this, ScrollBarButton::RIGHT); - part_ = gfx::NativeTheme::kScrollbarHorizontalTrack; + part_ = ui::NativeTheme::kScrollbarHorizontalTrack; } else { prev_button_ = new ScrollBarButton(this, ScrollBarButton::UP); next_button_ = new ScrollBarButton(this, ScrollBarButton::DOWN); - part_ = gfx::NativeTheme::kScrollbarVerticalTrack; + part_ = ui::NativeTheme::kScrollbarVerticalTrack; } - state_ = gfx::NativeTheme::kNormal; + state_ = ui::NativeTheme::kNormal; AddChildView(prev_button_); AddChildView(next_button_); @@ -285,7 +285,7 @@ void NativeScrollBarViews::Layout() { } void NativeScrollBarViews::OnPaint(gfx::Canvas* canvas) { - const gfx::NativeTheme* native_theme = gfx::NativeTheme::instance(); + const ui::NativeTheme* native_theme = ui::NativeTheme::instance(); gfx::Rect bounds = GetTrackBounds(); if (bounds.IsEmpty()) @@ -386,20 +386,20 @@ NativeScrollBarWrapper* NativeScrollBarWrapper::CreateWrapper( // static int NativeScrollBarWrapper::GetHorizontalScrollBarHeight() { - const gfx::NativeTheme* native_theme = gfx::NativeTheme::instance(); + const ui::NativeTheme* native_theme = ui::NativeTheme::instance(); - gfx::NativeTheme::ExtraParams button_params; + ui::NativeTheme::ExtraParams button_params; button_params.scrollbar_arrow.is_hovering = false; gfx::Size button_size = native_theme->GetPartSize( - gfx::NativeTheme::kScrollbarLeftArrow, - gfx::NativeTheme::kNormal, + ui::NativeTheme::kScrollbarLeftArrow, + ui::NativeTheme::kNormal, button_params); - gfx::NativeTheme::ExtraParams thumb_params; + ui::NativeTheme::ExtraParams thumb_params; thumb_params.scrollbar_thumb.is_hovering = false; gfx::Size track_size = native_theme->GetPartSize( - gfx::NativeTheme::kScrollbarHorizontalThumb, - gfx::NativeTheme::kNormal, + ui::NativeTheme::kScrollbarHorizontalThumb, + ui::NativeTheme::kNormal, thumb_params); return std::max(track_size.height(), button_size.height()); @@ -407,20 +407,20 @@ int NativeScrollBarWrapper::GetHorizontalScrollBarHeight() { // static int NativeScrollBarWrapper::GetVerticalScrollBarWidth() { - const gfx::NativeTheme* native_theme = gfx::NativeTheme::instance(); + const ui::NativeTheme* native_theme = ui::NativeTheme::instance(); - gfx::NativeTheme::ExtraParams button_params; + ui::NativeTheme::ExtraParams button_params; button_params.scrollbar_arrow.is_hovering = false; gfx::Size button_size = native_theme->GetPartSize( - gfx::NativeTheme::kScrollbarUpArrow, - gfx::NativeTheme::kNormal, + ui::NativeTheme::kScrollbarUpArrow, + ui::NativeTheme::kNormal, button_params); - gfx::NativeTheme::ExtraParams thumb_params; + ui::NativeTheme::ExtraParams thumb_params; thumb_params.scrollbar_thumb.is_hovering = false; gfx::Size track_size = native_theme->GetPartSize( - gfx::NativeTheme::kScrollbarVerticalThumb, - gfx::NativeTheme::kNormal, + ui::NativeTheme::kScrollbarVerticalThumb, + ui::NativeTheme::kNormal, thumb_params); return std::max(track_size.width(), button_size.width()); diff --git a/ui/views/controls/scrollbar/native_scroll_bar_views.h b/ui/views/controls/scrollbar/native_scroll_bar_views.h index 136338c..0335e7f 100644 --- a/ui/views/controls/scrollbar/native_scroll_bar_views.h +++ b/ui/views/controls/scrollbar/native_scroll_bar_views.h @@ -1,4 +1,4 @@ -// Copyright (c) 2011 The Chromium Authors. All rights reserved. +// Copyright (c) 2012 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -7,7 +7,7 @@ #pragma once #include "base/compiler_specific.h" -#include "ui/gfx/native_theme.h" +#include "ui/base/native_theme/native_theme.h" #include "ui/gfx/point.h" #include "ui/views/controls/button/button.h" #include "ui/views/controls/scrollbar/base_scroll_bar.h" @@ -69,9 +69,9 @@ class VIEWS_EXPORT NativeScrollBarViews : public BaseScrollBar, Button* prev_button_; Button* next_button_; - gfx::NativeTheme::ExtraParams params_; - gfx::NativeTheme::Part part_; - gfx::NativeTheme::State state_; + ui::NativeTheme::ExtraParams params_; + ui::NativeTheme::Part part_; + ui::NativeTheme::State state_; DISALLOW_COPY_AND_ASSIGN(NativeScrollBarViews); }; diff --git a/ui/views/controls/tabbed_pane/native_tabbed_pane_win.cc b/ui/views/controls/tabbed_pane/native_tabbed_pane_win.cc index f6924ef3..ae762f3 100644 --- a/ui/views/controls/tabbed_pane/native_tabbed_pane_win.cc +++ b/ui/views/controls/tabbed_pane/native_tabbed_pane_win.cc @@ -13,7 +13,7 @@ #include "ui/base/win/hwnd_util.h" #include "ui/gfx/canvas.h" #include "ui/gfx/font.h" -#include "ui/gfx/native_theme_win.h" +#include "ui/base/native_theme/native_theme_win.h" #include "ui/views/controls/tabbed_pane/tabbed_pane.h" #include "ui/views/controls/tabbed_pane/tabbed_pane_listener.h" #include "ui/views/layout/fill_layout.h" @@ -30,8 +30,8 @@ class TabBackground : public Background { // TMT_FILLCOLORHINT returns a color value that supposedly // approximates the texture drawn by PaintTabPanelBackground. SkColor tab_page_color = - gfx::NativeThemeWin::instance()->GetThemeColorWithDefault( - gfx::NativeThemeWin::TAB, TABP_BODY, 0, TMT_FILLCOLORHINT, + ui::NativeThemeWin::instance()->GetThemeColorWithDefault( + ui::NativeThemeWin::TAB, TABP_BODY, 0, TMT_FILLCOLORHINT, COLOR_3DFACE); SetNativeControlColor(tab_page_color); } @@ -39,10 +39,10 @@ class TabBackground : public Background { virtual void Paint(gfx::Canvas* canvas, View* view) const { gfx::Rect r(0, 0, view->width(), view->height()); - gfx::NativeTheme::ExtraParams extra; - gfx::NativeTheme::instance()->Paint( - canvas->sk_canvas(), gfx::NativeTheme::kTabPanelBackground, - gfx::NativeTheme::kNormal, r, extra); + ui::NativeTheme::ExtraParams extra; + ui::NativeTheme::instance()->Paint( + canvas->sk_canvas(), ui::NativeTheme::kTabPanelBackground, + ui::NativeTheme::kNormal, r, extra); } private: diff --git a/ui/views/controls/table/table_view_views.cc b/ui/views/controls/table/table_view_views.cc index 161d21c..365f81ba 100644 --- a/ui/views/controls/table/table_view_views.cc +++ b/ui/views/controls/table/table_view_views.cc @@ -8,7 +8,7 @@ #include "third_party/skia/include/core/SkBitmap.h" #include "ui/base/models/table_model.h" #include "ui/gfx/canvas.h" -#include "ui/gfx/native_theme.h" +#include "ui/base/native_theme/native_theme.h" #include "ui/gfx/skia_util.h" #include "ui/views/border.h" #include "ui/views/controls/scroll_view.h" @@ -73,8 +73,8 @@ View* TableView::CreateParentIfNecessary() { ScrollView* scroll_view = new ScrollView; scroll_view->SetContents(this); scroll_view->set_border(Border::CreateSolidBorder( - 1, gfx::NativeTheme::instance()->GetSystemColor( - gfx::NativeTheme::kColorId_UnfocusedBorderColor))); + 1, ui::NativeTheme::instance()->GetSystemColor( + ui::NativeTheme::kColorId_UnfocusedBorderColor))); return scroll_view; } diff --git a/ui/views/controls/textfield/native_textfield_win.cc b/ui/views/controls/textfield/native_textfield_win.cc index f037923..f6119de7 100644 --- a/ui/views/controls/textfield/native_textfield_win.cc +++ b/ui/views/controls/textfield/native_textfield_win.cc @@ -22,7 +22,7 @@ #include "ui/base/l10n/l10n_util_win.h" #include "ui/base/range/range.h" #include "ui/base/win/mouse_wheel_util.h" -#include "ui/gfx/native_theme_win.h" +#include "ui/base/native_theme/native_theme_win.h" #include "ui/views/controls/label.h" #include "ui/views/controls/menu/menu_item_view.h" #include "ui/views/controls/menu/menu_model_adapter.h" @@ -920,7 +920,7 @@ void NativeTextfieldWin::OnNCPaint(HRGN region) { int classic_state = (!textfield_->enabled() || textfield_->read_only()) ? DFCS_INACTIVE : 0; - gfx::NativeThemeWin::instance()->PaintTextField(hdc, part, state, + ui::NativeThemeWin::instance()->PaintTextField(hdc, part, state, classic_state, &window_rect, bg_color_, false, true); diff --git a/ui/views/controls/textfield/textfield_views_model.cc b/ui/views/controls/textfield/textfield_views_model.cc index a931a16..6d8dd76 100644 --- a/ui/views/controls/textfield/textfield_views_model.cc +++ b/ui/views/controls/textfield/textfield_views_model.cc @@ -16,7 +16,7 @@ #include "ui/base/text/utf16_indexing.h" #include "ui/gfx/canvas.h" #include "ui/gfx/font.h" -#include "ui/gfx/native_theme.h" +#include "ui/base/native_theme/native_theme.h" #include "ui/gfx/render_text.h" #include "ui/views/controls/textfield/textfield.h" #include "ui/views/views_delegate.h" @@ -284,16 +284,16 @@ TextfieldViewsModel::TextfieldViewsModel(Delegate* delegate) : delegate_(delegate), render_text_(gfx::RenderText::CreateRenderText()), current_edit_(edit_history_.end()) { - const gfx::NativeTheme* theme = gfx::NativeTheme::instance(); + const ui::NativeTheme* theme = ui::NativeTheme::instance(); render_text_->set_selection_color( theme->GetSystemColor( - gfx::NativeTheme::kColorId_TextfieldSelectionColor)); + ui::NativeTheme::kColorId_TextfieldSelectionColor)); render_text_->set_selection_background_focused_color( theme->GetSystemColor( - gfx::NativeTheme::kColorId_TextfieldSelectionBackgroundFocused)); + ui::NativeTheme::kColorId_TextfieldSelectionBackgroundFocused)); render_text_->set_selection_background_unfocused_color( theme->GetSystemColor( - gfx::NativeTheme::kColorId_TextfieldSelectionBackgroundUnfocused)); + ui::NativeTheme::kColorId_TextfieldSelectionBackgroundUnfocused)); } TextfieldViewsModel::~TextfieldViewsModel() { diff --git a/ui/views/controls/tree/tree_view_views.cc b/ui/views/controls/tree/tree_view_views.cc index 92a6c2b..524b763 100644 --- a/ui/views/controls/tree/tree_view_views.cc +++ b/ui/views/controls/tree/tree_view_views.cc @@ -14,7 +14,7 @@ #include "ui/base/resource/resource_bundle.h" #include "ui/gfx/canvas.h" #include "ui/gfx/image/image.h" -#include "ui/gfx/native_theme.h" +#include "ui/base/native_theme/native_theme.h" #include "ui/gfx/skia_util.h" #include "ui/views/background.h" #include "ui/views/border.h" @@ -81,8 +81,8 @@ View* TreeView::CreateParentIfNecessary() { ScrollView* scroll_view = new ScrollView; scroll_view->SetContents(this); scroll_view->set_border(Border::CreateSolidBorder( - 1, gfx::NativeTheme::instance()->GetSystemColor( - gfx::NativeTheme::kColorId_UnfocusedBorderColor))); + 1, ui::NativeTheme::instance()->GetSystemColor( + ui::NativeTheme::kColorId_UnfocusedBorderColor))); return scroll_view; } diff --git a/ui/views/examples/native_theme_button_example.cc b/ui/views/examples/native_theme_button_example.cc index c8a5e59..ad42754 100644 --- a/ui/views/examples/native_theme_button_example.cc +++ b/ui/views/examples/native_theme_button_example.cc @@ -63,14 +63,14 @@ ExampleNativeThemeButton::~ExampleNativeThemeButton() { std::string ExampleNativeThemeButton::MessWithState() { const char* message = NULL; switch (GetThemePart()) { - case gfx::NativeTheme::kPushButton: + case ui::NativeTheme::kPushButton: message = "Pressed! count:%d"; break; - case gfx::NativeTheme::kRadio: + case ui::NativeTheme::kRadio: is_checked_ = !is_checked_; message = is_checked_ ? "Checked! count:%d" : "Unchecked! count:%d"; break; - case gfx::NativeTheme::kCheckbox: + case ui::NativeTheme::kCheckbox: if (is_indeterminate_) { is_checked_ = false; is_indeterminate_ = false; @@ -98,24 +98,24 @@ void ExampleNativeThemeButton::OnSelectedIndexChanged(Combobox* combobox) { SchedulePaint(); } -gfx::NativeTheme::Part ExampleNativeThemeButton::GetThemePart() const { +ui::NativeTheme::Part ExampleNativeThemeButton::GetThemePart() const { switch (cb_part_->selected_index()) { case 0: - return gfx::NativeTheme::kPushButton; + return ui::NativeTheme::kPushButton; case 1: - return gfx::NativeTheme::kRadio; + return ui::NativeTheme::kRadio; case 2: - return gfx::NativeTheme::kCheckbox; + return ui::NativeTheme::kCheckbox; default: NOTREACHED(); } - return gfx::NativeTheme::kPushButton; + return ui::NativeTheme::kPushButton; } gfx::Rect ExampleNativeThemeButton::GetThemePaintRect() const { - gfx::NativeTheme::ExtraParams extra; - gfx::NativeTheme::State state = GetThemeState(&extra); - gfx::Size size(gfx::NativeTheme::instance()->GetPartSize(GetThemePart(), + ui::NativeTheme::ExtraParams extra; + ui::NativeTheme::State state = GetThemeState(&extra); + gfx::Size size(ui::NativeTheme::instance()->GetPartSize(GetThemePart(), state, extra)); gfx::Rect rect(size); @@ -123,21 +123,21 @@ gfx::Rect ExampleNativeThemeButton::GetThemePaintRect() const { return rect; } -gfx::NativeTheme::State ExampleNativeThemeButton::GetThemeState( - gfx::NativeTheme::ExtraParams* params) const { +ui::NativeTheme::State ExampleNativeThemeButton::GetThemeState( + ui::NativeTheme::ExtraParams* params) const { GetExtraParams(params); int selected = cb_state_->selected_index(); if (selected > 3) { switch (state()) { case BS_DISABLED: - return gfx::NativeTheme::kDisabled; + return ui::NativeTheme::kDisabled; case BS_NORMAL: - return gfx::NativeTheme::kNormal; + return ui::NativeTheme::kNormal; case BS_HOT: - return gfx::NativeTheme::kHovered; + return ui::NativeTheme::kHovered; case BS_PUSHED: - return gfx::NativeTheme::kPressed; + return ui::NativeTheme::kPressed; default: NOTREACHED(); } @@ -145,21 +145,21 @@ gfx::NativeTheme::State ExampleNativeThemeButton::GetThemeState( switch (selected) { case 0: - return gfx::NativeTheme::kDisabled; + return ui::NativeTheme::kDisabled; case 1: - return gfx::NativeTheme::kNormal; + return ui::NativeTheme::kNormal; case 2: - return gfx::NativeTheme::kHovered; + return ui::NativeTheme::kHovered; case 3: - return gfx::NativeTheme::kPressed; + return ui::NativeTheme::kPressed; default: NOTREACHED(); } - return gfx::NativeTheme::kNormal; + return ui::NativeTheme::kNormal; } void ExampleNativeThemeButton::GetExtraParams( - gfx::NativeTheme::ExtraParams* params) const { + ui::NativeTheme::ExtraParams* params) const { params->button.checked = is_checked_; params->button.indeterminate = is_indeterminate_; @@ -173,16 +173,16 @@ const ui::Animation* ExampleNativeThemeButton::GetThemeAnimation() const { return cb_state_->selected_index() <= 3 ? NULL : hover_animation_.get(); } -gfx::NativeTheme::State ExampleNativeThemeButton::GetBackgroundThemeState( - gfx::NativeTheme::ExtraParams* params) const { +ui::NativeTheme::State ExampleNativeThemeButton::GetBackgroundThemeState( + ui::NativeTheme::ExtraParams* params) const { GetExtraParams(params); - return gfx::NativeTheme::kNormal; + return ui::NativeTheme::kNormal; } -gfx::NativeTheme::State ExampleNativeThemeButton::GetForegroundThemeState( - gfx::NativeTheme::ExtraParams* params) const { +ui::NativeTheme::State ExampleNativeThemeButton::GetForegroundThemeState( + ui::NativeTheme::ExtraParams* params) const { GetExtraParams(params); - return gfx::NativeTheme::kHovered; + return ui::NativeTheme::kHovered; } gfx::Size ExampleNativeThemeButton::GetPreferredSize() { diff --git a/ui/views/examples/native_theme_button_example.h b/ui/views/examples/native_theme_button_example.h index e77038e..2bc940c 100644 --- a/ui/views/examples/native_theme_button_example.h +++ b/ui/views/examples/native_theme_button_example.h @@ -10,7 +10,7 @@ #include "base/basictypes.h" #include "base/memory/scoped_ptr.h" -#include "ui/gfx/native_theme.h" +#include "ui/base/native_theme/native_theme.h" #include "ui/views/controls/button/custom_button.h" #include "ui/views/controls/combobox/combobox_listener.h" #include "ui/views/examples/example_base.h" @@ -45,17 +45,17 @@ class ExampleNativeThemeButton : public CustomButton, virtual void OnSelectedIndexChanged(Combobox* combobox) OVERRIDE; // Overridden from NativeThemeDelegate: - virtual gfx::NativeTheme::Part GetThemePart() const OVERRIDE; + virtual ui::NativeTheme::Part GetThemePart() const OVERRIDE; virtual gfx::Rect GetThemePaintRect() const OVERRIDE; - virtual gfx::NativeTheme::State GetThemeState( - gfx::NativeTheme::ExtraParams* params) const OVERRIDE; + virtual ui::NativeTheme::State GetThemeState( + ui::NativeTheme::ExtraParams* params) const OVERRIDE; virtual const ui::Animation* GetThemeAnimation() const OVERRIDE; - virtual gfx::NativeTheme::State GetBackgroundThemeState( - gfx::NativeTheme::ExtraParams* params) const OVERRIDE; - virtual gfx::NativeTheme::State GetForegroundThemeState( - gfx::NativeTheme::ExtraParams* params) const OVERRIDE; + virtual ui::NativeTheme::State GetBackgroundThemeState( + ui::NativeTheme::ExtraParams* params) const OVERRIDE; + virtual ui::NativeTheme::State GetForegroundThemeState( + ui::NativeTheme::ExtraParams* params) const OVERRIDE; - void GetExtraParams(gfx::NativeTheme::ExtraParams* params) const; + void GetExtraParams(ui::NativeTheme::ExtraParams* params) const; scoped_ptr<NativeThemePainter> painter_; Combobox* cb_part_; diff --git a/ui/views/examples/native_theme_checkbox_example.h b/ui/views/examples/native_theme_checkbox_example.h index 6ff0869..9df0ef5 100644 --- a/ui/views/examples/native_theme_checkbox_example.h +++ b/ui/views/examples/native_theme_checkbox_example.h @@ -1,4 +1,4 @@ -// Copyright (c) 2011 The Chromium Authors. All rights reserved. +// Copyright (c) 2012 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -7,7 +7,7 @@ #pragma once #include "base/basictypes.h" -#include "ui/gfx/native_theme.h" +#include "ui/base/native_theme/native_theme.h" #include "ui/views/controls/button/button.h" #include "ui/views/examples/example_base.h" diff --git a/ui/views/native_theme_delegate.h b/ui/views/native_theme_delegate.h index bd6051e..9f2945d 100644 --- a/ui/views/native_theme_delegate.h +++ b/ui/views/native_theme_delegate.h @@ -1,4 +1,4 @@ -// Copyright (c) 2011 The Chromium Authors. All rights reserved. +// Copyright (c) 2012 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -6,7 +6,7 @@ #define UI_VIEWS_NATIVE_THEME_DELEGATE_H_ #pragma once -#include "ui/gfx/native_theme.h" +#include "ui/base/native_theme/native_theme.h" #include "ui/gfx/rect.h" #include "ui/views/views_export.h" @@ -24,28 +24,28 @@ class VIEWS_EXPORT NativeThemeDelegate { virtual ~NativeThemeDelegate() {} // Get the native theme part that should be drawn. - virtual gfx::NativeTheme::Part GetThemePart() const = 0; + virtual ui::NativeTheme::Part GetThemePart() const = 0; // Get the rectangle that should be painted. virtual gfx::Rect GetThemePaintRect() const = 0; // Get the state of the part, along with any extra data needed for drawing. - virtual gfx::NativeTheme::State GetThemeState( - gfx::NativeTheme::ExtraParams* params) const = 0; + virtual ui::NativeTheme::State GetThemeState( + ui::NativeTheme::ExtraParams* params) const = 0; // If the native theme drawign should be animated, return the Animation object // that controlls it. If no animation is ongoing, NULL may be returned. virtual const ui::Animation* GetThemeAnimation() const = 0; // If animation is onging, this returns the background native theme state. - virtual gfx::NativeTheme::State GetBackgroundThemeState( - gfx::NativeTheme::ExtraParams* params) const = 0; + virtual ui::NativeTheme::State GetBackgroundThemeState( + ui::NativeTheme::ExtraParams* params) const = 0; // If animation is onging, this returns the foreground native theme state. // This state will be composited over the background using an alpha value // based on the current value of the animation. - virtual gfx::NativeTheme::State GetForegroundThemeState( - gfx::NativeTheme::ExtraParams* params) const = 0; + virtual ui::NativeTheme::State GetForegroundThemeState( + ui::NativeTheme::ExtraParams* params) const = 0; }; } // namespace views diff --git a/ui/views/native_theme_painter.cc b/ui/views/native_theme_painter.cc index 454ed3d..8acb532 100644 --- a/ui/views/native_theme_painter.cc +++ b/ui/views/native_theme_painter.cc @@ -18,36 +18,36 @@ NativeThemePainter::NativeThemePainter(NativeThemeDelegate* delegate) } gfx::Size NativeThemePainter::GetPreferredSize() { - const gfx::NativeTheme* theme = gfx::NativeTheme::instance(); - gfx::NativeTheme::ExtraParams extra; - gfx::NativeTheme::State state = delegate_->GetThemeState(&extra); + const ui::NativeTheme* theme = ui::NativeTheme::instance(); + ui::NativeTheme::ExtraParams extra; + ui::NativeTheme::State state = delegate_->GetThemeState(&extra); return theme->GetPartSize(delegate_->GetThemePart(), state, extra); } void NativeThemePainter::Paint(gfx::Canvas* canvas, const gfx::Size& size) { - const gfx::NativeTheme* native_theme = gfx::NativeTheme::instance(); - gfx::NativeTheme::Part part = delegate_->GetThemePart(); + const ui::NativeTheme* native_theme = ui::NativeTheme::instance(); + ui::NativeTheme::Part part = delegate_->GetThemePart(); gfx::Rect rect(size); if (delegate_->GetThemeAnimation() != NULL && delegate_->GetThemeAnimation()->is_animating()) { // Paint background state. - gfx::NativeTheme::ExtraParams prev_extra; - gfx::NativeTheme::State prev_state = + ui::NativeTheme::ExtraParams prev_extra; + ui::NativeTheme::State prev_state = delegate_->GetBackgroundThemeState(&prev_extra); native_theme->Paint(canvas->sk_canvas(), part, prev_state, rect, prev_extra); // Composite foreground state above it. - gfx::NativeTheme::ExtraParams extra; - gfx::NativeTheme::State state = delegate_->GetForegroundThemeState(&extra); + ui::NativeTheme::ExtraParams extra; + ui::NativeTheme::State state = delegate_->GetForegroundThemeState(&extra); int alpha = delegate_->GetThemeAnimation()->CurrentValueBetween(0, 255); canvas->SaveLayerAlpha(static_cast<uint8>(alpha)); native_theme->Paint(canvas->sk_canvas(), part, state, rect, extra); canvas->Restore(); } else { - gfx::NativeTheme::ExtraParams extra; - gfx::NativeTheme::State state = delegate_->GetThemeState(&extra); + ui::NativeTheme::ExtraParams extra; + ui::NativeTheme::State state = delegate_->GetThemeState(&extra); native_theme->Paint(canvas->sk_canvas(), part, state, rect, extra); } } diff --git a/ui/views/widget/native_widget_win.cc b/ui/views/widget/native_widget_win.cc index 975b905..bb4e1f33 100644 --- a/ui/views/widget/native_widget_win.cc +++ b/ui/views/widget/native_widget_win.cc @@ -29,7 +29,7 @@ #include "ui/gfx/canvas_paint.h" #include "ui/gfx/canvas_skia_paint.h" #include "ui/gfx/icon_util.h" -#include "ui/gfx/native_theme_win.h" +#include "ui/base/native_theme/native_theme_win.h" #include "ui/gfx/path.h" #include "ui/gfx/screen.h" #include "ui/views/accessibility/native_view_accessibility_win.h" @@ -2036,7 +2036,7 @@ void NativeWidgetWin::OnSysCommand(UINT notification_code, CPoint click) { void NativeWidgetWin::OnThemeChanged() { // Notify NativeThemeWin. - gfx::NativeThemeWin::instance()->CloseHandles(); + ui::NativeThemeWin::instance()->CloseHandles(); } void NativeWidgetWin::OnVScroll(int scroll_type, diff --git a/ui/views/window/dialog_client_view.cc b/ui/views/window/dialog_client_view.cc index 5a43622..1cf1d670 100644 --- a/ui/views/window/dialog_client_view.cc +++ b/ui/views/window/dialog_client_view.cc @@ -22,7 +22,7 @@ #include "ui/base/resource/resource_bundle.h" #include "ui/gfx/canvas.h" #include "ui/gfx/font.h" -#include "ui/gfx/native_theme.h" +#include "ui/base/native_theme/native_theme.h" #include "ui/views/controls/button/text_button.h" #include "ui/views/layout/layout_constants.h" #include "ui/views/widget/root_view.h" @@ -294,8 +294,8 @@ const DialogClientView* DialogClientView::AsDialogClientView() const { // DialogClientView, View overrides: void DialogClientView::OnPaint(gfx::Canvas* canvas) { - SkColor bg_color = gfx::NativeTheme::instance()->GetSystemColor( - gfx::NativeTheme::kColorId_DialogBackground); + SkColor bg_color = ui::NativeTheme::instance()->GetSystemColor( + ui::NativeTheme::kColorId_DialogBackground); canvas->FillRect(GetLocalBounds(), bg_color); } @@ -391,10 +391,9 @@ void DialogClientView::PaintSizeBox(gfx::Canvas* canvas) { if (GetWidget()->widget_delegate()->CanResize() || GetWidget()->widget_delegate()->CanMaximize()) { #if defined(OS_WIN) - gfx::NativeTheme::ExtraParams extra; - gfx::Size gripper_size = gfx::NativeTheme::instance()->GetPartSize( - gfx::NativeTheme::kWindowResizeGripper, gfx::NativeTheme::kNormal, - extra); + ui::NativeTheme::ExtraParams extra; + gfx::Size gripper_size = ui::NativeTheme::instance()->GetPartSize( + ui::NativeTheme::kWindowResizeGripper, ui::NativeTheme::kNormal, extra); // TODO(beng): (http://b/1085509) In "classic" rendering mode, there isn't // a theme-supplied gripper. We should probably improvise @@ -404,11 +403,11 @@ void DialogClientView::PaintSizeBox(gfx::Canvas* canvas) { size_box_bounds_.set_x(size_box_bounds_.right() - gripper_size.width()); size_box_bounds_.set_y(size_box_bounds_.bottom() - gripper_size.height()); - gfx::NativeTheme::instance()->Paint(canvas->sk_canvas(), - gfx::NativeTheme::kWindowResizeGripper, - gfx::NativeTheme::kNormal, - size_box_bounds_, - extra); + ui::NativeTheme::instance()->Paint(canvas->sk_canvas(), + ui::NativeTheme::kWindowResizeGripper, + ui::NativeTheme::kNormal, + size_box_bounds_, + extra); #else NOTIMPLEMENTED(); // TODO(port): paint size box |