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

Side by Side Diff: ash/wm/header_painter.h

Issue 148003003: Use white header for app windows part #2 (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 10 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 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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_WM_HEADER_PAINTER_H_ 5 #ifndef ASH_WM_HEADER_PAINTER_H_
6 #define ASH_WM_HEADER_PAINTER_H_ 6 #define ASH_WM_HEADER_PAINTER_H_
7 7
8 #include "ash/ash_export.h" 8 #include "ash/ash_export.h"
9 #include "base/basictypes.h" 9 #include "base/basictypes.h"
10 #include "base/compiler_specific.h" // OVERRIDE 10 #include "base/compiler_specific.h" // OVERRIDE
(...skipping 14 matching lines...) Expand all
25 class View; 25 class View;
26 class Widget; 26 class Widget;
27 } 27 }
28 28
29 namespace ash { 29 namespace ash {
30 class FrameCaptionButtonContainerView; 30 class FrameCaptionButtonContainerView;
31 31
32 // Helper class for painting the window header. 32 // Helper class for painting the window header.
33 class ASH_EXPORT HeaderPainter : public gfx::AnimationDelegate { 33 class ASH_EXPORT HeaderPainter : public gfx::AnimationDelegate {
34 public: 34 public:
35 enum Mode {
James Cook 2014/02/03 18:46:35 Maybe comment that this is the window active state
36 MODE_ACTIVE,
37 MODE_INACTIVE
38 };
39
35 // TODO(pkotwicz): Move code related to "browser" windows out of ash. 40 // TODO(pkotwicz): Move code related to "browser" windows out of ash.
36 enum Style { 41 enum Style {
37 // Header style used for browser windows. 42 // Header style used for browser windows.
38 STYLE_BROWSER, 43 STYLE_BROWSER,
39 44
40 // Header style used for apps and miscellaneous windows (e.g. task manager). 45 // Header style used for apps and miscellaneous windows (e.g. task manager).
41 STYLE_OTHER 46 STYLE_OTHER
42 }; 47 };
43 48
44 HeaderPainter(); 49 HeaderPainter();
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
76 81
77 // Returns the inset from the right edge. 82 // Returns the inset from the right edge.
78 int GetRightInset() const; 83 int GetRightInset() const;
79 84
80 // Returns the amount that the theme background should be inset. 85 // Returns the amount that the theme background should be inset.
81 int GetThemeBackgroundXInset() const; 86 int GetThemeBackgroundXInset() const;
82 87
83 // Paints the header. 88 // Paints the header.
84 // |theme_frame_overlay_id| is 0 if no overlay image should be used. 89 // |theme_frame_overlay_id| is 0 if no overlay image should be used.
85 void PaintHeader(gfx::Canvas* canvas, 90 void PaintHeader(gfx::Canvas* canvas,
91 Mode mode,
86 int theme_frame_id, 92 int theme_frame_id,
87 int theme_frame_overlay_id); 93 int theme_frame_overlay_id);
88 94
89 // Paints the header/content separator line. Exists as a separate function 95 // Paints the header/content separator line for non-browser windows.
90 // because some windows with complex headers (e.g. browsers with tab strips) 96 void PaintHeaderContentSeparator(gfx::Canvas* canvas, Mode mode);
91 // need to draw their own line.
92 void PaintHeaderContentSeparator(gfx::Canvas* canvas);
93 97
94 // Returns size of the header/content separator line in pixels. 98 // Returns size of the header/content separator line for non-browser windows
99 // in pixels.
95 int HeaderContentSeparatorSize() const; 100 int HeaderContentSeparatorSize() const;
96 101
97 // Paint the title bar, primarily the title string. 102 // Paint the title bar, primarily the title string.
98 void PaintTitleBar(gfx::Canvas* canvas, const gfx::FontList& title_font_list); 103 void PaintTitleBar(gfx::Canvas* canvas, const gfx::FontList& title_font_list);
99 104
100 // Performs layout for the header based on |frame_|'s show state. 105 // Performs layout for the header based on |frame_|'s show state.
101 void LayoutHeader(); 106 void LayoutHeader();
102 107
103 // Sets the height of the header. The height of the header affects painting, 108 // Sets the height of the header. The height of the header affects painting,
104 // and non client hit tests. It does not affect layout. 109 // and non client hit tests. It does not affect layout.
(...skipping 11 matching lines...) Expand all
116 121
117 // Called when the browser theme changes. 122 // Called when the browser theme changes.
118 void OnThemeChanged(); 123 void OnThemeChanged();
119 124
120 // Overridden from gfx::AnimationDelegate 125 // Overridden from gfx::AnimationDelegate
121 virtual void AnimationProgressed(const gfx::Animation* animation) OVERRIDE; 126 virtual void AnimationProgressed(const gfx::Animation* animation) OVERRIDE;
122 127
123 private: 128 private:
124 FRIEND_TEST_ALL_PREFIXES(HeaderPainterTest, TitleIconAlignment); 129 FRIEND_TEST_ALL_PREFIXES(HeaderPainterTest, TitleIconAlignment);
125 130
131 // Paints the border around the header.
132 void PaintBorder(gfx::Canvas* canvas, Mode mode);
133
126 // Updates the images used for the minimize, restore and close buttons. 134 // Updates the images used for the minimize, restore and close buttons.
127 void UpdateCaptionButtonImages(); 135 void UpdateCaptionButtonImages();
128 136
129 // Returns the header bounds in the coordinates of |header_view_|. The header 137 // Returns the header bounds in the coordinates of |header_view_|. The header
130 // is assumed to be positioned at the top left corner of |header_view_| and to 138 // is assumed to be positioned at the top left corner of |header_view_| and to
131 // have the same width as |header_view_|. 139 // have the same width as |header_view_|.
132 gfx::Rect GetHeaderLocalBounds() const; 140 gfx::Rect GetHeaderLocalBounds() const;
133 141
134 // Returns the offset between window left edge and title string. 142 // Returns the offset between window left edge and title string.
135 int GetTitleOffsetX() const; 143 int GetTitleOffsetX() const;
(...skipping 13 matching lines...) Expand all
149 157
150 // Not owned 158 // Not owned
151 views::Widget* frame_; 159 views::Widget* frame_;
152 views::View* header_view_; 160 views::View* header_view_;
153 views::View* window_icon_; // May be NULL. 161 views::View* window_icon_; // May be NULL.
154 FrameCaptionButtonContainerView* caption_button_container_; 162 FrameCaptionButtonContainerView* caption_button_container_;
155 163
156 // The height of the header. 164 // The height of the header.
157 int header_height_; 165 int header_height_;
158 166
159 // Window frame header/caption parts.
160 const gfx::ImageSkia* top_left_corner_;
161 const gfx::ImageSkia* top_edge_;
162 const gfx::ImageSkia* top_right_corner_;
163 const gfx::ImageSkia* header_left_edge_;
164 const gfx::ImageSkia* header_right_edge_;
165
166 // Image ids and opacity last used for painting header. 167 // Image ids and opacity last used for painting header.
167 int previous_theme_frame_id_; 168 int previous_theme_frame_id_;
168 int previous_theme_frame_overlay_id_; 169 int previous_theme_frame_overlay_id_;
169 170
170 // Image ids and opacity we are crossfading from. 171 // Image ids and opacity we are crossfading from.
171 int crossfade_theme_frame_id_; 172 int crossfade_theme_frame_id_;
172 int crossfade_theme_frame_overlay_id_; 173 int crossfade_theme_frame_overlay_id_;
173 174
174 scoped_ptr<gfx::SlideAnimation> crossfade_animation_; 175 scoped_ptr<gfx::SlideAnimation> crossfade_animation_;
175 176
176 DISALLOW_COPY_AND_ASSIGN(HeaderPainter); 177 DISALLOW_COPY_AND_ASSIGN(HeaderPainter);
177 }; 178 };
178 179
179 } // namespace ash 180 } // namespace ash
180 181
181 #endif // ASH_WM_HEADER_PAINTER_H_ 182 #endif // ASH_WM_HEADER_PAINTER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698