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

Side by Side Diff: chrome/browser/ui/views/constrained_window_views.cc

Issue 6975037: Revert 85666 - Consolidate ShouldUseNativeFrame/AlwaysUseNativeFrame/UseNativeFrame spaghetti. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 9 years, 7 months 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 #include "chrome/browser/ui/views/constrained_window_views.h" 5 #include "chrome/browser/ui/views/constrained_window_views.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 8
9 #include "chrome/app/chrome_command_ids.h" 9 #include "chrome/app/chrome_command_ids.h"
10 #include "chrome/browser/profiles/profile.h" 10 #include "chrome/browser/profiles/profile.h"
(...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after
148 : public views::NonClientFrameView, 148 : public views::NonClientFrameView,
149 public views::ButtonListener { 149 public views::ButtonListener {
150 public: 150 public:
151 explicit ConstrainedWindowFrameView(ConstrainedWindowViews* container); 151 explicit ConstrainedWindowFrameView(ConstrainedWindowViews* container);
152 virtual ~ConstrainedWindowFrameView(); 152 virtual ~ConstrainedWindowFrameView();
153 153
154 void UpdateWindowTitle(); 154 void UpdateWindowTitle();
155 155
156 // Overridden from views::NonClientFrameView: 156 // Overridden from views::NonClientFrameView:
157 virtual gfx::Rect GetBoundsForClientView() const OVERRIDE; 157 virtual gfx::Rect GetBoundsForClientView() const OVERRIDE;
158 virtual bool AlwaysUseCustomFrame() const OVERRIDE;
158 virtual gfx::Rect GetWindowBoundsForClientBounds( 159 virtual gfx::Rect GetWindowBoundsForClientBounds(
159 const gfx::Rect& client_bounds) const OVERRIDE; 160 const gfx::Rect& client_bounds) const OVERRIDE;
160 virtual int NonClientHitTest(const gfx::Point& point) OVERRIDE; 161 virtual int NonClientHitTest(const gfx::Point& point) OVERRIDE;
161 virtual void GetWindowMask(const gfx::Size& size, gfx::Path* window_mask) 162 virtual void GetWindowMask(const gfx::Size& size, gfx::Path* window_mask)
162 OVERRIDE; 163 OVERRIDE;
163 virtual void EnableClose(bool enable) OVERRIDE; 164 virtual void EnableClose(bool enable) OVERRIDE;
164 virtual void ResetWindowControls() OVERRIDE {} 165 virtual void ResetWindowControls() OVERRIDE {}
165 virtual void UpdateWindowIcon() OVERRIDE {} 166 virtual void UpdateWindowIcon() OVERRIDE {}
166 167
167 // Overridden from views::View: 168 // Overridden from views::View:
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after
265 // ConstrainedWindowFrameView, public: 266 // ConstrainedWindowFrameView, public:
266 267
267 ConstrainedWindowFrameView::ConstrainedWindowFrameView( 268 ConstrainedWindowFrameView::ConstrainedWindowFrameView(
268 ConstrainedWindowViews* container) 269 ConstrainedWindowViews* container)
269 : NonClientFrameView(), 270 : NonClientFrameView(),
270 container_(container), 271 container_(container),
271 close_button_(new views::ImageButton(this)) { 272 close_button_(new views::ImageButton(this)) {
272 InitClass(); 273 InitClass();
273 InitWindowResources(); 274 InitWindowResources();
274 275
275 // Constrained windows always use the custom frame - they just have a
276 // different set of bitmaps.
277 container->set_frame_type(views::Window::FRAME_TYPE_FORCE_CUSTOM);
278
279 ResourceBundle& rb = ResourceBundle::GetSharedInstance(); 276 ResourceBundle& rb = ResourceBundle::GetSharedInstance();
280 close_button_->SetImage(views::CustomButton::BS_NORMAL, 277 close_button_->SetImage(views::CustomButton::BS_NORMAL,
281 rb.GetBitmapNamed(IDR_CLOSE_SA)); 278 rb.GetBitmapNamed(IDR_CLOSE_SA));
282 close_button_->SetImage(views::CustomButton::BS_HOT, 279 close_button_->SetImage(views::CustomButton::BS_HOT,
283 rb.GetBitmapNamed(IDR_CLOSE_SA_H)); 280 rb.GetBitmapNamed(IDR_CLOSE_SA_H));
284 close_button_->SetImage(views::CustomButton::BS_PUSHED, 281 close_button_->SetImage(views::CustomButton::BS_PUSHED,
285 rb.GetBitmapNamed(IDR_CLOSE_SA_P)); 282 rb.GetBitmapNamed(IDR_CLOSE_SA_P));
286 close_button_->SetImageAlignment(views::ImageButton::ALIGN_CENTER, 283 close_button_->SetImageAlignment(views::ImageButton::ALIGN_CENTER,
287 views::ImageButton::ALIGN_MIDDLE); 284 views::ImageButton::ALIGN_MIDDLE);
288 AddChildView(close_button_); 285 AddChildView(close_button_);
289 } 286 }
290 287
291 ConstrainedWindowFrameView::~ConstrainedWindowFrameView() { 288 ConstrainedWindowFrameView::~ConstrainedWindowFrameView() {
292 } 289 }
293 290
294 void ConstrainedWindowFrameView::UpdateWindowTitle() { 291 void ConstrainedWindowFrameView::UpdateWindowTitle() {
295 SchedulePaintInRect(title_bounds_); 292 SchedulePaintInRect(title_bounds_);
296 } 293 }
297 294
298 //////////////////////////////////////////////////////////////////////////////// 295 ////////////////////////////////////////////////////////////////////////////////
299 // ConstrainedWindowFrameView, views::NonClientFrameView implementation: 296 // ConstrainedWindowFrameView, views::NonClientFrameView implementation:
300 297
301 gfx::Rect ConstrainedWindowFrameView::GetBoundsForClientView() const { 298 gfx::Rect ConstrainedWindowFrameView::GetBoundsForClientView() const {
302 return client_view_bounds_; 299 return client_view_bounds_;
303 } 300 }
304 301
302 bool ConstrainedWindowFrameView::AlwaysUseCustomFrame() const {
303 // Constrained windows always use the custom frame - they just have a
304 // different set of bitmaps.
305 return true;
306 }
307
305 gfx::Rect ConstrainedWindowFrameView::GetWindowBoundsForClientBounds( 308 gfx::Rect ConstrainedWindowFrameView::GetWindowBoundsForClientBounds(
306 const gfx::Rect& client_bounds) const { 309 const gfx::Rect& client_bounds) const {
307 int top_height = NonClientTopBorderHeight(); 310 int top_height = NonClientTopBorderHeight();
308 int border_thickness = NonClientBorderThickness(); 311 int border_thickness = NonClientBorderThickness();
309 return gfx::Rect(std::max(0, client_bounds.x() - border_thickness), 312 return gfx::Rect(std::max(0, client_bounds.x() - border_thickness),
310 std::max(0, client_bounds.y() - top_height), 313 std::max(0, client_bounds.y() - top_height),
311 client_bounds.width() + (2 * border_thickness), 314 client_bounds.width() + (2 * border_thickness),
312 client_bounds.height() + top_height + border_thickness); 315 client_bounds.height() + top_height + border_thickness);
313 } 316 }
314 317
(...skipping 333 matching lines...) Expand 10 before | Expand all | Expand 10 after
648 651
649 //////////////////////////////////////////////////////////////////////////////// 652 ////////////////////////////////////////////////////////////////////////////////
650 // ConstrainedWindow, public: 653 // ConstrainedWindow, public:
651 654
652 // static 655 // static
653 ConstrainedWindow* ConstrainedWindow::CreateConstrainedDialog( 656 ConstrainedWindow* ConstrainedWindow::CreateConstrainedDialog(
654 TabContents* parent, 657 TabContents* parent,
655 views::WindowDelegate* window_delegate) { 658 views::WindowDelegate* window_delegate) {
656 return new ConstrainedWindowViews(parent, window_delegate); 659 return new ConstrainedWindowViews(parent, window_delegate);
657 } 660 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/panels/panel_browser_frame_view.cc ('k') | chrome/browser/ui/views/frame/app_panel_browser_frame_view.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698