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"
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)
21 NativeTheme
* NativeTheme::instance() {
22 return NativeThemeAndroid::instance();
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
,
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 {
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,
51 NativeThemeAndroid::NativeThemeAndroid() {
54 NativeThemeAndroid::~NativeThemeAndroid() {