GoogleURLTrackerInfoBarDelegate: Initialize uninitialized member in constructor.
[chromium-blink-merge.git] / ui / native_theme / native_theme_aura.h
blob65c70ff324a071840d9308ddc3aecff65d41ddac
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 #ifndef UI_NATIVE_THEME_NATIVE_THEME_AURA_H_
6 #define UI_NATIVE_THEME_NATIVE_THEME_AURA_H_
8 #include "base/basictypes.h"
9 #include "base/compiler_specific.h"
10 #include "ui/native_theme/fallback_theme.h"
12 namespace gfx {
13 class NineImagePainter;
16 namespace ui {
18 // Aura implementation of native theme support.
19 class NATIVE_THEME_EXPORT NativeThemeAura : public FallbackTheme {
20 public:
21 static NativeThemeAura* instance();
23 protected:
24 NativeThemeAura();
25 virtual ~NativeThemeAura();
27 // Overridden from NativeThemeBase:
28 virtual void PaintMenuPopupBackground(
29 SkCanvas* canvas,
30 const gfx::Size& size,
31 const MenuBackgroundExtraParams& menu_background) const OVERRIDE;
32 virtual void PaintMenuItemBackground(
33 SkCanvas* canvas,
34 State state,
35 const gfx::Rect& rect,
36 const MenuListExtraParams& menu_list) const OVERRIDE;
37 virtual void PaintArrowButton(SkCanvas* gc,
38 const gfx::Rect& rect,
39 Part direction,
40 State state) const OVERRIDE;
41 virtual void PaintScrollbarTrack(
42 SkCanvas* sk_canvas,
43 Part part,
44 State state,
45 const ScrollbarTrackExtraParams& extra_params,
46 const gfx::Rect& rect) const OVERRIDE;
47 virtual void PaintScrollbarThumb(SkCanvas* sk_canvas,
48 Part part,
49 State state,
50 const gfx::Rect& rect) const OVERRIDE;
51 virtual void PaintScrollbarCorner(SkCanvas* canvas,
52 State state,
53 const gfx::Rect& rect) const OVERRIDE;
55 // Returns the NineImagePainter used to paint the specified state, creating if
56 // necessary. If no image is provided for the specified state the normal state
57 // images are used.
58 gfx::NineImagePainter* GetOrCreatePainter(
59 const int image_ids[kMaxState][9],
60 State state,
61 scoped_ptr<gfx::NineImagePainter> painters[kMaxState]) const;
63 // Paints |painter| into the canvas using |rect|.
64 void PaintPainter(gfx::NineImagePainter* painter,
65 SkCanvas* sk_canvas,
66 const gfx::Rect& rect) const;
68 mutable scoped_ptr<gfx::NineImagePainter> scrollbar_track_painter_;
70 mutable scoped_ptr<gfx::NineImagePainter>
71 scrollbar_thumb_painters_[kMaxState];
73 mutable scoped_ptr<gfx::NineImagePainter>
74 scrollbar_arrow_button_painters_[kMaxState];
76 private:
77 struct DualPainter {
78 // For overlay scrollbar thumbs, fill and stroke are controlled separately,
79 // and each state is achieved by painting with different opacity. This
80 // struct bundles information of painter generated using assets and alpha
81 // value associated with each state, so that a DualPainter for overlay
82 // scrollbar thumb would only need state as input to paint correctly.
83 DualPainter(scoped_ptr<gfx::NineImagePainter> fill_painter,
84 const uint8 fill_alphas[kMaxState],
85 scoped_ptr<gfx::NineImagePainter> stroke_painter,
86 const uint8 stroke_alphas[kMaxState]);
87 ~DualPainter();
89 scoped_ptr<gfx::NineImagePainter> fill_painter;
90 const uint8* const fill_alphas;
91 scoped_ptr<gfx::NineImagePainter> stroke_painter;
92 const uint8* const stroke_alphas;
95 // Returns DualPainter from specific fill and stroke, creating if necessary.
96 scoped_ptr<DualPainter> CreateDualPainter(
97 const int fill_image_ids[9],
98 const uint8 fill_alphas[kMaxState],
99 const int stroke_image_ids[9],
100 const uint8 stroke_alphas[kMaxState]) const;
102 // Paints |dualPainter| into the canvas using |rect| and specific alpha.
103 void PaintDualPainter(DualPainter* dual_painter,
104 SkCanvas* sk_canvas,
105 const gfx::Rect& rect,
106 State state) const;
108 mutable scoped_ptr<DualPainter> scrollbar_overlay_thumb_painter_;
110 DISALLOW_COPY_AND_ASSIGN(NativeThemeAura);
113 } // namespace ui
115 #endif // UI_NATIVE_THEME_NATIVE_THEME_AURA_H_