Merge Chromium + Blink git repositories
[chromium-blink-merge.git] / ui / native_theme / native_theme_android.cc
blob5572ac07ada9215064f37841e68939a43cf7753c
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 #include "ui/native_theme/native_theme_android.h"
7 #include "base/basictypes.h"
8 #include "base/logging.h"
9 #include "ui/gfx/geometry/size.h"
11 namespace ui {
13 namespace {
14 // These are the default dimensions of radio buttons and checkboxes on Android.
15 const int kCheckboxAndRadioWidth = 16;
16 const int kCheckboxAndRadioHeight = 16;
19 #if !defined(USE_AURA)
20 // static
21 NativeTheme* NativeTheme::instance() {
22 return NativeThemeAndroid::instance();
24 #endif
26 // static
27 NativeThemeAndroid* NativeThemeAndroid::instance() {
28 CR_DEFINE_STATIC_LOCAL(NativeThemeAndroid, s_native_theme, ());
29 return &s_native_theme;
32 gfx::Size NativeThemeAndroid::GetPartSize(Part part,
33 State state,
34 const ExtraParams& extra) const {
35 if (part == kCheckbox || part == kRadio)
36 return gfx::Size(kCheckboxAndRadioWidth, kCheckboxAndRadioHeight);
37 return NativeThemeBase::GetPartSize(part, state, extra);
40 SkColor NativeThemeAndroid::GetSystemColor(ColorId color_id) const {
41 NOTIMPLEMENTED();
42 return SK_ColorBLACK;
45 void NativeThemeAndroid::AdjustCheckboxRadioRectForPadding(SkRect* rect) const {
46 // Take 1px for padding around the checkbox/radio button.
47 rect->iset(rect->x() + 1, rect->y() + 1, rect->right() - 1,
48 rect->bottom() - 1);
51 NativeThemeAndroid::NativeThemeAndroid() {
54 NativeThemeAndroid::~NativeThemeAndroid() {
57 } // namespace ui