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

Side by Side Diff: chrome/browser/ui/panels/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/panels/panel_browser_frame_view.h" 5 #include "chrome/browser/ui/panels/panel_browser_frame_view.h"
6 6
7 #include "chrome/browser/themes/theme_service.h" 7 #include "chrome/browser/themes/theme_service.h"
8 #include "chrome/browser/ui/panels/panel.h" 8 #include "chrome/browser/ui/panels/panel.h"
9 #include "chrome/browser/ui/panels/panel_browser_view.h" 9 #include "chrome/browser/ui/panels/panel_browser_view.h"
10 #include "chrome/browser/ui/panels/panel_manager.h" 10 #include "chrome/browser/ui/panels/panel_manager.h"
(...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after
134 PanelBrowserView* browser_view) 134 PanelBrowserView* browser_view)
135 : BrowserNonClientFrameView(), 135 : BrowserNonClientFrameView(),
136 frame_(frame), 136 frame_(frame),
137 browser_view_(browser_view), 137 browser_view_(browser_view),
138 paint_state_(NOT_PAINTED), 138 paint_state_(NOT_PAINTED),
139 options_button_(NULL), 139 options_button_(NULL),
140 close_button_(NULL), 140 close_button_(NULL),
141 title_icon_(NULL), 141 title_icon_(NULL),
142 title_label_(NULL) { 142 title_label_(NULL) {
143 EnsureResourcesInitialized(); 143 EnsureResourcesInitialized();
144 frame_->set_frame_type(views::Window::FRAME_TYPE_FORCE_CUSTOM);
144 145
145 options_button_ = new views::MenuButton(NULL, std::wstring(), this, false); 146 options_button_ = new views::MenuButton(NULL, std::wstring(), this, false);
146 options_button_->SetIcon(*(options_button_resources.normal_image)); 147 options_button_->SetIcon(*(options_button_resources.normal_image));
147 options_button_->SetHoverIcon(*(options_button_resources.hover_image)); 148 options_button_->SetHoverIcon(*(options_button_resources.hover_image));
148 options_button_->SetPushedIcon(*(options_button_resources.pushed_image)); 149 options_button_->SetPushedIcon(*(options_button_resources.pushed_image));
149 options_button_->set_alignment(views::TextButton::ALIGN_CENTER); 150 options_button_->set_alignment(views::TextButton::ALIGN_CENTER);
150 options_button_->set_border(NULL); 151 options_button_->set_border(NULL);
151 // TODO(jianli): Hide options button by default and show it when mouse is over 152 // TODO(jianli): Hide options button by default and show it when mouse is over
152 // panel. 153 // panel.
153 // options_button_->SetVisible(false); 154 // options_button_->SetVisible(false);
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
194 void PanelBrowserFrameView::UpdateThrobber(bool running) { 195 void PanelBrowserFrameView::UpdateThrobber(bool running) {
195 // Tells the title icon to update the throbber when we need to show the 196 // Tells the title icon to update the throbber when we need to show the
196 // animation to indicate we're still loading. 197 // animation to indicate we're still loading.
197 title_icon_->Update(); 198 title_icon_->Update();
198 } 199 }
199 200
200 gfx::Rect PanelBrowserFrameView::GetBoundsForClientView() const { 201 gfx::Rect PanelBrowserFrameView::GetBoundsForClientView() const {
201 return client_view_bounds_; 202 return client_view_bounds_;
202 } 203 }
203 204
204 bool PanelBrowserFrameView::AlwaysUseCustomFrame() const {
205 return true;
206 }
207
208 gfx::Rect PanelBrowserFrameView::GetWindowBoundsForClientBounds( 205 gfx::Rect PanelBrowserFrameView::GetWindowBoundsForClientBounds(
209 const gfx::Rect& client_bounds) const { 206 const gfx::Rect& client_bounds) const {
210 int top_height = NonClientTopBorderHeight(); 207 int top_height = NonClientTopBorderHeight();
211 int border_thickness = NonClientBorderThickness(); 208 int border_thickness = NonClientBorderThickness();
212 return gfx::Rect(std::max(0, client_bounds.x() - border_thickness), 209 return gfx::Rect(std::max(0, client_bounds.x() - border_thickness),
213 std::max(0, client_bounds.y() - top_height), 210 std::max(0, client_bounds.y() - top_height),
214 client_bounds.width() + (2 * border_thickness), 211 client_bounds.width() + (2 * border_thickness),
215 client_bounds.height() + top_height + border_thickness); 212 client_bounds.height() + top_height + border_thickness);
216 } 213 }
217 214
218 bool PanelBrowserFrameView::AlwaysUseNativeFrame() const {
219 return frame_->AlwaysUseNativeFrame();
220 }
221
222 int PanelBrowserFrameView::NonClientHitTest(const gfx::Point& point) { 215 int PanelBrowserFrameView::NonClientHitTest(const gfx::Point& point) {
223 if (!bounds().Contains(point)) 216 if (!bounds().Contains(point))
224 return HTNOWHERE; 217 return HTNOWHERE;
225 218
226 int frame_component = 219 int frame_component =
227 frame_->client_view()->NonClientHitTest(point); 220 frame_->client_view()->NonClientHitTest(point);
228 if (frame_component != HTNOWHERE) 221 if (frame_component != HTNOWHERE)
229 return frame_component; 222 return frame_component;
230 223
231 if (close_button_->IsVisible() && 224 if (close_button_->IsVisible() &&
(...skipping 341 matching lines...) Expand 10 before | Expand all | Expand 10 after
573 COMMAND_CLOSE_ALL, 566 COMMAND_CLOSE_ALL,
574 l10n_util::GetStringUTF16(IDS_PANEL_OPTIONS_MENU_CLOSE_ALL)); 567 l10n_util::GetStringUTF16(IDS_PANEL_OPTIONS_MENU_CLOSE_ALL));
575 options_menu_contents_->AddSeparator(); 568 options_menu_contents_->AddSeparator();
576 } 569 }
577 570
578 options_menu_contents_->AddItem( 571 options_menu_contents_->AddItem(
579 COMMAND_ABOUT, l10n_util::GetStringUTF16(IDS_PANEL_OPTIONS_MENU_ABOUT)); 572 COMMAND_ABOUT, l10n_util::GetStringUTF16(IDS_PANEL_OPTIONS_MENU_ABOUT));
580 573
581 return rebuild_menu; 574 return rebuild_menu;
582 } 575 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/panels/panel_browser_frame_view.h ('k') | chrome/browser/ui/views/constrained_window_views.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698