| 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 ASH_WM_FRAME_PAINTER_H_ | 5 #ifndef ASH_WM_FRAME_PAINTER_H_ |
| 6 #define ASH_WM_FRAME_PAINTER_H_ | 6 #define ASH_WM_FRAME_PAINTER_H_ |
| 7 #pragma once | 7 #pragma once |
| 8 | 8 |
| 9 #include <set> | 9 #include <set> |
| 10 | 10 |
| (...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 100 const gfx::Font& title_font); | 100 const gfx::Font& title_font); |
| 101 | 101 |
| 102 // Performs layout for the header based on whether we want the shorter | 102 // Performs layout for the header based on whether we want the shorter |
| 103 // |maximized_layout| appearance. | 103 // |maximized_layout| appearance. |
| 104 void LayoutHeader(views::NonClientFrameView* view, bool maximized_layout); | 104 void LayoutHeader(views::NonClientFrameView* view, bool maximized_layout); |
| 105 | 105 |
| 106 // aura::WindowObserver overrides: | 106 // aura::WindowObserver overrides: |
| 107 virtual void OnWindowPropertyChanged(aura::Window* window, | 107 virtual void OnWindowPropertyChanged(aura::Window* window, |
| 108 const void* key, | 108 const void* key, |
| 109 intptr_t old) OVERRIDE; | 109 intptr_t old) OVERRIDE; |
| 110 virtual void OnWindowVisibilityChanged(aura::Window* window, |
| 111 bool visible) OVERRIDE; |
| 110 virtual void OnWindowDestroying(aura::Window* window) OVERRIDE; | 112 virtual void OnWindowDestroying(aura::Window* window) OVERRIDE; |
| 111 | 113 |
| 112 private: | 114 private: |
| 113 FRIEND_TEST_ALL_PREFIXES(FramePainterTest, Basics); | 115 FRIEND_TEST_ALL_PREFIXES(FramePainterTest, Basics); |
| 114 FRIEND_TEST_ALL_PREFIXES(FramePainterTest, UseSoloWindowHeader); | 116 FRIEND_TEST_ALL_PREFIXES(FramePainterTest, UseSoloWindowHeader); |
| 115 | 117 |
| 116 // Sets the images for a button base on IDs from the |frame_| theme provider. | 118 // Sets the images for a button base on IDs from the |frame_| theme provider. |
| 117 void SetButtonImages(views::ImageButton* button, | 119 void SetButtonImages(views::ImageButton* button, |
| 118 int normal_bitmap_id, | 120 int normal_bitmap_id, |
| 119 int hot_bitmap_id, | 121 int hot_bitmap_id, |
| 120 int pushed_bitmap_id); | 122 int pushed_bitmap_id); |
| 121 | 123 |
| 122 // Returns the offset between window left edge and title string. | 124 // Returns the offset between window left edge and title string. |
| 123 int GetTitleOffsetX() const; | 125 int GetTitleOffsetX() const; |
| 124 | 126 |
| 125 // Returns true if there is exactly one visible, normal-type window using | 127 // Returns true if there is exactly one visible, normal-type window using |
| 126 // a header painted by this class, in which case we should paint a transparent | 128 // a header painted by this class, in which case we should paint a transparent |
| 127 // window header. | 129 // window header. |
| 128 static bool UseSoloWindowHeader(); | 130 static bool UseSoloWindowHeader(); |
| 129 | 131 |
| 132 // Schedules a paint for the window header of the solo window. Invoke this |
| 133 // when another window is hidden or destroyed to force the transparency of |
| 134 // the now-solo window to update. |
| 135 static void SchedulePaintForSoloWindow(); |
| 136 |
| 130 static std::set<FramePainter*>* instances_; | 137 static std::set<FramePainter*>* instances_; |
| 131 | 138 |
| 132 // Not owned | 139 // Not owned |
| 133 views::Widget* frame_; | 140 views::Widget* frame_; |
| 134 views::View* window_icon_; // May be NULL. | 141 views::View* window_icon_; // May be NULL. |
| 135 views::ImageButton* size_button_; | 142 views::ImageButton* size_button_; |
| 136 views::ImageButton* close_button_; | 143 views::ImageButton* close_button_; |
| 137 aura::Window* window_; | 144 aura::Window* window_; |
| 138 | 145 |
| 139 // Window frame header/caption parts. | 146 // Window frame header/caption parts. |
| 140 const SkBitmap* button_separator_; | 147 const SkBitmap* button_separator_; |
| 141 const SkBitmap* top_left_corner_; | 148 const SkBitmap* top_left_corner_; |
| 142 const SkBitmap* top_edge_; | 149 const SkBitmap* top_edge_; |
| 143 const SkBitmap* top_right_corner_; | 150 const SkBitmap* top_right_corner_; |
| 144 const SkBitmap* header_left_edge_; | 151 const SkBitmap* header_left_edge_; |
| 145 const SkBitmap* header_right_edge_; | 152 const SkBitmap* header_right_edge_; |
| 146 | 153 |
| 147 SizeButtonBehavior size_button_behavior_; | 154 SizeButtonBehavior size_button_behavior_; |
| 148 | 155 |
| 149 DISALLOW_COPY_AND_ASSIGN(FramePainter); | 156 DISALLOW_COPY_AND_ASSIGN(FramePainter); |
| 150 }; | 157 }; |
| 151 | 158 |
| 152 } // namespace ash | 159 } // namespace ash |
| 153 | 160 |
| 154 #endif // ASH_WM_FRAME_PAINTER_H_ | 161 #endif // ASH_WM_FRAME_PAINTER_H_ |
| OLD | NEW |