Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(134)

Side by Side Diff: ui/native_theme/native_theme_aurawin.cc

Issue 851853002: It is time. (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: Trying to reup because the last upload failed. Created 5 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « ui/native_theme/native_theme_aurawin.h ('k') | ui/native_theme/native_theme_base.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 // Copyright 2014 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.
4
5 #include "ui/native_theme/native_theme_aurawin.h"
6
7 #include "third_party/skia/include/core/SkCanvas.h"
8 #include "ui/native_theme/common_theme.h"
9 #include "ui/native_theme/native_theme_win.h"
10
11 namespace ui {
12
13 namespace {
14
15 bool IsScrollbarPart(NativeTheme::Part part) {
16 switch (part) {
17 case NativeTheme::kScrollbarDownArrow:
18 case NativeTheme::kScrollbarLeftArrow:
19 case NativeTheme::kScrollbarRightArrow:
20 case NativeTheme::kScrollbarUpArrow:
21 case NativeTheme::kScrollbarHorizontalThumb:
22 case NativeTheme::kScrollbarVerticalThumb:
23 case NativeTheme::kScrollbarHorizontalTrack:
24 case NativeTheme::kScrollbarVerticalTrack:
25 case NativeTheme::kScrollbarHorizontalGripper:
26 case NativeTheme::kScrollbarVerticalGripper:
27 case NativeTheme::kScrollbarCorner:
28 return true;
29 }
30 return false;
31 }
32
33 } // namespace
34
35 // static
36 NativeTheme* NativeTheme::instance() {
37 return NativeThemeAuraWin::instance();
38 }
39
40 // static
41 NativeThemeAura* NativeThemeAura::instance() {
42 return NativeThemeAuraWin::instance();
43 }
44
45 // static
46 NativeThemeAuraWin* NativeThemeAuraWin::instance() {
47 CR_DEFINE_STATIC_LOCAL(NativeThemeAuraWin, s_native_theme, ());
48 return &s_native_theme;
49 }
50
51 NativeThemeAuraWin::NativeThemeAuraWin() {
52 }
53
54 NativeThemeAuraWin::~NativeThemeAuraWin() {
55 }
56
57 void NativeThemeAuraWin::Paint(SkCanvas* canvas,
58 Part part,
59 State state,
60 const gfx::Rect& rect,
61 const ExtraParams& extra) const {
62 if (IsScrollbarPart(part) &&
63 NativeThemeWin::instance()->IsUsingHighContrastTheme()) {
64 NativeThemeWin::instance()->Paint(canvas, part, state, rect, extra);
65 return;
66 }
67
68 NativeThemeAura::Paint(canvas, part, state, rect, extra);
69 }
70
71 gfx::Size NativeThemeAuraWin::GetPartSize(Part part,
72 State state,
73 const ExtraParams& extra) const {
74 gfx::Size part_size = CommonThemeGetPartSize(part, state, extra);
75 if (!part_size.IsEmpty())
76 return part_size;
77
78 // We want aura on windows to use the same size for scrollbars as we would in
79 // the native theme.
80 if (IsScrollbarPart(part))
81 return NativeThemeWin::instance()->GetPartSize(part, state, extra);
82
83 return NativeThemeAura::GetPartSize(part, state, extra);
84 }
85
86 } // namespace ui
OLDNEW
« no previous file with comments | « ui/native_theme/native_theme_aurawin.h ('k') | ui/native_theme/native_theme_base.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698