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

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: 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 view in the client
393 // Claim |rect| only if it is above the bottom of the tabstrip in a non-tab 393 // area.
394 // portion. 394 return rect.y() < GetTopInset(false);
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 } 395 }
406 396
407 // Claim |rect| if it is above the top of the topmost view in the client area. 397 // Claim |rect| only if it is above the bottom of the tabstrip in a non-tab
408 return rect.y() < GetTopInset(false); 398 // portion.
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 gfx::Rect rect_in_tabstrip_coords =
403 gfx::ToEnclosingRect(rect_in_tabstrip_coords_f);
404
405 if (rect_in_tabstrip_coords.y() > tabstrip->height())
406 return false;
407
408 return !tabstrip->HitTestRect(rect_in_tabstrip_coords) ||
409 tabstrip->IsRectInWindowCaption(rect_in_tabstrip_coords);
Peter Kasting 2016/03/11 22:19:50 This is functionally equivalent to the Ash code bu
tdanderson 2016/03/14 20:38:33 Done.
409 } 410 }
410 411
411 int BrowserNonClientFrameViewMus::GetTabStripLeftInset() const { 412 int BrowserNonClientFrameViewMus::GetTabStripLeftInset() const {
412 const gfx::Insets insets(GetLayoutInsets(AVATAR_ICON)); 413 const gfx::Insets insets(GetLayoutInsets(AVATAR_ICON));
413 const int avatar_right = 414 const int avatar_right =
414 avatar_button() ? (insets.left() + GetOTRAvatarIcon().width()) : 0; 415 avatar_button() ? (insets.left() + GetOTRAvatarIcon().width()) : 0;
415 return avatar_right + insets.right() + frame_values().normal_insets.left(); 416 return avatar_right + insets.right() + frame_values().normal_insets.left();
416 } 417 }
417 418
418 int BrowserNonClientFrameViewMus::GetTabStripRightInset() const { 419 int BrowserNonClientFrameViewMus::GetTabStripRightInset() const {
(...skipping 203 matching lines...) Expand 10 before | Expand all | Expand 10 after
622 } 623 }
623 624
624 void BrowserNonClientFrameViewMus::PaintContentEdge(gfx::Canvas* canvas) { 625 void BrowserNonClientFrameViewMus::PaintContentEdge(gfx::Canvas* canvas) {
625 DCHECK(!UsePackagedAppHeaderStyle() && !UseWebAppHeaderStyle()); 626 DCHECK(!UsePackagedAppHeaderStyle() && !UseWebAppHeaderStyle());
626 const int bottom = frame_values().normal_insets.bottom(); 627 const int bottom = frame_values().normal_insets.bottom();
627 canvas->FillRect( 628 canvas->FillRect(
628 gfx::Rect(0, bottom, width(), kClientEdgeThickness), 629 gfx::Rect(0, bottom, width(), kClientEdgeThickness),
629 GetThemeProvider()->GetColor( 630 GetThemeProvider()->GetColor(
630 ThemeProperties::COLOR_TOOLBAR_BOTTOM_SEPARATOR)); 631 ThemeProperties::COLOR_TOOLBAR_BOTTOM_SEPARATOR));
631 } 632 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698