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

Side by Side Diff: chrome/browser/ui/views/frame/browser_view.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 2012 The Chromium Authors. All rights reserved. 1 // Copyright 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/browser_view.h" 5 #include "chrome/browser/ui/views/frame/browser_view.h"
6 6
7 #include <stdint.h> 7 #include <stdint.h>
8 #include <algorithm> 8 #include <algorithm>
9 #include <utility> 9 #include <utility>
10 10
(...skipping 559 matching lines...) Expand 10 before | Expand all | Expand 10 after
570 } 570 }
571 571
572 gfx::Rect BrowserView::GetFindBarBoundingBox() const { 572 gfx::Rect BrowserView::GetFindBarBoundingBox() const {
573 return GetBrowserViewLayout()->GetFindBarBoundingBox(); 573 return GetBrowserViewLayout()->GetFindBarBoundingBox();
574 } 574 }
575 575
576 int BrowserView::GetTabStripHeight() const { 576 int BrowserView::GetTabStripHeight() const {
577 // We want to return tabstrip_->height(), but we might be called in the midst 577 // We want to return tabstrip_->height(), but we might be called in the midst
578 // of layout, when that hasn't yet been updated to reflect the current state. 578 // of layout, when that hasn't yet been updated to reflect the current state.
579 // So return what the tabstrip height _ought_ to be right now. 579 // So return what the tabstrip height _ought_ to be right now.
580 return tabstrip_ && IsTabStripVisible() ? 580 return IsTabStripVisible() ? tabstrip_->GetPreferredSize().height() : 0;
581 tabstrip_->GetPreferredSize().height() : 0;
582 } 581 }
583 582
584 gfx::Point BrowserView::OffsetPointForToolbarBackgroundImage( 583 gfx::Point BrowserView::OffsetPointForToolbarBackgroundImage(
585 const gfx::Point& point) const { 584 const gfx::Point& point) const {
586 // The background image starts tiling horizontally at the window left edge and 585 // The background image starts tiling horizontally at the window left edge and
587 // vertically at the top edge of the horizontal tab strip (or where it would 586 // vertically at the top edge of the horizontal tab strip (or where it would
588 // be). We expect our parent's origin to be the window origin. 587 // be). We expect our parent's origin to be the window origin.
589 gfx::Point window_point(point + GetMirroredPosition().OffsetFromOrigin()); 588 gfx::Point window_point(point + GetMirroredPosition().OffsetFromOrigin());
590 window_point.Offset(frame_->GetThemeBackgroundXInset(), 589 window_point.Offset(frame_->GetThemeBackgroundXInset(),
591 -frame_->GetTopInset(false)); 590 -frame_->GetTopInset(false));
592 return window_point; 591 return window_point;
593 } 592 }
594 593
595 bool BrowserView::IsTabStripVisible() const { 594 bool BrowserView::IsTabStripVisible() const {
596 if (immersive_mode_controller_->ShouldHideTopViews() && 595 if (immersive_mode_controller_->ShouldHideTopViews() &&
597 immersive_mode_controller_->ShouldHideTabIndicators()) 596 immersive_mode_controller_->ShouldHideTabIndicators()) {
598 return false; 597 return false;
599 return browser_->SupportsWindowFeature(Browser::FEATURE_TABSTRIP); 598 }
599
600 // Return false if this window does not normally display a tabstrip.
601 if (!browser_->SupportsWindowFeature(Browser::FEATURE_TABSTRIP))
602 return false;
603
604 // Has the tabstrip been created yet (by InitViews())? Note that we can't
Peter Kasting 2016/03/14 23:04:42 Nit: For parallel structure with the above, maybe
tdanderson 2016/03/15 15:51:42 Done.
605 // just check this alone, as the tabstrip is created unconditionally even
606 // for windows that won't display it.
607 return tabstrip_ != nullptr;
600 } 608 }
601 609
602 bool BrowserView::IsOffTheRecord() const { 610 bool BrowserView::IsOffTheRecord() const {
603 return browser_->profile()->IsOffTheRecord(); 611 return browser_->profile()->IsOffTheRecord();
604 } 612 }
605 613
606 bool BrowserView::IsGuestSession() const { 614 bool BrowserView::IsGuestSession() const {
607 return browser_->profile()->IsGuestSession(); 615 return browser_->profile()->IsGuestSession();
608 } 616 }
609 617
(...skipping 2089 matching lines...) Expand 10 before | Expand all | Expand 10 after
2699 } 2707 }
2700 2708
2701 extensions::ActiveTabPermissionGranter* 2709 extensions::ActiveTabPermissionGranter*
2702 BrowserView::GetActiveTabPermissionGranter() { 2710 BrowserView::GetActiveTabPermissionGranter() {
2703 content::WebContents* web_contents = GetActiveWebContents(); 2711 content::WebContents* web_contents = GetActiveWebContents();
2704 if (!web_contents) 2712 if (!web_contents)
2705 return nullptr; 2713 return nullptr;
2706 return extensions::TabHelper::FromWebContents(web_contents) 2714 return extensions::TabHelper::FromWebContents(web_contents)
2707 ->active_tab_permission_granter(); 2715 ->active_tab_permission_granter();
2708 } 2716 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698