Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 Loading... | |
| 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 return tabstrip_ && | |
| 600 browser_->SupportsWindowFeature(Browser::FEATURE_TABSTRIP); | |
|
Peter Kasting
2016/03/11 22:19:50
Nit: I might reverse the order of these two condit
tdanderson
2016/03/14 20:38:33
Done.
| |
| 600 } | 601 } |
| 601 | 602 |
| 602 bool BrowserView::IsOffTheRecord() const { | 603 bool BrowserView::IsOffTheRecord() const { |
| 603 return browser_->profile()->IsOffTheRecord(); | 604 return browser_->profile()->IsOffTheRecord(); |
| 604 } | 605 } |
| 605 | 606 |
| 606 bool BrowserView::IsGuestSession() const { | 607 bool BrowserView::IsGuestSession() const { |
| 607 return browser_->profile()->IsGuestSession(); | 608 return browser_->profile()->IsGuestSession(); |
| 608 } | 609 } |
| 609 | 610 |
| (...skipping 2089 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2699 } | 2700 } |
| 2700 | 2701 |
| 2701 extensions::ActiveTabPermissionGranter* | 2702 extensions::ActiveTabPermissionGranter* |
| 2702 BrowserView::GetActiveTabPermissionGranter() { | 2703 BrowserView::GetActiveTabPermissionGranter() { |
| 2703 content::WebContents* web_contents = GetActiveWebContents(); | 2704 content::WebContents* web_contents = GetActiveWebContents(); |
| 2704 if (!web_contents) | 2705 if (!web_contents) |
| 2705 return nullptr; | 2706 return nullptr; |
| 2706 return extensions::TabHelper::FromWebContents(web_contents) | 2707 return extensions::TabHelper::FromWebContents(web_contents) |
| 2707 ->active_tab_permission_granter(); | 2708 ->active_tab_permission_granter(); |
| 2708 } | 2709 } |
| OLD | NEW |