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

Side by Side Diff: chrome/browser/views/frame/opaque_browser_frame_view.cc

Issue 155242: Add temporary TabStripWrapper interface that is implemented by both TabStrip ... (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 11 years, 5 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) 2006-2008 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2006-2008 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/views/frame/opaque_browser_frame_view.h" 5 #include "chrome/browser/views/frame/opaque_browser_frame_view.h"
6 6
7 #include "app/gfx/canvas.h" 7 #include "app/gfx/canvas.h"
8 #include "app/gfx/font.h" 8 #include "app/gfx/font.h"
9 #include "app/gfx/path.h" 9 #include "app/gfx/path.h"
10 #include "app/l10n_util.h" 10 #include "app/l10n_util.h"
11 #include "app/resource_bundle.h" 11 #include "app/resource_bundle.h"
12 #include "app/theme_provider.h" 12 #include "app/theme_provider.h"
13 #include "chrome/browser/browser_theme_provider.h" 13 #include "chrome/browser/browser_theme_provider.h"
14 #include "chrome/browser/tab_contents/tab_contents.h" 14 #include "chrome/browser/tab_contents/tab_contents.h"
15 #include "chrome/browser/views/frame/browser_frame.h" 15 #include "chrome/browser/views/frame/browser_frame.h"
16 #include "chrome/browser/views/frame/browser_view.h" 16 #include "chrome/browser/views/frame/browser_view.h"
17 #include "chrome/browser/views/tabs/tab_strip.h" 17 #include "chrome/browser/views/tabs/tab_strip_wrapper.h"
18 #include "grit/app_resources.h" 18 #include "grit/app_resources.h"
19 #include "grit/chromium_strings.h" 19 #include "grit/chromium_strings.h"
20 #include "grit/generated_resources.h" 20 #include "grit/generated_resources.h"
21 #include "grit/theme_resources.h" 21 #include "grit/theme_resources.h"
22 #include "views/controls/button/image_button.h" 22 #include "views/controls/button/image_button.h"
23 #include "views/widget/root_view.h" 23 #include "views/widget/root_view.h"
24 #include "views/window/window.h" 24 #include "views/window/window.h"
25 #include "views/window/window_resources.h" 25 #include "views/window/window_resources.h"
26 26
27 #if defined(OS_WIN) 27 #if defined(OS_WIN)
(...skipping 165 matching lines...) Expand 10 before | Expand all | Expand 10 after
193 InitAppWindowResources(); 193 InitAppWindowResources();
194 } 194 }
195 195
196 OpaqueBrowserFrameView::~OpaqueBrowserFrameView() { 196 OpaqueBrowserFrameView::~OpaqueBrowserFrameView() {
197 } 197 }
198 198
199 /////////////////////////////////////////////////////////////////////////////// 199 ///////////////////////////////////////////////////////////////////////////////
200 // OpaqueBrowserFrameView, BrowserNonClientFrameView implementation: 200 // OpaqueBrowserFrameView, BrowserNonClientFrameView implementation:
201 201
202 gfx::Rect OpaqueBrowserFrameView::GetBoundsForTabStrip( 202 gfx::Rect OpaqueBrowserFrameView::GetBoundsForTabStrip(
203 TabStrip* tabstrip) const { 203 TabStripWrapper* tabstrip) const {
204 int tabstrip_x = browser_view_->ShouldShowOffTheRecordAvatar() ? 204 int tabstrip_x = browser_view_->ShouldShowOffTheRecordAvatar() ?
205 (otr_avatar_bounds_.right() + kOTRSideSpacing) : 205 (otr_avatar_bounds_.right() + kOTRSideSpacing) :
206 NonClientBorderThickness(); 206 NonClientBorderThickness();
207 int tabstrip_width = minimize_button_->x() - tabstrip_x - 207 int tabstrip_width = minimize_button_->x() - tabstrip_x -
208 (frame_->GetWindow()->IsMaximized() ? 208 (frame_->GetWindow()->IsMaximized() ?
209 kNewTabCaptionMaximizedSpacing : kNewTabCaptionRestoredSpacing); 209 kNewTabCaptionMaximizedSpacing : kNewTabCaptionRestoredSpacing);
210 return gfx::Rect(tabstrip_x, NonClientTopBorderHeight(), 210 return gfx::Rect(tabstrip_x, NonClientTopBorderHeight(),
211 std::max(0, tabstrip_width), tabstrip->GetPreferredHeight()); 211 std::max(0, tabstrip_width),
212 tabstrip->GetPreferredHeight());
212 } 213 }
213 214
214 void OpaqueBrowserFrameView::UpdateThrobber(bool running) { 215 void OpaqueBrowserFrameView::UpdateThrobber(bool running) {
215 if (window_icon_) 216 if (window_icon_)
216 window_icon_->Update(); 217 window_icon_->Update();
217 } 218 }
218 219
219 gfx::Size OpaqueBrowserFrameView::GetMinimumSize() { 220 gfx::Size OpaqueBrowserFrameView::GetMinimumSize() {
220 gfx::Size min_size(browser_view_->GetMinimumSize()); 221 gfx::Size min_size(browser_view_->GetMinimumSize());
221 int border_thickness = NonClientBorderThickness(); 222 int border_thickness = NonClientBorderThickness();
(...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after
359 LayoutClientView(); 360 LayoutClientView();
360 } 361 }
361 362
362 bool OpaqueBrowserFrameView::HitTest(const gfx::Point& l) const { 363 bool OpaqueBrowserFrameView::HitTest(const gfx::Point& l) const {
363 // If the point is outside the bounds of the client area, claim it. 364 // If the point is outside the bounds of the client area, claim it.
364 bool in_nonclient = NonClientFrameView::HitTest(l); 365 bool in_nonclient = NonClientFrameView::HitTest(l);
365 if (in_nonclient) 366 if (in_nonclient)
366 return in_nonclient; 367 return in_nonclient;
367 368
368 // Otherwise claim it only if it's in a non-tab portion of the tabstrip. 369 // Otherwise claim it only if it's in a non-tab portion of the tabstrip.
369 if (l.y() > browser_view_->tabstrip()->bounds().bottom()) 370 if (l.y() > browser_view_->tabstrip()->GetView()->bounds().bottom())
370 return false; 371 return false;
371 372
372 // We convert from our parent's coordinates since we assume we fill its bounds 373 // We convert from our parent's coordinates since we assume we fill its bounds
373 // completely. We need to do this since we're not a parent of the tabstrip, 374 // completely. We need to do this since we're not a parent of the tabstrip,
374 // meaning ConvertPointToView would otherwise return something bogus. 375 // meaning ConvertPointToView would otherwise return something bogus.
375 gfx::Point tabstrip_point(l); 376 gfx::Point tabstrip_point(l);
376 View::ConvertPointToView(GetParent(), browser_view_->tabstrip(), 377 View::ConvertPointToView(GetParent(), browser_view_->tabstrip()->GetView(),
377 &tabstrip_point); 378 &tabstrip_point);
378 return browser_view_->tabstrip()->PointIsWithinWindowCaption(tabstrip_point); 379 return browser_view_->tabstrip()->PointIsWithinWindowCaption(tabstrip_point);
379 } 380 }
380 381
381 void OpaqueBrowserFrameView::ViewHierarchyChanged(bool is_add, 382 void OpaqueBrowserFrameView::ViewHierarchyChanged(bool is_add,
382 views::View* parent, 383 views::View* parent,
383 views::View* child) { 384 views::View* child) {
384 if (is_add && child == this) { 385 if (is_add && child == this) {
385 // The Accessibility glue looks for the product name on these two views to 386 // The Accessibility glue looks for the product name on these two views to
386 // determine if this is in fact a Chrome window. 387 // determine if this is in fact a Chrome window.
(...skipping 619 matching lines...) Expand 10 before | Expand all | Expand 10 after
1006 if (!initialized) { 1007 if (!initialized) {
1007 #if defined(OS_WIN) 1008 #if defined(OS_WIN)
1008 title_font_ = new gfx::Font(win_util::GetWindowTitleFont()); 1009 title_font_ = new gfx::Font(win_util::GetWindowTitleFont());
1009 #else 1010 #else
1010 NOTIMPLEMENTED(); 1011 NOTIMPLEMENTED();
1011 title_font_ = new gfx::Font(); 1012 title_font_ = new gfx::Font();
1012 #endif 1013 #endif
1013 initialized = true; 1014 initialized = true;
1014 } 1015 }
1015 } 1016 }
OLDNEW
« no previous file with comments | « chrome/browser/views/frame/opaque_browser_frame_view.h ('k') | chrome/browser/views/tabs/browser_tab_strip.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698