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