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

Side by Side Diff: ash/frame/default_header_painter.h

Issue 441803004: Introduce new WebApp header style for hosted apps and fizzy apps on ash. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Review feedback Created 6 years, 4 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 | Annotate | Revision Log
OLDNEW
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
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 UpdateHeaderOffset(int left_header_view_offset) 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 int left_header_view_size);
52 53
53 private: 54 private:
54 FRIEND_TEST_ALL_PREFIXES(DefaultHeaderPainterTest, TitleIconAlignment); 55 FRIEND_TEST_ALL_PREFIXES(DefaultHeaderPainterTest, TitleIconAlignment);
55 56
56 // gfx::AnimationDelegate override: 57 // gfx::AnimationDelegate override:
57 virtual void AnimationProgressed(const gfx::Animation* animation) OVERRIDE; 58 virtual void AnimationProgressed(const gfx::Animation* animation) OVERRIDE;
58 59
59 // Paints highlight around the edge of the header for inactive restored 60 // Paints highlight around the edge of the header for inactive restored
60 // windows. 61 // windows.
61 void PaintHighlightForInactiveRestoredWindow(gfx::Canvas* canvas); 62 void PaintHighlightForInactiveRestoredWindow(gfx::Canvas* canvas);
62 63
63 // Paints the title bar, primarily the title string. 64 // Paints the title bar, primarily the title string.
64 void PaintTitleBar(gfx::Canvas* canvas); 65 void PaintTitleBar(gfx::Canvas* canvas);
65 66
66 // Paints the header/content separator. 67 // Paints the header/content separator.
67 void PaintHeaderContentSeparator(gfx::Canvas* canvas); 68 void PaintHeaderContentSeparator(gfx::Canvas* canvas);
68 69
70 // Layout the left header view.
71 void LayoutLeftHeaderView();
72
69 // Returns the header bounds in the coordinates of |view_|. The header is 73 // 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 74 // assumed to be positioned at the top left corner of |view_| and to have the
71 // same width as |view_|. 75 // same width as |view_|.
72 gfx::Rect GetLocalBounds() const; 76 gfx::Rect GetLocalBounds() const;
73 77
74 // Returns the bounds for the title. 78 // Returns the bounds for the title.
75 gfx::Rect GetTitleBounds() const; 79 gfx::Rect GetTitleBounds() const;
76 80
77 // Returns the frame image to use when |frame_| is active. 81 // Returns the frame image to use when |frame_| is active.
78 gfx::ImageSkia* GetActiveFrameImage() const; 82 gfx::ImageSkia* GetActiveFrameImage() const;
79 83
80 // Returns the frame image to use when |frame_| is inactive. 84 // Returns the frame image to use when |frame_| is inactive.
81 gfx::ImageSkia* GetInactiveFrameImage() const; 85 gfx::ImageSkia* GetInactiveFrameImage() const;
82 86
83 views::Widget* frame_; 87 views::Widget* frame_;
84 views::View* view_; 88 views::View* view_;
85 views::View* window_icon_; // May be NULL. 89 views::View* left_header_view_; // May be NULL.
86 int window_icon_size_; 90 int left_header_view_size_;
91 int left_header_view_offset_;
87 FrameCaptionButtonContainerView* caption_button_container_; 92 FrameCaptionButtonContainerView* caption_button_container_;
88 93
89 // The height of the header including the header/content separator. 94 // The height of the header including the header/content separator.
90 int height_; 95 int height_;
91 96
92 // Whether the header should be painted as active. 97 // Whether the header should be painted as active.
93 Mode mode_; 98 Mode mode_;
94 99
95 // Whether the header is painted for the first time. 100 // Whether the header is painted for the first time.
96 bool initial_paint_; 101 bool initial_paint_;
97 102
98 scoped_ptr<gfx::SlideAnimation> activation_animation_; 103 scoped_ptr<gfx::SlideAnimation> activation_animation_;
99 104
100 DISALLOW_COPY_AND_ASSIGN(DefaultHeaderPainter); 105 DISALLOW_COPY_AND_ASSIGN(DefaultHeaderPainter);
101 }; 106 };
102 107
103 } // namespace ash 108 } // namespace ash
104 109
105 #endif // ASH_FRAME_DEFAULT_HEADER_PAINTER_H_ 110 #endif // ASH_FRAME_DEFAULT_HEADER_PAINTER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698