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

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

Issue 272543003: Remove unused code for the metro window switcher button (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 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) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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/opaque_browser_frame_view.h" 5 #include "chrome/browser/ui/views/frame/opaque_browser_frame_view.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <string> 8 #include <string>
9 9
10 #include "base/compiler_specific.h" 10 #include "base/compiler_specific.h"
(...skipping 307 matching lines...) Expand 10 before | Expand all | Expand 10 after
318 if (rect_in_tabstrip_coords.bottom() > tabstrip->GetLocalBounds().bottom()) { 318 if (rect_in_tabstrip_coords.bottom() > tabstrip->GetLocalBounds().bottom()) {
319 // |rect| is below the tabstrip. 319 // |rect| is below the tabstrip.
320 return false; 320 return false;
321 } 321 }
322 322
323 if (tabstrip->HitTestRect(rect_in_tabstrip_coords)) { 323 if (tabstrip->HitTestRect(rect_in_tabstrip_coords)) {
324 // Claim |rect| if it is in a non-tab portion of the tabstrip. 324 // Claim |rect| if it is in a non-tab portion of the tabstrip.
325 return tabstrip->IsRectInWindowCaption(rect_in_tabstrip_coords); 325 return tabstrip->IsRectInWindowCaption(rect_in_tabstrip_coords);
326 } 326 }
327 327
328 // The window switcher button is to the right of the tabstrip but is
329 // part of the client view.
330 views::View* window_switcher_button =
331 browser_view()->window_switcher_button();
332 if (window_switcher_button && window_switcher_button->visible()) {
333 gfx::RectF rect_in_window_switcher_coords_f(rect);
334 View::ConvertRectToTarget(this, window_switcher_button,
335 &rect_in_window_switcher_coords_f);
336 gfx::Rect rect_in_window_switcher_coords = gfx::ToEnclosingRect(
337 rect_in_window_switcher_coords_f);
338
339 if (window_switcher_button->HitTestRect(rect_in_window_switcher_coords))
340 return false;
341 }
342
343 // We claim |rect| because it is above the bottom of the tabstrip, but 328 // We claim |rect| because it is above the bottom of the tabstrip, but
344 // neither in the tabstrip nor in the window switcher button. In particular, 329 // not in the tabstrip itself. In particular, the avatar label/button is left
345 // the avatar label/button is left of the tabstrip and the window controls 330 // of the tabstrip and the window controls are right of the tabstrip.
346 // are right of the tabstrip.
347 return true; 331 return true;
348 } 332 }
349 333
350 void OpaqueBrowserFrameView::GetAccessibleState( 334 void OpaqueBrowserFrameView::GetAccessibleState(
351 ui::AXViewState* state) { 335 ui::AXViewState* state) {
352 state->role = ui::AX_ROLE_TITLE_BAR; 336 state->role = ui::AX_ROLE_TITLE_BAR;
353 } 337 }
354 338
355 /////////////////////////////////////////////////////////////////////////////// 339 ///////////////////////////////////////////////////////////////////////////////
356 // OpaqueBrowserFrameView, views::ButtonListener implementation: 340 // OpaqueBrowserFrameView, views::ButtonListener implementation:
(...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after
496 } 480 }
497 481
498 bool OpaqueBrowserFrameView::IsTabStripVisible() const { 482 bool OpaqueBrowserFrameView::IsTabStripVisible() const {
499 return browser_view()->IsTabStripVisible(); 483 return browser_view()->IsTabStripVisible();
500 } 484 }
501 485
502 int OpaqueBrowserFrameView::GetTabStripHeight() const { 486 int OpaqueBrowserFrameView::GetTabStripHeight() const {
503 return browser_view()->GetTabStripHeight(); 487 return browser_view()->GetTabStripHeight();
504 } 488 }
505 489
506 int OpaqueBrowserFrameView::GetAdditionalReservedSpaceInTabStrip() const {
507 // We don't have the sysmenu buttons in Windows 8 metro mode. However there
508 // are buttons like the window switcher which are drawn in the non client
509 // are in the BrowserView. We need to ensure that the tab strip does not
510 // draw on the window switcher button.
511 views::View* button = browser_view()->window_switcher_button();
512 return button ? button->width() : 0;
513 }
514
515 gfx::Size OpaqueBrowserFrameView::GetTabstripPreferredSize() const { 490 gfx::Size OpaqueBrowserFrameView::GetTabstripPreferredSize() const {
516 gfx::Size s = browser_view()->tabstrip()->GetPreferredSize(); 491 gfx::Size s = browser_view()->tabstrip()->GetPreferredSize();
517 return s; 492 return s;
518 } 493 }
519 494
520 /////////////////////////////////////////////////////////////////////////////// 495 ///////////////////////////////////////////////////////////////////////////////
521 // OpaqueBrowserFrameView, views::View overrides: 496 // OpaqueBrowserFrameView, views::View overrides:
522 497
523 void OpaqueBrowserFrameView::OnPaint(gfx::Canvas* canvas) { 498 void OpaqueBrowserFrameView::OnPaint(gfx::Canvas* canvas) {
524 if (frame()->IsFullscreen()) 499 if (frame()->IsFullscreen())
(...skipping 396 matching lines...) Expand 10 before | Expand all | Expand 10 after
921 896
922 int OpaqueBrowserFrameView::GetTopAreaHeight() const { 897 int OpaqueBrowserFrameView::GetTopAreaHeight() const {
923 gfx::ImageSkia* frame_image = GetFrameImage(); 898 gfx::ImageSkia* frame_image = GetFrameImage();
924 int top_area_height = frame_image->height(); 899 int top_area_height = frame_image->height();
925 if (browser_view()->IsTabStripVisible()) { 900 if (browser_view()->IsTabStripVisible()) {
926 top_area_height = std::max(top_area_height, 901 top_area_height = std::max(top_area_height,
927 GetBoundsForTabStrip(browser_view()->tabstrip()).bottom()); 902 GetBoundsForTabStrip(browser_view()->tabstrip()).bottom());
928 } 903 }
929 return top_area_height; 904 return top_area_height;
930 } 905 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698