OLD | NEW |
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 "ash/wm/window_state_observer.h" | 9 #include "ash/wm/window_state_observer.h" |
10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
11 #include "base/compiler_specific.h" // OVERRIDE | 11 #include "base/compiler_specific.h" // OVERRIDE |
12 #include "base/gtest_prod_util.h" | 12 #include "base/gtest_prod_util.h" |
13 #include "base/memory/scoped_ptr.h" | 13 #include "base/memory/scoped_ptr.h" |
14 #include "ui/aura/window_observer.h" | 14 #include "ui/aura/window_observer.h" |
15 #include "ui/gfx/animation/animation_delegate.h" | 15 #include "ui/gfx/animation/animation_delegate.h" |
16 #include "ui/gfx/rect.h" | 16 #include "ui/gfx/rect.h" |
17 | 17 |
18 namespace aura { | 18 namespace aura { |
19 class RootWindow; | |
20 class Window; | 19 class Window; |
21 } | 20 } |
22 namespace gfx { | 21 namespace gfx { |
23 class Canvas; | 22 class Canvas; |
24 class Font; | 23 class Font; |
25 class ImageSkia; | 24 class ImageSkia; |
26 class Point; | 25 class Point; |
27 class Size; | 26 class Size; |
28 class SlideAnimation; | 27 class SlideAnimation; |
29 } | 28 } |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
62 void Init(views::Widget* frame, | 61 void Init(views::Widget* frame, |
63 views::View* header_view, | 62 views::View* header_view, |
64 views::View* window_icon, | 63 views::View* window_icon, |
65 FrameCaptionButtonContainerView* caption_button_container); | 64 FrameCaptionButtonContainerView* caption_button_container); |
66 | 65 |
67 // Enable/Disable the solo-window transparent header appearance feature. | 66 // Enable/Disable the solo-window transparent header appearance feature. |
68 static void SetSoloWindowHeadersEnabled(bool enabled); | 67 static void SetSoloWindowHeadersEnabled(bool enabled); |
69 | 68 |
70 // Updates the solo-window transparent header appearance for all windows | 69 // Updates the solo-window transparent header appearance for all windows |
71 // using frame painters in |root_window|. | 70 // using frame painters in |root_window|. |
72 static void UpdateSoloWindowHeader(aura::RootWindow* root_window); | 71 static void UpdateSoloWindowHeader(aura::Window* root_window); |
73 | 72 |
74 // Returns the bounds of the client view for a window with |header_height| | 73 // Returns the bounds of the client view for a window with |header_height| |
75 // and |window_bounds|. The return value and |window_bounds| are in the | 74 // and |window_bounds|. The return value and |window_bounds| are in the |
76 // views::NonClientView's coordinates. | 75 // views::NonClientView's coordinates. |
77 static gfx::Rect GetBoundsForClientView(int header_height, | 76 static gfx::Rect GetBoundsForClientView(int header_height, |
78 const gfx::Rect& window_bounds); | 77 const gfx::Rect& window_bounds); |
79 | 78 |
80 // Returns the bounds of the window given |header_height| and |client_bounds|. | 79 // Returns the bounds of the window given |header_height| and |client_bounds|. |
81 // The return value and |client_bounds| are in the views::NonClientView's | 80 // The return value and |client_bounds| are in the views::NonClientView's |
82 // coordinates. | 81 // coordinates. |
(...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
191 // Returns the radius of the header's top corners. | 190 // Returns the radius of the header's top corners. |
192 int GetHeaderCornerRadius() const; | 191 int GetHeaderCornerRadius() const; |
193 | 192 |
194 // Returns true if |window_->GetRootWindow()| should be drawing transparent | 193 // Returns true if |window_->GetRootWindow()| should be drawing transparent |
195 // window headers. | 194 // window headers. |
196 bool UseSoloWindowHeader() const; | 195 bool UseSoloWindowHeader() const; |
197 | 196 |
198 // Returns true if |root_window| has exactly one visible, normal-type window. | 197 // Returns true if |root_window| has exactly one visible, normal-type window. |
199 // It ignores |ignore_window| while calculating the number of windows. | 198 // It ignores |ignore_window| while calculating the number of windows. |
200 // Pass NULL for |ignore_window| to consider all windows. | 199 // Pass NULL for |ignore_window| to consider all windows. |
201 static bool UseSoloWindowHeaderInRoot(aura::RootWindow* root_window, | 200 static bool UseSoloWindowHeaderInRoot(aura::Window* root_window, |
202 aura::Window* ignore_window); | 201 aura::Window* ignore_window); |
203 | 202 |
204 // Updates the solo-window transparent header appearance for all windows in | 203 // Updates the solo-window transparent header appearance for all windows in |
205 // |root_window|. If |ignore_window| is not NULL it is ignored for when | 204 // |root_window|. If |ignore_window| is not NULL it is ignored for when |
206 // counting visible windows. This is useful for updates when a window is about | 205 // counting visible windows. This is useful for updates when a window is about |
207 // to be closed or is moving to another root. If the solo window status | 206 // to be closed or is moving to another root. If the solo window status |
208 // changes it schedules paints as necessary. | 207 // changes it schedules paints as necessary. |
209 static void UpdateSoloWindowInRoot(aura::RootWindow* root_window, | 208 static void UpdateSoloWindowInRoot(aura::Window* root_window, |
210 aura::Window* ignore_window); | 209 aura::Window* ignore_window); |
211 | 210 |
212 // Schedules a paint for the header. Used when transitioning from no header to | 211 // Schedules a paint for the header. Used when transitioning from no header to |
213 // a header (or other way around). | 212 // a header (or other way around). |
214 void SchedulePaintForHeader(); | 213 void SchedulePaintForHeader(); |
215 | 214 |
216 // Get the bounds for the title. The provided |title_font| is used to | 215 // Get the bounds for the title. The provided |title_font| is used to |
217 // determine the correct dimensions. | 216 // determine the correct dimensions. |
218 gfx::Rect GetTitleBounds(const gfx::Font& title_font); | 217 gfx::Rect GetTitleBounds(const gfx::Font& title_font); |
219 | 218 |
(...skipping 25 matching lines...) Expand all Loading... |
245 int crossfade_opacity_; | 244 int crossfade_opacity_; |
246 | 245 |
247 scoped_ptr<gfx::SlideAnimation> crossfade_animation_; | 246 scoped_ptr<gfx::SlideAnimation> crossfade_animation_; |
248 | 247 |
249 DISALLOW_COPY_AND_ASSIGN(HeaderPainter); | 248 DISALLOW_COPY_AND_ASSIGN(HeaderPainter); |
250 }; | 249 }; |
251 | 250 |
252 } // namespace ash | 251 } // namespace ash |
253 | 252 |
254 #endif // ASH_WM_HEADER_PAINTER_H_ | 253 #endif // ASH_WM_HEADER_PAINTER_H_ |
OLD | NEW |