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

Unified 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: only change Ash/Mus 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/browser/ui/views/frame/browser_non_client_frame_view_mus.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/ui/views/frame/browser_view.cc
diff --git a/chrome/browser/ui/views/frame/browser_view.cc b/chrome/browser/ui/views/frame/browser_view.cc
index 7d583154d344ac942e7af0975acdcaa9d4ba50ab..96f615c99867dfd528cc5a5be121c1220728dd3f 100644
--- a/chrome/browser/ui/views/frame/browser_view.cc
+++ b/chrome/browser/ui/views/frame/browser_view.cc
@@ -577,8 +577,7 @@ int BrowserView::GetTabStripHeight() const {
// We want to return tabstrip_->height(), but we might be called in the midst
// of layout, when that hasn't yet been updated to reflect the current state.
// So return what the tabstrip height _ought_ to be right now.
- return tabstrip_ && IsTabStripVisible() ?
- tabstrip_->GetPreferredSize().height() : 0;
+ return IsTabStripVisible() ? tabstrip_->GetPreferredSize().height() : 0;
}
gfx::Point BrowserView::OffsetPointForToolbarBackgroundImage(
@@ -594,9 +593,19 @@ gfx::Point BrowserView::OffsetPointForToolbarBackgroundImage(
bool BrowserView::IsTabStripVisible() const {
if (immersive_mode_controller_->ShouldHideTopViews() &&
- immersive_mode_controller_->ShouldHideTabIndicators())
+ immersive_mode_controller_->ShouldHideTabIndicators()) {
return false;
- return browser_->SupportsWindowFeature(Browser::FEATURE_TABSTRIP);
+ }
+
+ // Return false if this window does not normally display a tabstrip.
+ if (!browser_->SupportsWindowFeature(Browser::FEATURE_TABSTRIP))
+ return false;
+
+ // Return false if the tabstrip has not yet been created (by InitViews()),
+ // since callers may otherwise try to access it. Note that we can't just check
+ // this alone, as the tabstrip is created unconditionally even for windows
+ // that won't display it.
+ return tabstrip_ != nullptr;
}
bool BrowserView::IsOffTheRecord() const {
« no previous file with comments | « chrome/browser/ui/views/frame/browser_non_client_frame_view_mus.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698