| 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_FRAME_DEFAULT_HEADER_PAINTER_H_ | 5 #ifndef ASH_FRAME_DEFAULT_HEADER_PAINTER_H_ | 
| 6 #define ASH_FRAME_DEFAULT_HEADER_PAINTER_H_ | 6 #define ASH_FRAME_DEFAULT_HEADER_PAINTER_H_ | 
| 7 | 7 | 
| 8 #include "ash/ash_export.h" | 8 #include "ash/ash_export.h" | 
| 9 #include "ash/frame/header_painter.h" | 9 #include "ash/frame/header_painter.h" | 
| 10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" | 
| (...skipping 18 matching lines...) Expand all  Loading... | 
| 29 // Helper class for painting the default window header. | 29 // Helper class for painting the default window header. | 
| 30 class ASH_EXPORT DefaultHeaderPainter : public HeaderPainter, | 30 class ASH_EXPORT DefaultHeaderPainter : public HeaderPainter, | 
| 31                                         public gfx::AnimationDelegate { | 31                                         public gfx::AnimationDelegate { | 
| 32  public: | 32  public: | 
| 33   DefaultHeaderPainter(); | 33   DefaultHeaderPainter(); | 
| 34   virtual ~DefaultHeaderPainter(); | 34   virtual ~DefaultHeaderPainter(); | 
| 35 | 35 | 
| 36   // DefaultHeaderPainter does not take ownership of any of the parameters. | 36   // DefaultHeaderPainter does not take ownership of any of the parameters. | 
| 37   void Init(views::Widget* frame, | 37   void Init(views::Widget* frame, | 
| 38             views::View* header_view, | 38             views::View* header_view, | 
| 39             views::View* window_icon, |  | 
| 40             FrameCaptionButtonContainerView* caption_button_container); | 39             FrameCaptionButtonContainerView* caption_button_container); | 
| 41 | 40 | 
| 42   // HeaderPainter overrides: | 41   // HeaderPainter overrides: | 
| 43   virtual int GetMinimumHeaderWidth() const OVERRIDE; | 42   virtual int GetMinimumHeaderWidth() const OVERRIDE; | 
| 44   virtual void PaintHeader(gfx::Canvas* canvas, Mode mode) OVERRIDE; | 43   virtual void PaintHeader(gfx::Canvas* canvas, Mode mode) OVERRIDE; | 
| 45   virtual void LayoutHeader() OVERRIDE; | 44   virtual void LayoutHeader() OVERRIDE; | 
| 46   virtual int GetHeaderHeightForPainting() const OVERRIDE; | 45   virtual int GetHeaderHeightForPainting() const OVERRIDE; | 
| 47   virtual void SetHeaderHeightForPainting(int height) OVERRIDE; | 46   virtual void SetHeaderHeightForPainting(int height) OVERRIDE; | 
| 48   virtual void SchedulePaintForTitle() OVERRIDE; | 47   virtual void SchedulePaintForTitle() OVERRIDE; | 
|  | 48   virtual void UpdateLeftViewXInset(int left_view_x_inset) OVERRIDE; | 
| 49 | 49 | 
| 50   // Sets the window icon for the header. Passing NULL removes the window icon. | 50   // Sets the left header view for the header. Passing NULL removes the view. | 
| 51   void UpdateWindowIcon(views::View* window_icon, int icon_size); | 51   void UpdateLeftHeaderView(views::View* left_header_view); | 
| 52 | 52 | 
| 53  private: | 53  private: | 
| 54   FRIEND_TEST_ALL_PREFIXES(DefaultHeaderPainterTest, TitleIconAlignment); | 54   FRIEND_TEST_ALL_PREFIXES(DefaultHeaderPainterTest, TitleIconAlignment); | 
| 55 | 55 | 
| 56   // gfx::AnimationDelegate override: | 56   // gfx::AnimationDelegate override: | 
| 57   virtual void AnimationProgressed(const gfx::Animation* animation) OVERRIDE; | 57   virtual void AnimationProgressed(const gfx::Animation* animation) OVERRIDE; | 
| 58 | 58 | 
| 59   // Paints highlight around the edge of the header for inactive restored | 59   // Paints highlight around the edge of the header for inactive restored | 
| 60   // windows. | 60   // windows. | 
| 61   void PaintHighlightForInactiveRestoredWindow(gfx::Canvas* canvas); | 61   void PaintHighlightForInactiveRestoredWindow(gfx::Canvas* canvas); | 
| 62 | 62 | 
| 63   // Paints the title bar, primarily the title string. | 63   // Paints the title bar, primarily the title string. | 
| 64   void PaintTitleBar(gfx::Canvas* canvas); | 64   void PaintTitleBar(gfx::Canvas* canvas); | 
| 65 | 65 | 
| 66   // Paints the header/content separator. | 66   // Paints the header/content separator. | 
| 67   void PaintHeaderContentSeparator(gfx::Canvas* canvas); | 67   void PaintHeaderContentSeparator(gfx::Canvas* canvas); | 
| 68 | 68 | 
|  | 69   // Layout the left header view. | 
|  | 70   void LayoutLeftHeaderView(); | 
|  | 71 | 
| 69   // Returns the header bounds in the coordinates of |view_|. The header is | 72   // Returns the header bounds in the coordinates of |view_|. The header is | 
| 70   // assumed to be positioned at the top left corner of |view_| and to have the | 73   // assumed to be positioned at the top left corner of |view_| and to have the | 
| 71   // same width as |view_|. | 74   // same width as |view_|. | 
| 72   gfx::Rect GetLocalBounds() const; | 75   gfx::Rect GetLocalBounds() const; | 
| 73 | 76 | 
| 74   // Returns the bounds for the title. | 77   // Returns the bounds for the title. | 
| 75   gfx::Rect GetTitleBounds() const; | 78   gfx::Rect GetTitleBounds() const; | 
| 76 | 79 | 
| 77   // Returns the frame image to use when |frame_| is active. | 80   // Returns the frame image to use when |frame_| is active. | 
| 78   gfx::ImageSkia* GetActiveFrameImage() const; | 81   gfx::ImageSkia* GetActiveFrameImage() const; | 
| 79 | 82 | 
| 80   // Returns the frame image to use when |frame_| is inactive. | 83   // Returns the frame image to use when |frame_| is inactive. | 
| 81   gfx::ImageSkia* GetInactiveFrameImage() const; | 84   gfx::ImageSkia* GetInactiveFrameImage() const; | 
| 82 | 85 | 
| 83   views::Widget* frame_; | 86   views::Widget* frame_; | 
| 84   views::View* view_; | 87   views::View* view_; | 
| 85   views::View* window_icon_;  // May be NULL. | 88   views::View* left_header_view_;  // May be NULL. | 
| 86   int window_icon_size_; | 89   int left_view_x_inset_; | 
| 87   FrameCaptionButtonContainerView* caption_button_container_; | 90   FrameCaptionButtonContainerView* caption_button_container_; | 
| 88 | 91 | 
| 89   // The height of the header including the header/content separator. | 92   // The height of the header including the header/content separator. | 
| 90   int height_; | 93   int height_; | 
| 91 | 94 | 
| 92   // Whether the header should be painted as active. | 95   // Whether the header should be painted as active. | 
| 93   Mode mode_; | 96   Mode mode_; | 
| 94 | 97 | 
| 95   // Whether the header is painted for the first time. | 98   // Whether the header is painted for the first time. | 
| 96   bool initial_paint_; | 99   bool initial_paint_; | 
| 97 | 100 | 
| 98   scoped_ptr<gfx::SlideAnimation> activation_animation_; | 101   scoped_ptr<gfx::SlideAnimation> activation_animation_; | 
| 99 | 102 | 
| 100   DISALLOW_COPY_AND_ASSIGN(DefaultHeaderPainter); | 103   DISALLOW_COPY_AND_ASSIGN(DefaultHeaderPainter); | 
| 101 }; | 104 }; | 
| 102 | 105 | 
| 103 }  // namespace ash | 106 }  // namespace ash | 
| 104 | 107 | 
| 105 #endif  // ASH_FRAME_DEFAULT_HEADER_PAINTER_H_ | 108 #endif  // ASH_FRAME_DEFAULT_HEADER_PAINTER_H_ | 
| OLD | NEW | 
|---|