Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(150)

Side by Side Diff: chrome/browser/ui/views/frame/opaque_browser_frame_view.h

Issue 8772060: Refactor window frame painting into a window background class (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: final cleanup of PaintRestored Created 9 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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 #pragma once 7 #pragma once
8 8
9 #include "base/memory/scoped_ptr.h" 9 #include "base/memory/scoped_ptr.h"
10 #include "chrome/browser/ui/views/frame/browser_frame.h" 10 #include "chrome/browser/ui/views/frame/browser_frame.h"
11 #include "chrome/browser/ui/views/frame/browser_non_client_frame_view.h" 11 #include "chrome/browser/ui/views/frame/browser_non_client_frame_view.h"
12 #include "chrome/browser/ui/views/tab_icon_view.h" 12 #include "chrome/browser/ui/views/tab_icon_view.h"
13 #include "content/public/browser/notification_observer.h" 13 #include "content/public/browser/notification_observer.h"
14 #include "content/public/browser/notification_registrar.h" 14 #include "content/public/browser/notification_registrar.h"
15 #include "ui/views/controls/button/button.h" 15 #include "ui/views/controls/button/button.h"
16 #include "ui/views/window/non_client_view.h" 16 #include "ui/views/window/non_client_view.h"
17 17
18 class BrowserView; 18 class BrowserView;
19 namespace views { 19 namespace views {
20 class ImageButton; 20 class ImageButton;
21 class FrameBackground;
21 } 22 }
22 23
23 class OpaqueBrowserFrameView : public BrowserNonClientFrameView, 24 class OpaqueBrowserFrameView : public BrowserNonClientFrameView,
24 public content::NotificationObserver, 25 public content::NotificationObserver,
25 public views::ButtonListener, 26 public views::ButtonListener,
26 public TabIconView::TabIconViewModel { 27 public TabIconView::TabIconViewModel {
27 public: 28 public:
28 // Constructs a non-client view for an BrowserFrame. 29 // Constructs a non-client view for an BrowserFrame.
29 OpaqueBrowserFrameView(BrowserFrame* frame, BrowserView* browser_view); 30 OpaqueBrowserFrameView(BrowserFrame* frame, BrowserView* browser_view);
30 virtual ~OpaqueBrowserFrameView(); 31 virtual ~OpaqueBrowserFrameView();
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after
124 125
125 // Paint various sub-components of this view. The *FrameBorder() functions 126 // Paint various sub-components of this view. The *FrameBorder() functions
126 // also paint the background of the titlebar area, since the top frame border 127 // also paint the background of the titlebar area, since the top frame border
127 // and titlebar background are a contiguous component. 128 // and titlebar background are a contiguous component.
128 void PaintRestoredFrameBorder(gfx::Canvas* canvas); 129 void PaintRestoredFrameBorder(gfx::Canvas* canvas);
129 void PaintMaximizedFrameBorder(gfx::Canvas* canvas); 130 void PaintMaximizedFrameBorder(gfx::Canvas* canvas);
130 void PaintTitleBar(gfx::Canvas* canvas); 131 void PaintTitleBar(gfx::Canvas* canvas);
131 void PaintToolbarBackground(gfx::Canvas* canvas); 132 void PaintToolbarBackground(gfx::Canvas* canvas);
132 void PaintRestoredClientEdge(gfx::Canvas* canvas); 133 void PaintRestoredClientEdge(gfx::Canvas* canvas);
133 134
134 // Returns the properly themed bitmap and frame color, given various 135 // Compute aspects of the frame needed to paint the frame background.
135 // attributes of this view (normal browser or not, OTR or not, active or not). 136 SkColor GetFrameColor() const;
136 SkBitmap* GetFrameBitmap() const; 137 SkBitmap* GetFrameBitmap() const;
137 SkColor GetFrameColor() const; 138 SkBitmap* GetFrameOverlayBitmap() const;
139 int GetTopAreaHeight() const;
138 140
139 // Layout various sub-components of this view. 141 // Layout various sub-components of this view.
140 void LayoutWindowControls(); 142 void LayoutWindowControls();
141 void LayoutTitleBar(); 143 void LayoutTitleBar();
142 void LayoutAvatar(); 144 void LayoutAvatar();
143 145
144 // Returns the bounds of the client area for the specified view size. 146 // Returns the bounds of the client area for the specified view size.
145 gfx::Rect CalculateClientAreaBounds(int width, int height) const; 147 gfx::Rect CalculateClientAreaBounds(int width, int height) const;
146 148
147 // The layout rect of the title, if visible. 149 // The layout rect of the title, if visible.
148 gfx::Rect title_bounds_; 150 gfx::Rect title_bounds_;
149 151
150 // The layout rect of the avatar icon, if visible. 152 // The layout rect of the avatar icon, if visible.
151 gfx::Rect avatar_bounds_; 153 gfx::Rect avatar_bounds_;
152 154
153 // Window controls. 155 // Window controls.
154 views::ImageButton* minimize_button_; 156 views::ImageButton* minimize_button_;
155 views::ImageButton* maximize_button_; 157 views::ImageButton* maximize_button_;
156 views::ImageButton* restore_button_; 158 views::ImageButton* restore_button_;
157 views::ImageButton* close_button_; 159 views::ImageButton* close_button_;
158 160
159 // The Window icon. 161 // The Window icon.
160 TabIconView* window_icon_; 162 TabIconView* window_icon_;
161 163
162 // The bounds of the ClientView. 164 // The bounds of the ClientView.
163 gfx::Rect client_view_bounds_; 165 gfx::Rect client_view_bounds_;
164 166
165 content::NotificationRegistrar registrar_; 167 content::NotificationRegistrar registrar_;
166 168
169 // Background painter for the window frame.
170 scoped_ptr<views::FrameBackground> frame_background_;
171
167 DISALLOW_COPY_AND_ASSIGN(OpaqueBrowserFrameView); 172 DISALLOW_COPY_AND_ASSIGN(OpaqueBrowserFrameView);
168 }; 173 };
169 174
170 #endif // CHROME_BROWSER_UI_VIEWS_FRAME_OPAQUE_BROWSER_FRAME_VIEW_H_ 175 #endif // CHROME_BROWSER_UI_VIEWS_FRAME_OPAQUE_BROWSER_FRAME_VIEW_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698