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