forked from Pissandshittium/pissandshittium
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathnative_theme_android.cc
61 lines (48 loc) · 1.64 KB
/
native_theme_android.cc
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
// 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/native_theme/native_theme_android.h"
#include "base/logging.h"
#include "ui/gfx/geometry/size.h"
namespace ui {
namespace {
// These are the default dimensions of radio buttons and checkboxes on Android.
const int kCheckboxAndRadioWidth = 16;
const int kCheckboxAndRadioHeight = 16;
}
#if !defined(USE_AURA)
// static
NativeTheme* NativeTheme::GetInstanceForWeb() {
return NativeThemeAndroid::instance();
}
NativeTheme* NativeTheme::GetInstanceForNativeUi() {
NOTREACHED();
return nullptr;
}
#endif
// static
NativeThemeAndroid* NativeThemeAndroid::instance() {
CR_DEFINE_STATIC_LOCAL(NativeThemeAndroid, s_native_theme, ());
return &s_native_theme;
}
gfx::Size NativeThemeAndroid::GetPartSize(Part part,
State state,
const ExtraParams& extra) const {
if (part == kCheckbox || part == kRadio)
return gfx::Size(kCheckboxAndRadioWidth, kCheckboxAndRadioHeight);
return NativeThemeBase::GetPartSize(part, state, extra);
}
SkColor NativeThemeAndroid::GetSystemColor(ColorId color_id) const {
NOTIMPLEMENTED();
return SK_ColorBLACK;
}
void NativeThemeAndroid::AdjustCheckboxRadioRectForPadding(SkRect* rect) const {
// Take 1px for padding around the checkbox/radio button.
rect->iset(rect->x() + 1, rect->y() + 1, rect->right() - 1,
rect->bottom() - 1);
}
NativeThemeAndroid::NativeThemeAndroid() {
}
NativeThemeAndroid::~NativeThemeAndroid() {
}
} // namespace ui