| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 UI_VIEWS_WINDOW_FRAME_BACKGROUND_H_ | 5 #ifndef UI_VIEWS_WINDOW_FRAME_BACKGROUND_H_ |
| 6 #define UI_VIEWS_WINDOW_FRAME_BACKGROUND_H_ | 6 #define UI_VIEWS_WINDOW_FRAME_BACKGROUND_H_ |
| 7 | 7 |
| 8 #include "base/macros.h" | 8 #include "base/macros.h" |
| 9 #include "third_party/skia/include/core/SkColor.h" | 9 #include "third_party/skia/include/core/SkColor.h" |
| 10 #include "ui/gfx/image/image_skia.h" | 10 #include "ui/gfx/image/image_skia.h" |
| (...skipping 11 matching lines...) Expand all Loading... |
| 22 // support in Chrome. It intends to consolidate paint code that historically | 22 // support in Chrome. It intends to consolidate paint code that historically |
| 23 // was copied. One frame to rule them all! | 23 // was copied. One frame to rule them all! |
| 24 class VIEWS_EXPORT FrameBackground { | 24 class VIEWS_EXPORT FrameBackground { |
| 25 public: | 25 public: |
| 26 FrameBackground(); | 26 FrameBackground(); |
| 27 ~FrameBackground(); | 27 ~FrameBackground(); |
| 28 | 28 |
| 29 // Sets the color to draw under the frame images. | 29 // Sets the color to draw under the frame images. |
| 30 void set_frame_color(SkColor color) { frame_color_ = color; } | 30 void set_frame_color(SkColor color) { frame_color_ = color; } |
| 31 | 31 |
| 32 void set_use_custom_frame(bool use_custom_frame) { |
| 33 use_custom_frame_ = use_custom_frame; |
| 34 } |
| 35 |
| 36 // Sets whether the frame to be drawn should have focus. |
| 37 void set_is_active(bool is_active) { is_active_ = is_active; } |
| 38 |
| 39 // Sets whether the frame to be drawn is in incognito mode. |
| 40 void set_incognito(bool incognito) { incognito_ = incognito; } |
| 41 |
| 32 // Sets the theme image for the top of the window. May be null (empty). | 42 // Sets the theme image for the top of the window. May be null (empty). |
| 33 // Memory is owned by the caller. | 43 // Memory is owned by the caller. |
| 34 void set_theme_image(const gfx::ImageSkia& image) { theme_image_ = image; } | 44 void set_theme_image(const gfx::ImageSkia& image) { theme_image_ = image; } |
| 35 | 45 |
| 36 // Sets an image that overlays the top window image. Usually used to add | 46 // Sets an image that overlays the top window image. Usually used to add |
| 37 // edge highlighting to provide the illusion of depth. May be null (empty). | 47 // edge highlighting to provide the illusion of depth. May be null (empty). |
| 38 // Memory is owned by the caller. | 48 // Memory is owned by the caller. |
| 39 void set_theme_overlay_image(const gfx::ImageSkia& image) { | 49 void set_theme_overlay_image(const gfx::ImageSkia& image) { |
| 40 theme_overlay_image_ = image; | 50 theme_overlay_image_ = image; |
| 41 } | 51 } |
| (...skipping 25 matching lines...) Expand all Loading... |
| 67 void PaintRestored(gfx::Canvas* canvas, const View* view) const; | 77 void PaintRestored(gfx::Canvas* canvas, const View* view) const; |
| 68 | 78 |
| 69 // Paints the border for a maximized window, which does not include the | 79 // Paints the border for a maximized window, which does not include the |
| 70 // window edges. | 80 // window edges. |
| 71 void PaintMaximized(gfx::Canvas* canvas, const View* view) const; | 81 void PaintMaximized(gfx::Canvas* canvas, const View* view) const; |
| 72 | 82 |
| 73 private: | 83 private: |
| 74 // Fills the frame area with the frame color. | 84 // Fills the frame area with the frame color. |
| 75 void PaintFrameColor(gfx::Canvas* canvas, const View* view) const; | 85 void PaintFrameColor(gfx::Canvas* canvas, const View* view) const; |
| 76 | 86 |
| 87 // Paints the background of the tab strip. |
| 88 void PaintFrameTopArea(gfx::Canvas* canvas, const View* view) const; |
| 89 |
| 77 SkColor frame_color_; | 90 SkColor frame_color_; |
| 91 bool use_custom_frame_; |
| 92 bool is_active_; |
| 93 bool incognito_; |
| 78 gfx::ImageSkia theme_image_; | 94 gfx::ImageSkia theme_image_; |
| 79 gfx::ImageSkia theme_overlay_image_; | 95 gfx::ImageSkia theme_overlay_image_; |
| 80 int top_area_height_; | 96 int top_area_height_; |
| 81 | 97 |
| 82 // Images for the sides of the frame. | 98 // Images for the sides of the frame. |
| 83 const gfx::ImageSkia* left_edge_; | 99 const gfx::ImageSkia* left_edge_; |
| 84 const gfx::ImageSkia* top_edge_; | 100 const gfx::ImageSkia* top_edge_; |
| 85 const gfx::ImageSkia* right_edge_; | 101 const gfx::ImageSkia* right_edge_; |
| 86 const gfx::ImageSkia* bottom_edge_; | 102 const gfx::ImageSkia* bottom_edge_; |
| 87 | 103 |
| 88 // Images for the corners of the frame. | 104 // Images for the corners of the frame. |
| 89 const gfx::ImageSkia* top_left_corner_; | 105 const gfx::ImageSkia* top_left_corner_; |
| 90 const gfx::ImageSkia* top_right_corner_; | 106 const gfx::ImageSkia* top_right_corner_; |
| 91 const gfx::ImageSkia* bottom_left_corner_; | 107 const gfx::ImageSkia* bottom_left_corner_; |
| 92 const gfx::ImageSkia* bottom_right_corner_; | 108 const gfx::ImageSkia* bottom_right_corner_; |
| 93 | 109 |
| 94 // Vertical inset for theme image when drawing maximized. | 110 // Vertical inset for theme image when drawing maximized. |
| 95 int maximized_top_inset_; | 111 int maximized_top_inset_; |
| 96 | 112 |
| 97 DISALLOW_COPY_AND_ASSIGN(FrameBackground); | 113 DISALLOW_COPY_AND_ASSIGN(FrameBackground); |
| 98 }; | 114 }; |
| 99 | 115 |
| 100 } // namespace views | 116 } // namespace views |
| 101 | 117 |
| 102 #endif // UI_VIEWS_WINDOW_FRAME_BACKGROUND_H_ | 118 #endif // UI_VIEWS_WINDOW_FRAME_BACKGROUND_H_ |
| OLD | NEW |