| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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_FRAME_DEFAULT_HEADER_PAINTER_H_ | 5 #ifndef MASH_WM_FRAME_DEFAULT_HEADER_PAINTER_H_ |
| 6 #define ASH_FRAME_DEFAULT_HEADER_PAINTER_H_ | 6 #define MASH_WM_FRAME_DEFAULT_HEADER_PAINTER_H_ |
| 7 | 7 |
| 8 #include "ash/ash_export.h" | |
| 9 #include "ash/frame/header_painter.h" | |
| 10 #include "base/basictypes.h" | 8 #include "base/basictypes.h" |
| 11 #include "base/compiler_specific.h" // override | 9 #include "base/macros.h" |
| 12 #include "base/gtest_prod_util.h" | |
| 13 #include "base/memory/scoped_ptr.h" | 10 #include "base/memory/scoped_ptr.h" |
| 11 #include "mash/wm/frame/header_painter.h" |
| 14 #include "third_party/skia/include/core/SkColor.h" | 12 #include "third_party/skia/include/core/SkColor.h" |
| 15 #include "ui/gfx/animation/animation_delegate.h" | 13 #include "ui/gfx/animation/animation_delegate.h" |
| 16 | 14 |
| 17 namespace gfx { | 15 namespace gfx { |
| 18 class ImageSkia; | 16 class ImageSkia; |
| 19 class Rect; | 17 class Rect; |
| 20 class SlideAnimation; | 18 class SlideAnimation; |
| 21 } | 19 } |
| 22 namespace views { | 20 namespace views { |
| 23 class View; | 21 class View; |
| 24 class Widget; | 22 class Widget; |
| 25 } | 23 } |
| 26 | 24 |
| 27 namespace ash { | 25 namespace mash { |
| 26 namespace wm { |
| 27 |
| 28 class FrameCaptionButtonContainerView; | 28 class FrameCaptionButtonContainerView; |
| 29 | 29 |
| 30 // Helper class for painting the default window header. | 30 // Helper class for painting the default window header. |
| 31 class ASH_EXPORT DefaultHeaderPainter : public HeaderPainter, | 31 class DefaultHeaderPainter : public HeaderPainter, |
| 32 public gfx::AnimationDelegate { | 32 public gfx::AnimationDelegate { |
| 33 public: | 33 public: |
| 34 DefaultHeaderPainter(); | 34 DefaultHeaderPainter(); |
| 35 ~DefaultHeaderPainter() override; | 35 ~DefaultHeaderPainter() override; |
| 36 | 36 |
| 37 // DefaultHeaderPainter does not take ownership of any of the parameters. | 37 // DefaultHeaderPainter does not take ownership of any of the parameters. |
| 38 void Init(views::Widget* frame, | 38 void Init(views::Widget* frame, |
| 39 views::View* header_view, | 39 views::View* header_view, |
| 40 FrameCaptionButtonContainerView* caption_button_container); | 40 FrameCaptionButtonContainerView* caption_button_container); |
| 41 | 41 |
| 42 // HeaderPainter overrides: | 42 // HeaderPainter overrides: |
| 43 int GetMinimumHeaderWidth() const override; | 43 int GetMinimumHeaderWidth() const override; |
| 44 void PaintHeader(gfx::Canvas* canvas, Mode mode) override; | 44 void PaintHeader(gfx::Canvas* canvas, Mode mode) override; |
| 45 void LayoutHeader() override; | 45 void LayoutHeader() override; |
| 46 int GetHeaderHeight() const override; | 46 int GetHeaderHeight() const override; |
| 47 int GetHeaderHeightForPainting() const override; | 47 int GetHeaderHeightForPainting() const override; |
| 48 void SetHeaderHeightForPainting(int height) override; | 48 void SetHeaderHeightForPainting(int height) override; |
| 49 void SchedulePaintForTitle() override; | 49 void SchedulePaintForTitle() override; |
| 50 void UpdateLeftViewXInset(int left_view_x_inset) override; | 50 void UpdateLeftViewXInset(int left_view_x_inset) override; |
| 51 | 51 |
| 52 // Sets the left header view for the header. Passing NULL removes the view. | 52 // Sets the left header view for the header. Passing NULL removes the view. |
| 53 void UpdateLeftHeaderView(views::View* left_header_view); | 53 void UpdateLeftHeaderView(views::View* left_header_view); |
| 54 | 54 |
| 55 // Sets the active and inactive frame colors. Note the inactive frame color | 55 // Sets the active and inactive frame colors. Note the inactive frame color |
| 56 // will have some transparency added when the frame is drawn. | 56 // will have some transparency added when the frame is drawn. |
| 57 void SetFrameColors(SkColor active_frame_color, SkColor inactive_frame_color); | 57 void SetFrameColors(SkColor active_frame_color, SkColor inactive_frame_color); |
| 58 | 58 |
| 59 private: | 59 private: |
| 60 FRIEND_TEST_ALL_PREFIXES(DefaultHeaderPainterTest, TitleIconAlignment); | |
| 61 FRIEND_TEST_ALL_PREFIXES(DefaultHeaderPainterTest, LightIcons); | |
| 62 | |
| 63 // gfx::AnimationDelegate override: | 60 // gfx::AnimationDelegate override: |
| 64 void AnimationProgressed(const gfx::Animation* animation) override; | 61 void AnimationProgressed(const gfx::Animation* animation) override; |
| 65 | 62 |
| 66 // Paints highlight around the edge of the header for inactive restored | 63 // Paints highlight around the edge of the header for inactive restored |
| 67 // windows. | 64 // windows. |
| 68 void PaintHighlightForInactiveRestoredWindow(gfx::Canvas* canvas); | 65 void PaintHighlightForInactiveRestoredWindow(gfx::Canvas* canvas); |
| 69 | 66 |
| 70 // Paints the title bar, primarily the title string. | 67 // Paints the title bar, primarily the title string. |
| 71 void PaintTitleBar(gfx::Canvas* canvas); | 68 void PaintTitleBar(gfx::Canvas* canvas); |
| 72 | 69 |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 112 Mode mode_; | 109 Mode mode_; |
| 113 | 110 |
| 114 // Whether the header is painted for the first time. | 111 // Whether the header is painted for the first time. |
| 115 bool initial_paint_; | 112 bool initial_paint_; |
| 116 | 113 |
| 117 scoped_ptr<gfx::SlideAnimation> activation_animation_; | 114 scoped_ptr<gfx::SlideAnimation> activation_animation_; |
| 118 | 115 |
| 119 DISALLOW_COPY_AND_ASSIGN(DefaultHeaderPainter); | 116 DISALLOW_COPY_AND_ASSIGN(DefaultHeaderPainter); |
| 120 }; | 117 }; |
| 121 | 118 |
| 122 } // namespace ash | 119 } // namespace wm |
| 120 } // namespace mash |
| 123 | 121 |
| 124 #endif // ASH_FRAME_DEFAULT_HEADER_PAINTER_H_ | 122 #endif // MASH_WM_FRAME_DEFAULT_HEADER_PAINTER_H_ |
| OLD | NEW |