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

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: 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 unified diff | 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 »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 // Return false if the tabstrip has not yet been created (by InitViews()),
605 // since callers may otherwise try to access it. Note that we can't just check
606 // this alone, as the tabstrip is created unconditionally even for windows
607 // that won't display it.
608 return tabstrip_ != nullptr;
600 } 609 }
601 610
602 bool BrowserView::IsOffTheRecord() const { 611 bool BrowserView::IsOffTheRecord() const {
603 return browser_->profile()->IsOffTheRecord(); 612 return browser_->profile()->IsOffTheRecord();
604 } 613 }
605 614
606 bool BrowserView::IsGuestSession() const { 615 bool BrowserView::IsGuestSession() const {
607 return browser_->profile()->IsGuestSession(); 616 return browser_->profile()->IsGuestSession();
608 } 617 }
609 618
(...skipping 2089 matching lines...) Expand 10 before | Expand all | Expand 10 after
2699 } 2708 }
2700 2709
2701 extensions::ActiveTabPermissionGranter* 2710 extensions::ActiveTabPermissionGranter*
2702 BrowserView::GetActiveTabPermissionGranter() { 2711 BrowserView::GetActiveTabPermissionGranter() {
2703 content::WebContents* web_contents = GetActiveWebContents(); 2712 content::WebContents* web_contents = GetActiveWebContents();
2704 if (!web_contents) 2713 if (!web_contents)
2705 return nullptr; 2714 return nullptr;
2706 return extensions::TabHelper::FromWebContents(web_contents) 2715 return extensions::TabHelper::FromWebContents(web_contents)
2707 ->active_tab_permission_granter(); 2716 ->active_tab_permission_granter();
2708 } 2717 }
OLDNEW
« 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