Skip to content

Commit

Permalink
ui: Move NativeTheme files into ui/base/native_theme/ directory.
Browse files Browse the repository at this point in the history
BUG=103304,125844
R=ben@chromium.org
TBR=tony@chromium.org

Committed: https://src.chromium.org/viewvc/chrome?view=rev&revision=136996

Review URL: https://chromiumcodereview.appspot.com/10310136

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@137056 0039d316-1c4b-4281-b951-d872f2087c98
  • Loading branch information
tfarina@chromium.org committed May 15, 2012
1 parent 2534b2d commit f78452f
Show file tree
Hide file tree
Showing 56 changed files with 716 additions and 709 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
#include "ui/base/text/text_elider.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"

namespace {

Expand Down Expand Up @@ -142,11 +142,11 @@ SkColor AutocompleteResultView::GetColor(ResultViewState state,
colors[NORMAL][TEXT] = color_utils::GetSysSkColor(COLOR_WINDOWTEXT);
colors[SELECTED][TEXT] = color_utils::GetSysSkColor(COLOR_HIGHLIGHTTEXT);
#elif defined(USE_AURA)
const gfx::NativeTheme* theme = gfx::NativeTheme::instance();
const ui::NativeTheme* theme = ui::NativeTheme::instance();
colors[SELECTED][BACKGROUND] = theme->GetSystemColor(
gfx::NativeTheme::kColorId_TextfieldSelectionBackgroundFocused);
ui::NativeTheme::kColorId_TextfieldSelectionBackgroundFocused);
colors[NORMAL][BACKGROUND] = theme->GetSystemColor(
gfx::NativeTheme::kColorId_TextfieldDefaultBackground);
ui::NativeTheme::kColorId_TextfieldDefaultBackground);
colors[NORMAL][URL] = SkColorSetARGB(0xff, 0x00, 0x99, 0x33);
colors[SELECTED][URL] = SkColorSetARGB(0xff, 0x00, 0x66, 0x22);
colors[HOVERED][URL] = SkColorSetARGB(0xff, 0x00, 0x66, 0x22);
Expand Down
8 changes: 4 additions & 4 deletions content/renderer/render_view_impl.cc
Original file line number Diff line number Diff line change
Expand Up @@ -186,10 +186,10 @@
#elif defined(OS_WIN)
// TODO(port): these files are currently Windows only because they concern:
// * theming
#include "ui/gfx/native_theme_win.h"
#include "ui/base/native_theme/native_theme_win.h"
#elif defined(USE_X11)
#include "third_party/WebKit/Source/WebKit/chromium/public/linux/WebRenderTheme.h"
#include "ui/gfx/native_theme.h"
#include "ui/base/native_theme/native_theme.h"
#elif defined(OS_MACOSX)
#include "skia/ext/skia_utils_mac.h"
#endif
Expand Down Expand Up @@ -4445,7 +4445,7 @@ void RenderViewImpl::OnSetRendererPrefs(
WebColorName name = WebKit::WebColorWebkitFocusRingColor;
WebKit::setNamedColors(&name, &renderer_prefs.focus_ring_color, 1);
WebKit::setCaretBlinkInterval(renderer_prefs.caret_blink_interval);
gfx::NativeTheme::instance()->SetScrollbarColors(
ui::NativeTheme::instance()->SetScrollbarColors(
renderer_prefs.thumb_inactive_color,
renderer_prefs.thumb_active_color,
renderer_prefs.track_color);
Expand Down Expand Up @@ -4616,7 +4616,7 @@ void RenderViewImpl::OnThemeChanged() {
#if defined(USE_AURA)
// Aura doesn't care if we switch themes.
#elif defined(OS_WIN)
gfx::NativeThemeWin::instance()->CloseHandles();
ui::NativeThemeWin::instance()->CloseHandles();
if (webview())
webview()->themeChanged();
#else // defined(OS_WIN)
Expand Down
1 change: 1 addition & 0 deletions ui/DEPS
Original file line number Diff line number Diff line change
@@ -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",
Expand Down
10 changes: 4 additions & 6 deletions ui/gfx/native_theme.cc → ui/base/native_theme/native_theme.cc
Original file line number Diff line number Diff line change
@@ -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;
Expand All @@ -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
18 changes: 10 additions & 8 deletions ui/gfx/native_theme.h → ui/base/native_theme/native_theme.h
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand All @@ -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
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -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_
Original file line number Diff line number Diff line change
Expand Up @@ -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>

Expand All @@ -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)
Expand Down Expand Up @@ -801,4 +799,4 @@ SkColor NativeThemeAndroid::OutlineColor(SkScalar* hsv1, SkScalar* hsv2) const {
return SaturateAndBrighten(hsv2, -0.2, diff);
}

} // namespace gfx
} // namespace ui
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand All @@ -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,
Expand Down Expand Up @@ -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_
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -49,7 +49,7 @@ const SkColor kTextfieldSelectionColor =

} // namespace

namespace gfx {
namespace ui {

// static
const NativeTheme* NativeTheme::instance() {
Expand Down Expand Up @@ -292,4 +292,4 @@ void NativeThemeAura::PaintScrollbarThumb(SkCanvas* canvas,
}
}

} // namespace gfx
} // namespace ui
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down Expand Up @@ -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_
Original file line number Diff line number Diff line change
Expand Up @@ -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>

Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -970,4 +970,4 @@ SkColor NativeThemeBase::OutlineColor(SkScalar* hsv1, SkScalar* hsv2) const {
return SaturateAndBrighten(hsv2, -0.2f, diff);
}

} // namespace gfx
} // namespace ui
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down Expand Up @@ -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_
Original file line number Diff line number Diff line change
Expand Up @@ -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>

Expand All @@ -29,7 +29,7 @@ const SkColor kTextButtonHoverColor = kTextButtonEnabledColor;

} // namespace

namespace gfx {
namespace ui {

// static
const NativeTheme* NativeTheme::instance() {
Expand Down Expand Up @@ -84,4 +84,4 @@ NativeThemeGtk::NativeThemeGtk() {
NativeThemeGtk::~NativeThemeGtk() {
}

} // namespace gfx
} // namespace ui
Loading

0 comments on commit f78452f

Please sign in to comment.