OLD | NEW |
---|---|
(Empty) | |
1 // Copyright 2014 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 "chrome/browser/ui/cocoa/permission_bubble_cocoa.h" | |
6 | |
7 #import "chrome/browser/ui/cocoa/base_bubble_controller.h" | |
8 #import "chrome/browser/ui/cocoa/browser_window_controller.h" | |
9 #import "chrome/browser/ui/cocoa/location_bar/location_bar_view_mac.h" | |
10 #import "chrome/browser/ui/cocoa/permission_bubble_controller.h" | |
11 #import "chrome/browser/ui/website_settings/permission_bubble_view.h" | |
12 #include "content/public/browser/web_contents.h" | |
13 #include "content/public/browser/web_contents_view.h" | |
14 | |
15 PermissionBubbleCocoa::PermissionBubbleCocoa(NSWindow* parent_window) | |
16 : parent_window_(parent_window), delegate_(NULL), bubbleController_(nil) {} | |
17 | |
18 PermissionBubbleCocoa::~PermissionBubbleCocoa() {} | |
19 | |
20 void PermissionBubbleCocoa::Show( | |
21 const std::vector<PermissionBubbleDelegate*>& delegates, | |
22 const std::vector<bool>& accept_state, | |
23 bool customization_mode) { | |
24 DCHECK(parent_window_); | |
25 LocationBarViewMac* location_bar = | |
26 [[parent_window_ windowController] locationBarBridge]; | |
groby-ooo-7-16
2014/02/04 02:39:30
I'm surprised - does this not warn at compile time
leng
2014/02/04 21:48:22
Nope. <shrug>?
| |
27 | |
28 if (!bubbleController_) { | |
29 bubbleController_ = [[PermissionBubbleController alloc] | |
30 initWithParentWindow:parent_window_ | |
31 bridge:this]; | |
32 } | |
33 | |
34 NSPoint anchor = location_bar->GetPageInfoBubblePoint(); | |
35 [bubbleController_ showAtAnchor:[parent_window_ convertBaseToScreen:anchor] | |
36 withDelegate:delegate_ | |
37 forRequests:delegates | |
38 acceptStates:accept_state | |
39 customizationMode:customization_mode]; | |
40 } | |
41 | |
42 void PermissionBubbleCocoa::Hide() { | |
43 [bubbleController_ close]; | |
44 } | |
45 | |
46 void PermissionBubbleCocoa::SetDelegate(Delegate* delegate) { | |
47 delegate_ = delegate; | |
48 } | |
49 | |
50 void PermissionBubbleCocoa::OnBubbleClosing() { | |
51 bubbleController_ = nil; | |
52 } | |
OLD | NEW |