| 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_dialogs.h" |
| 8 #include "chrome/browser/ui/browser_window.h" |
| 9 #import "chrome/browser/ui/cocoa/browser_window_controller.h" |
| 10 #import "chrome/browser/ui/cocoa/website_settings/permission_bubble_cocoa.h" |
| 11 #import "chrome/browser/ui/cocoa/website_settings/permission_bubble_controller.h
" |
| 12 #import "chrome/browser/ui/cocoa/location_bar/location_bar_view_mac.h" |
| 13 #include "chrome/browser/ui/views/website_settings/permissions_bubble_view.h" |
| 14 #import "ui/base/cocoa/cocoa_base_utils.h" |
| 15 #import "ui/gfx/mac/coordinate_conversion.h" |
| 16 |
| 17 // Implementation of PermissionBubbleViewViews' anchor methods for Cocoa |
| 18 // browsers. In Cocoa browsers there is no parent views::View for the permission |
| 19 // bubble, so these methods supply an anchor point instead. |
| 20 |
| 21 views::View* PermissionBubbleViewViews::GetAnchorView() { |
| 22 return nullptr; |
| 23 } |
| 24 |
| 25 gfx::Point PermissionBubbleViewViews::GetAnchorPoint() { |
| 26 return gfx::ScreenPointFromNSPoint( |
| 27 [PermissionBubbleController getAnchorPointForBrowser:browser_]); |
| 28 } |
| 29 |
| 30 views::BubbleBorder::Arrow PermissionBubbleViewViews::GetAnchorArrow() { |
| 31 return [PermissionBubbleController hasVisibleLocationBarForBrowser:browser_] |
| 32 ? views::BubbleBorder::TOP_LEFT |
| 33 : views::BubbleBorder::NONE; |
| 34 } |
| 35 |
| 36 // static |
| 37 std::unique_ptr<PermissionBubbleView> PermissionBubbleView::Create( |
| 38 Browser* browser) { |
| 39 if (chrome::ToolkitViewsWebUIDialogsEnabled()) |
| 40 return base::WrapUnique(new PermissionBubbleViewViews(browser)); |
| 41 return base::WrapUnique(new PermissionBubbleCocoa(browser)); |
| 42 } |
| OLD | NEW |