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 CHROME_BROWSER_UI_VIEWS_FRAME_OPAQUE_BROWSER_FRAME_VIEW_H_ | 5 #ifndef CHROME_BROWSER_UI_VIEWS_FRAME_OPAQUE_BROWSER_FRAME_VIEW_H_ |
6 #define CHROME_BROWSER_UI_VIEWS_FRAME_OPAQUE_BROWSER_FRAME_VIEW_H_ | 6 #define CHROME_BROWSER_UI_VIEWS_FRAME_OPAQUE_BROWSER_FRAME_VIEW_H_ |
7 | 7 |
8 #include "base/memory/scoped_ptr.h" | 8 #include "base/memory/scoped_ptr.h" |
9 #include "chrome/browser/ui/views/frame/browser_frame.h" | 9 #include "chrome/browser/ui/views/frame/browser_frame.h" |
10 #include "chrome/browser/ui/views/frame/browser_non_client_frame_view.h" | 10 #include "chrome/browser/ui/views/frame/browser_non_client_frame_view.h" |
11 #include "chrome/browser/ui/views/tab_icon_view_model.h" | 11 #include "chrome/browser/ui/views/tab_icon_view_model.h" |
12 #include "content/public/browser/notification_observer.h" | 12 #include "content/public/browser/notification_observer.h" |
13 #include "content/public/browser/notification_registrar.h" | 13 #include "content/public/browser/notification_registrar.h" |
14 #include "ui/views/controls/button/button.h" | 14 #include "ui/views/controls/button/button.h" |
15 #include "ui/views/window/non_client_view.h" | 15 #include "ui/views/window/non_client_view.h" |
16 | 16 |
17 class BrowserView; | 17 class BrowserView; |
18 class TabIconView; | 18 class TabIconView; |
19 | 19 |
20 namespace views { | 20 namespace views { |
21 class ImageButton; | 21 class ImageButton; |
22 class FrameBackground; | 22 class FrameBackground; |
| 23 class Label; |
23 } | 24 } |
24 | 25 |
25 class OpaqueBrowserFrameView : public BrowserNonClientFrameView, | 26 class OpaqueBrowserFrameView : public BrowserNonClientFrameView, |
26 public content::NotificationObserver, | 27 public content::NotificationObserver, |
27 public views::ButtonListener, | 28 public views::ButtonListener, |
28 public chrome::TabIconViewModel { | 29 public chrome::TabIconViewModel { |
29 public: | 30 public: |
30 // Constructs a non-client view for an BrowserFrame. | 31 // Constructs a non-client view for an BrowserFrame. |
31 OpaqueBrowserFrameView(BrowserFrame* frame, BrowserView* browser_view); | 32 OpaqueBrowserFrameView(BrowserFrame* frame, BrowserView* browser_view); |
32 virtual ~OpaqueBrowserFrameView(); | 33 virtual ~OpaqueBrowserFrameView(); |
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
123 gfx::Rect IconBounds() const; | 124 gfx::Rect IconBounds() const; |
124 | 125 |
125 // Returns the combined bounds for the tab strip and avatar area. | 126 // Returns the combined bounds for the tab strip and avatar area. |
126 gfx::Rect GetBoundsForTabStripAndAvatarArea(views::View* tabstrip) const; | 127 gfx::Rect GetBoundsForTabStripAndAvatarArea(views::View* tabstrip) const; |
127 | 128 |
128 // Paint various sub-components of this view. The *FrameBorder() functions | 129 // Paint various sub-components of this view. The *FrameBorder() functions |
129 // also paint the background of the titlebar area, since the top frame border | 130 // also paint the background of the titlebar area, since the top frame border |
130 // and titlebar background are a contiguous component. | 131 // and titlebar background are a contiguous component. |
131 void PaintRestoredFrameBorder(gfx::Canvas* canvas); | 132 void PaintRestoredFrameBorder(gfx::Canvas* canvas); |
132 void PaintMaximizedFrameBorder(gfx::Canvas* canvas); | 133 void PaintMaximizedFrameBorder(gfx::Canvas* canvas); |
133 void PaintTitleBar(gfx::Canvas* canvas); | |
134 void PaintToolbarBackground(gfx::Canvas* canvas); | 134 void PaintToolbarBackground(gfx::Canvas* canvas); |
135 void PaintRestoredClientEdge(gfx::Canvas* canvas); | 135 void PaintRestoredClientEdge(gfx::Canvas* canvas); |
136 | 136 |
137 // Compute aspects of the frame needed to paint the frame background. | 137 // Compute aspects of the frame needed to paint the frame background. |
138 SkColor GetFrameColor() const; | 138 SkColor GetFrameColor() const; |
139 gfx::ImageSkia* GetFrameImage() const; | 139 gfx::ImageSkia* GetFrameImage() const; |
140 gfx::ImageSkia* GetFrameOverlayImage() const; | 140 gfx::ImageSkia* GetFrameOverlayImage() const; |
141 int GetTopAreaHeight() const; | 141 int GetTopAreaHeight() const; |
142 | 142 |
143 // Layout various sub-components of this view. | 143 // Layout various sub-components of this view. |
144 void LayoutWindowControls(); | 144 void LayoutWindowControls(); |
145 void LayoutTitleBar(); | 145 void LayoutTitleBar(); |
146 void LayoutAvatar(); | 146 void LayoutAvatar(); |
147 | 147 |
148 // Returns the bounds of the client area for the specified view size. | 148 // Returns the bounds of the client area for the specified view size. |
149 gfx::Rect CalculateClientAreaBounds(int width, int height) const; | 149 gfx::Rect CalculateClientAreaBounds(int width, int height) const; |
150 | 150 |
151 // The layout rect of the title, if visible. | |
152 gfx::Rect title_bounds_; | |
153 | |
154 // The layout rect of the avatar icon, if visible. | 151 // The layout rect of the avatar icon, if visible. |
155 gfx::Rect avatar_bounds_; | 152 gfx::Rect avatar_bounds_; |
156 | 153 |
157 // Window controls. | 154 // Window controls. |
158 views::ImageButton* minimize_button_; | 155 views::ImageButton* minimize_button_; |
159 views::ImageButton* maximize_button_; | 156 views::ImageButton* maximize_button_; |
160 views::ImageButton* restore_button_; | 157 views::ImageButton* restore_button_; |
161 views::ImageButton* close_button_; | 158 views::ImageButton* close_button_; |
162 | 159 |
163 // The Window icon. | 160 // The window icon and title. |
164 TabIconView* window_icon_; | 161 TabIconView* window_icon_; |
| 162 views::Label* window_title_; |
165 | 163 |
166 // The bounds of the ClientView. | 164 // The bounds of the ClientView. |
167 gfx::Rect client_view_bounds_; | 165 gfx::Rect client_view_bounds_; |
168 | 166 |
169 content::NotificationRegistrar registrar_; | 167 content::NotificationRegistrar registrar_; |
170 | 168 |
171 // Background painter for the window frame. | 169 // Background painter for the window frame. |
172 scoped_ptr<views::FrameBackground> frame_background_; | 170 scoped_ptr<views::FrameBackground> frame_background_; |
173 | 171 |
174 DISALLOW_COPY_AND_ASSIGN(OpaqueBrowserFrameView); | 172 DISALLOW_COPY_AND_ASSIGN(OpaqueBrowserFrameView); |
175 }; | 173 }; |
176 | 174 |
177 #endif // CHROME_BROWSER_UI_VIEWS_FRAME_OPAQUE_BROWSER_FRAME_VIEW_H_ | 175 #endif // CHROME_BROWSER_UI_VIEWS_FRAME_OPAQUE_BROWSER_FRAME_VIEW_H_ |
OLD | NEW |