| 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_HEADER_PAINTER_UTIL_H_ | 5 #ifndef ASH_FRAME_HEADER_PAINTER_UTIL_H_ |
| 6 #define ASH_FRAME_HEADER_PAINTER_UTIL_H_ | 6 #define ASH_FRAME_HEADER_PAINTER_UTIL_H_ |
| 7 | 7 |
| 8 #include "ash/ash_export.h" | 8 #include "ash/ash_export.h" |
| 9 #include "base/macros.h" | 9 #include "base/macros.h" |
| 10 | 10 |
| 11 namespace gfx { | 11 namespace gfx { |
| 12 class FontList; | 12 class FontList; |
| 13 class Rect; | 13 class Rect; |
| 14 } | 14 } |
| 15 namespace views { | 15 namespace views { |
| 16 class View; | 16 class View; |
| 17 class Widget; | 17 class Widget; |
| 18 } | 18 } |
| 19 | 19 |
| 20 namespace ash { | 20 namespace ash { |
| 21 | 21 |
| 22 // Static-only helper class for functionality used accross multiple | 22 // Static-only helper class for functionality used accross multiple |
| 23 // implementations of HeaderPainter. | 23 // implementations of HeaderPainter. |
| 24 class ASH_EXPORT HeaderPainterUtil { | 24 class ASH_EXPORT HeaderPainterUtil { |
| 25 public: | 25 public: |
| 26 // Returns the radius of the header's corners when the window is restored. | 26 // Returns the radius of the header's corners when the window is restored. |
| 27 static int GetTopCornerRadiusWhenRestored(); | 27 static int GetTopCornerRadiusWhenRestored(); |
| 28 | 28 |
| 29 // Returns the distance between the left edge of the window and the header | 29 // Returns the default distance between the left edge of the window and the |
| 30 // icon. | 30 // leftmost view in the header. |
| 31 static int GetIconXOffset(); | 31 static int GetDefaultLeftViewXInset(); |
| 32 | |
| 33 // Returns the size of the header icon. | |
| 34 static int GetDefaultIconSize(); | |
| 35 | 32 |
| 36 // Returns the amount that the frame background is inset from the left edge of | 33 // Returns the amount that the frame background is inset from the left edge of |
| 37 // the window. | 34 // the window. |
| 38 static int GetThemeBackgroundXInset(); | 35 static int GetThemeBackgroundXInset(); |
| 39 | 36 |
| 40 // Returns the bounds for the header's title given the header icon, the | 37 // Returns the bounds for the header's title given the views to the left and |
| 41 // caption button container and the font used. | 38 // right of the title, and the font used. |
| 42 // |icon| should be NULL if the header does not use an icon. | 39 // |left_view| should be NULL if there is no view to the left of the title. |
| 43 static gfx::Rect GetTitleBounds(const views::View* icon, | 40 static gfx::Rect GetTitleBounds(const views::View* left_view, |
| 44 const views::View* caption_button_container, | 41 const views::View* right_view, |
| 45 const gfx::FontList& title_font_list); | 42 const gfx::FontList& title_font_list); |
| 46 | 43 |
| 47 // Returns true if the header for |widget| can animate to new visuals when the | 44 // Returns true if the header for |widget| can animate to new visuals when the |
| 48 // widget's activation changes. Returns false if the header should switch to | 45 // widget's activation changes. Returns false if the header should switch to |
| 49 // new visuals instantaneously. | 46 // new visuals instantaneously. |
| 50 static bool CanAnimateActivation(views::Widget* widget); | 47 static bool CanAnimateActivation(views::Widget* widget); |
| 51 | 48 |
| 52 private: | 49 private: |
| 53 DISALLOW_IMPLICIT_CONSTRUCTORS(HeaderPainterUtil); | 50 DISALLOW_IMPLICIT_CONSTRUCTORS(HeaderPainterUtil); |
| 54 }; | 51 }; |
| 55 | 52 |
| 56 } // namespace ash | 53 } // namespace ash |
| 57 | 54 |
| 58 #endif // ASH_FRAME_HEADER_PAINTER_UTIL_H_ | 55 #endif // ASH_FRAME_HEADER_PAINTER_UTIL_H_ |
| OLD | NEW |