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
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
|
// Copyright 2014 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_aurawin.h"
#include "third_party/skia/include/core/SkCanvas.h"
#include "ui/native_theme/common_theme.h"
#include "ui/native_theme/native_theme_win.h"
namespace ui {
namespace {
bool IsScrollbarPart(NativeTheme::Part part) {
switch (part) {
case NativeTheme::kScrollbarDownArrow:
case NativeTheme::kScrollbarLeftArrow:
case NativeTheme::kScrollbarRightArrow:
case NativeTheme::kScrollbarUpArrow:
case NativeTheme::kScrollbarHorizontalThumb:
case NativeTheme::kScrollbarVerticalThumb:
case NativeTheme::kScrollbarHorizontalTrack:
case NativeTheme::kScrollbarVerticalTrack:
case NativeTheme::kScrollbarHorizontalGripper:
case NativeTheme::kScrollbarVerticalGripper:
case NativeTheme::kScrollbarCorner:
return true;
default:
return false;
}
}
} // namespace
// static
NativeTheme* NativeTheme::instance() {
return NativeThemeAuraWin::instance();
}
// static
NativeThemeAura* NativeThemeAura::instance() {
return NativeThemeAuraWin::instance();
}
// static
NativeThemeAuraWin* NativeThemeAuraWin::instance() {
CR_DEFINE_STATIC_LOCAL(NativeThemeAuraWin, s_native_theme, ());
return &s_native_theme;
}
NativeThemeAuraWin::NativeThemeAuraWin() {
}
NativeThemeAuraWin::~NativeThemeAuraWin() {
}
void NativeThemeAuraWin::Paint(SkCanvas* canvas,
Part part,
State state,
const gfx::Rect& rect,
const ExtraParams& extra) const {
if (IsScrollbarPart(part) &&
NativeThemeWin::instance()->IsUsingHighContrastTheme()) {
NativeThemeWin::instance()->Paint(canvas, part, state, rect, extra);
return;
}
NativeThemeAura::Paint(canvas, part, state, rect, extra);
}
gfx::Size NativeThemeAuraWin::GetPartSize(Part part,
State state,
const ExtraParams& extra) const {
gfx::Size part_size = CommonThemeGetPartSize(part, state, extra);
if (!part_size.IsEmpty())
return part_size;
// We want aura on windows to use the same size for scrollbars as we would in
// the native theme.
if (IsScrollbarPart(part))
return NativeThemeWin::instance()->GetPartSize(part, state, extra);
return NativeThemeAura::GetPartSize(part, state, extra);
}
} // namespace ui
|