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

Side by Side Diff: chrome/browser/ui/views/frame/app_panel_browser_frame_view.cc

Issue 7036014: 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/frame/app_panel_browser_frame_view.h" 5 #include "chrome/browser/ui/views/frame/app_panel_browser_frame_view.h"
6 6
7 #include "base/compiler_specific.h" 7 #include "base/compiler_specific.h"
8 #include "base/utf_string_conversions.h" 8 #include "base/utf_string_conversions.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_view.h" 10 #include "chrome/browser/ui/views/frame/browser_view.h"
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
58 BrowserView* browser_view) 58 BrowserView* browser_view)
59 : BrowserNonClientFrameView(), 59 : BrowserNonClientFrameView(),
60 ALLOW_THIS_IN_INITIALIZER_LIST( 60 ALLOW_THIS_IN_INITIALIZER_LIST(
61 close_button_(new views::ImageButton(this))), 61 close_button_(new views::ImageButton(this))),
62 window_icon_(NULL), 62 window_icon_(NULL),
63 frame_(frame), 63 frame_(frame),
64 browser_view_(browser_view) { 64 browser_view_(browser_view) {
65 DCHECK(browser_view->ShouldShowWindowIcon()); 65 DCHECK(browser_view->ShouldShowWindowIcon());
66 DCHECK(browser_view->ShouldShowWindowTitle()); 66 DCHECK(browser_view->ShouldShowWindowTitle());
67 67
68 frame_->set_frame_type(views::Window::FRAME_TYPE_FORCE_CUSTOM);
69
68 ResourceBundle& rb = ResourceBundle::GetSharedInstance(); 70 ResourceBundle& rb = ResourceBundle::GetSharedInstance();
69 close_button_->SetImage(views::CustomButton::BS_NORMAL, 71 close_button_->SetImage(views::CustomButton::BS_NORMAL,
70 rb.GetBitmapNamed(IDR_CLOSE_BAR)); 72 rb.GetBitmapNamed(IDR_CLOSE_BAR));
71 close_button_->SetImage(views::CustomButton::BS_HOT, 73 close_button_->SetImage(views::CustomButton::BS_HOT,
72 rb.GetBitmapNamed(IDR_CLOSE_BAR_H)); 74 rb.GetBitmapNamed(IDR_CLOSE_BAR_H));
73 close_button_->SetImage(views::CustomButton::BS_PUSHED, 75 close_button_->SetImage(views::CustomButton::BS_PUSHED,
74 rb.GetBitmapNamed(IDR_CLOSE_BAR_P)); 76 rb.GetBitmapNamed(IDR_CLOSE_BAR_P));
75 close_button_->SetAccessibleName( 77 close_button_->SetAccessibleName(
76 l10n_util::GetStringUTF16(IDS_ACCNAME_CLOSE)); 78 l10n_util::GetStringUTF16(IDS_ACCNAME_CLOSE));
77 AddChildView(close_button_); 79 AddChildView(close_button_);
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
117 return min_size; 119 return min_size;
118 } 120 }
119 121
120 /////////////////////////////////////////////////////////////////////////////// 122 ///////////////////////////////////////////////////////////////////////////////
121 // AppPanelBrowserFrameView, views::NonClientFrameView implementation: 123 // AppPanelBrowserFrameView, views::NonClientFrameView implementation:
122 124
123 gfx::Rect AppPanelBrowserFrameView::GetBoundsForClientView() const { 125 gfx::Rect AppPanelBrowserFrameView::GetBoundsForClientView() const {
124 return client_view_bounds_; 126 return client_view_bounds_;
125 } 127 }
126 128
127 bool AppPanelBrowserFrameView::AlwaysUseCustomFrame() const {
128 return true;
129 }
130
131 bool AppPanelBrowserFrameView::AlwaysUseNativeFrame() const {
132 return frame_->AlwaysUseNativeFrame();
133 }
134
135 gfx::Rect AppPanelBrowserFrameView::GetWindowBoundsForClientBounds( 129 gfx::Rect AppPanelBrowserFrameView::GetWindowBoundsForClientBounds(
136 const gfx::Rect& client_bounds) const { 130 const gfx::Rect& client_bounds) const {
137 int top_height = NonClientTopBorderHeight(); 131 int top_height = NonClientTopBorderHeight();
138 int border_thickness = NonClientBorderThickness(); 132 int border_thickness = NonClientBorderThickness();
139 return gfx::Rect(std::max(0, client_bounds.x() - border_thickness), 133 return gfx::Rect(std::max(0, client_bounds.x() - border_thickness),
140 std::max(0, client_bounds.y() - top_height), 134 std::max(0, client_bounds.y() - top_height),
141 client_bounds.width() + (2 * border_thickness), 135 client_bounds.width() + (2 * border_thickness),
142 client_bounds.height() + top_height + border_thickness); 136 client_bounds.height() + top_height + border_thickness);
143 } 137 }
144 138
(...skipping 356 matching lines...) Expand 10 before | Expand all | Expand 10 after
501 } 495 }
502 496
503 gfx::Rect AppPanelBrowserFrameView::CalculateClientAreaBounds(int width, 497 gfx::Rect AppPanelBrowserFrameView::CalculateClientAreaBounds(int width,
504 int height) const { 498 int height) const {
505 int top_height = NonClientTopBorderHeight(); 499 int top_height = NonClientTopBorderHeight();
506 int border_thickness = NonClientBorderThickness(); 500 int border_thickness = NonClientBorderThickness();
507 return gfx::Rect(border_thickness, top_height, 501 return gfx::Rect(border_thickness, top_height,
508 std::max(0, width - (2 * border_thickness)), 502 std::max(0, width - (2 * border_thickness)),
509 std::max(0, height - top_height - border_thickness)); 503 std::max(0, height - top_height - border_thickness));
510 } 504 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/views/frame/app_panel_browser_frame_view.h ('k') | chrome/browser/ui/views/frame/browser_frame.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698