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