| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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 "base/memory/ptr_util.h" | 5 #include "base/memory/ptr_util.h" |
| 6 #include "chrome/browser/ui/browser.h" | 6 #include "chrome/browser/ui/browser.h" |
| 7 #include "chrome/browser/ui/browser_window.h" | 7 #include "chrome/browser/ui/browser_window.h" |
| 8 #include "chrome/browser/ui/views/exclusive_access_bubble_views.h" | 8 #include "chrome/browser/ui/views/exclusive_access_bubble_views.h" |
| 9 #include "chrome/browser/ui/views/frame/browser_view.h" | 9 #include "chrome/browser/ui/views/frame/browser_view.h" |
| 10 #include "chrome/browser/ui/views/frame/top_container_view.h" | 10 #include "chrome/browser/ui/views/frame/top_container_view.h" |
| 11 #include "chrome/browser/ui/views/location_bar/location_bar_view.h" | 11 #include "chrome/browser/ui/views/location_bar/location_bar_view.h" |
| 12 #include "chrome/browser/ui/views/location_bar/location_icon_view.h" | 12 #include "chrome/browser/ui/views/location_bar/location_icon_view.h" |
| 13 #include "chrome/browser/ui/views/website_settings/permissions_bubble_view.h" | 13 #include "chrome/browser/ui/views/website_settings/permissions_bubble_view.h" |
| 14 #include "ui/gfx/geometry/point.h" | 14 #include "ui/gfx/geometry/point.h" |
| 15 | 15 |
| 16 // The Views browser implementation of PermissionBubbleViewViews' | 16 // The Views browser implementation of PermissionBubbleViewViews' |
| 17 // anchor methods. Views browsers have a native View to anchor the bubble to, | 17 // anchor methods. Views browsers have a native View to anchor the bubble to, |
| 18 // which these functions provide. | 18 // which these functions provide. |
| 19 | 19 |
| 20 views::View* PermissionBubbleViewViews::GetAnchorView() { | 20 views::View* PermissionBubbleViewViews::GetAnchorView() { |
| 21 BrowserView* browser_view = BrowserView::GetBrowserViewForBrowser(browser_); | 21 BrowserView* browser_view = BrowserView::GetBrowserViewForBrowser(browser_); |
| 22 | 22 |
| 23 if (browser_->SupportsWindowFeature(Browser::FEATURE_LOCATIONBAR)) | 23 if (browser_->SupportsWindowFeature(Browser::FEATURE_LOCATIONBAR)) |
| 24 return browser_view->GetLocationBarView()->location_icon_view(); | 24 return browser_view->GetLocationBarView()->location_icon_view(); |
| 25 | 25 |
| 26 if (browser_view->IsFullscreenBubbleVisible()) | |
| 27 return browser_view->exclusive_access_bubble()->GetView(); | |
| 28 | |
| 29 return browser_view->top_container(); | 26 return browser_view->top_container(); |
| 30 } | 27 } |
| 31 | 28 |
| 32 gfx::Point PermissionBubbleViewViews::GetAnchorPoint() { | 29 gfx::Point PermissionBubbleViewViews::GetAnchorPoint() { |
| 33 return gfx::Point(); | 30 return gfx::Point(); |
| 34 } | 31 } |
| 35 | 32 |
| 36 views::BubbleBorder::Arrow PermissionBubbleViewViews::GetAnchorArrow() { | 33 views::BubbleBorder::Arrow PermissionBubbleViewViews::GetAnchorArrow() { |
| 37 if (browser_->SupportsWindowFeature(Browser::FEATURE_LOCATIONBAR)) | 34 if (browser_->SupportsWindowFeature(Browser::FEATURE_LOCATIONBAR)) |
| 38 return views::BubbleBorder::TOP_LEFT; | 35 return views::BubbleBorder::TOP_LEFT; |
| 39 return views::BubbleBorder::NONE; | 36 return views::BubbleBorder::NONE; |
| 40 } | 37 } |
| 41 | 38 |
| 42 // static | 39 // static |
| 43 std::unique_ptr<PermissionBubbleView> PermissionBubbleView::Create( | 40 std::unique_ptr<PermissionBubbleView> PermissionBubbleView::Create( |
| 44 Browser* browser) { | 41 Browser* browser) { |
| 45 return base::WrapUnique(new PermissionBubbleViewViews(browser)); | 42 return base::WrapUnique(new PermissionBubbleViewViews(browser)); |
| 46 } | 43 } |
| OLD | NEW |