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

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

Issue 1780333006: Check for null |tabstrip_| in BrowserView::IsTabStripVisible() (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: DoesIntersectRect() implementations Created 4 years, 9 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
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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/browser_non_client_frame_view_mus.h" 5 #include "chrome/browser/ui/views/frame/browser_non_client_frame_view_mus.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 8
9 #include "base/profiler/scoped_tracker.h" 9 #include "base/profiler/scoped_tracker.h"
10 #include "chrome/app/chrome_command_ids.h" 10 #include "chrome/app/chrome_command_ids.h"
(...skipping 370 matching lines...) Expand 10 before | Expand all | Expand 10 after
381 381
382 bool BrowserNonClientFrameViewMus::DoesIntersectRect( 382 bool BrowserNonClientFrameViewMus::DoesIntersectRect(
383 const views::View* target, 383 const views::View* target,
384 const gfx::Rect& rect) const { 384 const gfx::Rect& rect) const {
385 CHECK_EQ(target, this); 385 CHECK_EQ(target, this);
386 if (!views::ViewTargeterDelegate::DoesIntersectRect(this, rect)) { 386 if (!views::ViewTargeterDelegate::DoesIntersectRect(this, rect)) {
387 // |rect| is outside BrowserNonClientFrameViewMus's bounds. 387 // |rect| is outside BrowserNonClientFrameViewMus's bounds.
388 return false; 388 return false;
389 } 389 }
390 390
391 TabStrip* tabstrip = browser_view()->tabstrip(); 391 if (!browser_view()->IsTabStripVisible()) {
392 if (tabstrip && browser_view()->IsTabStripVisible()) { 392 // Claim |rect| if it is above the top of the topmost client area view.
393 // Claim |rect| only if it is above the bottom of the tabstrip in a non-tab 393 return rect.y() < GetTopInset(false);
394 // portion.
395 gfx::RectF rect_in_tabstrip_coords_f(rect);
396 View::ConvertRectToTarget(this, tabstrip, &rect_in_tabstrip_coords_f);
397 gfx::Rect rect_in_tabstrip_coords =
398 gfx::ToEnclosingRect(rect_in_tabstrip_coords_f);
399
400 if (rect_in_tabstrip_coords.y() > tabstrip->height())
401 return false;
402
403 return !tabstrip->HitTestRect(rect_in_tabstrip_coords) ||
404 tabstrip->IsRectInWindowCaption(rect_in_tabstrip_coords);
405 } 394 }
406 395
407 // Claim |rect| if it is above the top of the topmost view in the client area. 396 // Claim |rect| only if it is above the bottom of the tabstrip in a non-tab
408 return rect.y() < GetTopInset(false); 397 // portion. In particular, the avatar label/button is left of the tabstrip and
398 // the window controls are right of the tabstrip.
399 TabStrip* tabstrip = browser_view()->tabstrip();
400 gfx::RectF rect_in_tabstrip_coords_f(rect);
401 View::ConvertRectToTarget(this, tabstrip, &rect_in_tabstrip_coords_f);
402 const gfx::Rect rect_in_tabstrip_coords =
403 gfx::ToEnclosingRect(rect_in_tabstrip_coords_f);
404 if (rect_in_tabstrip_coords.y() > tabstrip->height()) {
405 // |rect| is entirely below the tabstrip.
406 return false;
407 }
408
409 return !tabstrip->HitTestRect(rect_in_tabstrip_coords) ||
410 tabstrip->IsRectInWindowCaption(rect_in_tabstrip_coords);
409 } 411 }
410 412
411 int BrowserNonClientFrameViewMus::GetTabStripLeftInset() const { 413 int BrowserNonClientFrameViewMus::GetTabStripLeftInset() const {
412 const gfx::Insets insets(GetLayoutInsets(AVATAR_ICON)); 414 const gfx::Insets insets(GetLayoutInsets(AVATAR_ICON));
413 const int avatar_right = 415 const int avatar_right =
414 avatar_button() ? (insets.left() + GetOTRAvatarIcon().width()) : 0; 416 avatar_button() ? (insets.left() + GetOTRAvatarIcon().width()) : 0;
415 return avatar_right + insets.right() + frame_values().normal_insets.left(); 417 return avatar_right + insets.right() + frame_values().normal_insets.left();
416 } 418 }
417 419
418 int BrowserNonClientFrameViewMus::GetTabStripRightInset() const { 420 int BrowserNonClientFrameViewMus::GetTabStripRightInset() const {
(...skipping 203 matching lines...) Expand 10 before | Expand all | Expand 10 after
622 } 624 }
623 625
624 void BrowserNonClientFrameViewMus::PaintContentEdge(gfx::Canvas* canvas) { 626 void BrowserNonClientFrameViewMus::PaintContentEdge(gfx::Canvas* canvas) {
625 DCHECK(!UsePackagedAppHeaderStyle() && !UseWebAppHeaderStyle()); 627 DCHECK(!UsePackagedAppHeaderStyle() && !UseWebAppHeaderStyle());
626 const int bottom = frame_values().normal_insets.bottom(); 628 const int bottom = frame_values().normal_insets.bottom();
627 canvas->FillRect( 629 canvas->FillRect(
628 gfx::Rect(0, bottom, width(), kClientEdgeThickness), 630 gfx::Rect(0, bottom, width(), kClientEdgeThickness),
629 GetThemeProvider()->GetColor( 631 GetThemeProvider()->GetColor(
630 ThemeProperties::COLOR_TOOLBAR_BOTTOM_SEPARATOR)); 632 ThemeProperties::COLOR_TOOLBAR_BOTTOM_SEPARATOR));
631 } 633 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698