OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef ASH_COMMON_FRAME_DEFAULT_HEADER_PAINTER_H_ | 5 #ifndef ASH_COMMON_FRAME_DEFAULT_HEADER_PAINTER_H_ |
6 #define ASH_COMMON_FRAME_DEFAULT_HEADER_PAINTER_H_ | 6 #define ASH_COMMON_FRAME_DEFAULT_HEADER_PAINTER_H_ |
7 | 7 |
8 #include <memory> | 8 #include <memory> |
9 | 9 |
10 #include "ash/ash_export.h" | 10 #include "ash/ash_export.h" |
11 #include "ash/common/frame/header_painter.h" | 11 #include "ash/common/frame/header_painter.h" |
| 12 #include "ash/public/interfaces/window_style.mojom.h" |
12 #include "base/compiler_specific.h" // override | 13 #include "base/compiler_specific.h" // override |
13 #include "base/gtest_prod_util.h" | 14 #include "base/gtest_prod_util.h" |
14 #include "base/macros.h" | 15 #include "base/macros.h" |
15 #include "third_party/skia/include/core/SkColor.h" | 16 #include "third_party/skia/include/core/SkColor.h" |
16 #include "ui/gfx/animation/animation_delegate.h" | 17 #include "ui/gfx/animation/animation_delegate.h" |
17 | 18 |
18 namespace gfx { | 19 namespace gfx { |
19 class Rect; | 20 class Rect; |
20 class SlideAnimation; | 21 class SlideAnimation; |
21 } | 22 } |
22 namespace views { | 23 namespace views { |
23 class View; | 24 class View; |
24 class Widget; | 25 class Widget; |
25 } | 26 } |
26 | 27 |
27 namespace ash { | 28 namespace ash { |
28 class FrameCaptionButtonContainerView; | 29 class FrameCaptionButtonContainerView; |
29 | 30 |
30 // Helper class for painting the default window header. | 31 // Helper class for painting the default window header. |
31 class ASH_EXPORT DefaultHeaderPainter : public HeaderPainter, | 32 class ASH_EXPORT DefaultHeaderPainter : public HeaderPainter, |
32 public gfx::AnimationDelegate { | 33 public gfx::AnimationDelegate { |
33 public: | 34 public: |
34 DefaultHeaderPainter(); | 35 explicit DefaultHeaderPainter( |
| 36 mojom::WindowStyle window_style = mojom::WindowStyle::DEFAULT); |
35 ~DefaultHeaderPainter() override; | 37 ~DefaultHeaderPainter() override; |
36 | 38 |
37 // DefaultHeaderPainter does not take ownership of any of the parameters. | 39 // DefaultHeaderPainter does not take ownership of any of the parameters. |
38 void Init(views::Widget* frame, | 40 void Init(views::Widget* frame, |
39 views::View* header_view, | 41 views::View* header_view, |
40 FrameCaptionButtonContainerView* caption_button_container); | 42 FrameCaptionButtonContainerView* caption_button_container); |
41 | 43 |
42 // HeaderPainter overrides: | 44 // HeaderPainter overrides: |
43 int GetMinimumHeaderWidth() const override; | 45 int GetMinimumHeaderWidth() const override; |
44 void PaintHeader(gfx::Canvas* canvas, Mode mode) override; | 46 void PaintHeader(gfx::Canvas* canvas, Mode mode) override; |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
88 // assumed to be positioned at the top left corner of |view_| and to have the | 90 // assumed to be positioned at the top left corner of |view_| and to have the |
89 // same width as |view_|. | 91 // same width as |view_|. |
90 gfx::Rect GetLocalBounds() const; | 92 gfx::Rect GetLocalBounds() const; |
91 | 93 |
92 // Returns the bounds for the title. | 94 // Returns the bounds for the title. |
93 gfx::Rect GetTitleBounds() const; | 95 gfx::Rect GetTitleBounds() const; |
94 | 96 |
95 // Returns whether the frame uses custom frame coloring. | 97 // Returns whether the frame uses custom frame coloring. |
96 bool UsesCustomFrameColors() const; | 98 bool UsesCustomFrameColors() const; |
97 | 99 |
| 100 const mojom::WindowStyle window_style_; |
98 views::Widget* frame_; | 101 views::Widget* frame_; |
99 views::View* view_; | 102 views::View* view_; |
100 views::View* left_header_view_; // May be NULL. | 103 views::View* left_header_view_; // May be NULL. |
101 SkColor active_frame_color_; | 104 SkColor active_frame_color_; |
102 SkColor inactive_frame_color_; | 105 SkColor inactive_frame_color_; |
103 FrameCaptionButtonContainerView* caption_button_container_; | 106 FrameCaptionButtonContainerView* caption_button_container_; |
104 | 107 |
105 // The height of the header to paint. | 108 // The height of the header to paint. |
106 int painted_height_; | 109 int painted_height_; |
107 | 110 |
108 // Whether the header should be painted as active. | 111 // Whether the header should be painted as active. |
109 Mode mode_; | 112 Mode mode_; |
110 | 113 |
111 // Whether the header is painted for the first time. | 114 // Whether the header is painted for the first time. |
112 bool initial_paint_; | 115 bool initial_paint_; |
113 | 116 |
114 std::unique_ptr<gfx::SlideAnimation> activation_animation_; | 117 std::unique_ptr<gfx::SlideAnimation> activation_animation_; |
115 | 118 |
116 DISALLOW_COPY_AND_ASSIGN(DefaultHeaderPainter); | 119 DISALLOW_COPY_AND_ASSIGN(DefaultHeaderPainter); |
117 }; | 120 }; |
118 | 121 |
119 } // namespace ash | 122 } // namespace ash |
120 | 123 |
121 #endif // ASH_COMMON_FRAME_DEFAULT_HEADER_PAINTER_H_ | 124 #endif // ASH_COMMON_FRAME_DEFAULT_HEADER_PAINTER_H_ |
OLD | NEW |