OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 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 | 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 #import <Cocoa/Cocoa.h> | 5 #import <Cocoa/Cocoa.h> |
6 | 6 |
7 #include "base/mac/scoped_nsobject.h" | 7 #include "base/mac/scoped_nsobject.h" |
8 #import "chrome/browser/ui/cocoa/base_bubble_controller.h" | 8 #import "chrome/browser/ui/cocoa/base_bubble_controller.h" |
9 #include "chrome/browser/ui/website_settings/permission_bubble_view.h" | 9 #include "chrome/browser/ui/website_settings/permission_bubble_view.h" |
10 #include "ui/base/models/simple_menu_model.h" | 10 #include "ui/base/models/simple_menu_model.h" |
11 | 11 |
12 @class MenuController; | 12 @class MenuController; |
13 class PermissionBubbleCocoa; | 13 class PermissionBubbleCocoa; |
14 class PermissionBubbleRequest; | 14 class PermissionBubbleRequest; |
15 | 15 |
16 @interface PermissionBubbleController : | 16 @interface PermissionBubbleController : |
17 BaseBubbleController<NSTextViewDelegate> { | 17 BaseBubbleController<NSTextViewDelegate> { |
18 @private | 18 @private |
19 // Array of views that are the checkboxes for every requested permission. | 19 // Array of views that are the checkboxes for every requested permission. |
20 // Only populated if multiple requests are shown at once. | 20 // Only populated if multiple requests are shown at once. |
21 base::scoped_nsobject<NSMutableArray> checkboxes_; | 21 base::scoped_nsobject<NSMutableArray> checkboxes_; |
22 | 22 |
23 // Delegate to be informed of user actions. | 23 // Delegate to be informed of user actions. |
24 PermissionBubbleView::Delegate* delegate_; // Weak. | 24 PermissionBubbleView::Delegate* delegate_; // Weak. |
25 | 25 |
26 // Used to determine the correct anchor location and parent window. | 26 // Used to determine the correct anchor location and parent window. |
27 Browser* browser_; // Weak. | 27 Browser* browser_; // Weak. |
28 | 28 |
29 // Delegate that receives menu events on behalf of this. | 29 // Delegate that receives menu events on behalf of this. |
30 scoped_ptr<ui::SimpleMenuModel::Delegate> menuDelegate_; | 30 std::unique_ptr<ui::SimpleMenuModel::Delegate> menuDelegate_; |
31 | 31 |
32 // Bridge to the C++ class that created this object. | 32 // Bridge to the C++ class that created this object. |
33 PermissionBubbleCocoa* bridge_; // Weak. | 33 PermissionBubbleCocoa* bridge_; // Weak. |
34 } | 34 } |
35 | 35 |
36 // Designated initializer. |browser| and |bridge| must both be non-nil. | 36 // Designated initializer. |browser| and |bridge| must both be non-nil. |
37 - (id)initWithBrowser:(Browser*)browser bridge:(PermissionBubbleCocoa*)bridge; | 37 - (id)initWithBrowser:(Browser*)browser bridge:(PermissionBubbleCocoa*)bridge; |
38 | 38 |
39 // Makes the bubble visible. The bubble will be popuplated with text retrieved | 39 // Makes the bubble visible. The bubble will be popuplated with text retrieved |
40 // from |requests|. |delegate| will receive callbacks for user actions. | 40 // from |requests|. |delegate| will receive callbacks for user actions. |
41 - (void)showWithDelegate:(PermissionBubbleView::Delegate*)delegate | 41 - (void)showWithDelegate:(PermissionBubbleView::Delegate*)delegate |
42 forRequests:(const std::vector<PermissionBubbleRequest*>&)requests | 42 forRequests:(const std::vector<PermissionBubbleRequest*>&)requests |
43 acceptStates:(const std::vector<bool>&)acceptStates; | 43 acceptStates:(const std::vector<bool>&)acceptStates; |
44 | 44 |
45 // Will reposition the bubble based in case the anchor or parent should change. | 45 // Will reposition the bubble based in case the anchor or parent should change. |
46 - (void)updateAnchorPosition; | 46 - (void)updateAnchorPosition; |
47 | 47 |
48 // Will calculate the expected anchor point for this bubble. | 48 // Will calculate the expected anchor point for this bubble. |
49 // Should only be used outside this class for tests. | 49 // Should only be used outside this class for tests. |
50 - (NSPoint)getExpectedAnchorPoint; | 50 - (NSPoint)getExpectedAnchorPoint; |
51 | 51 |
52 // Returns true of the browser has support for the location bar. | 52 // Returns true of the browser has support for the location bar. |
53 // Should only be used outside this class for tests. | 53 // Should only be used outside this class for tests. |
54 - (bool)hasLocationBar; | 54 - (bool)hasLocationBar; |
55 | 55 |
56 @end | 56 @end |
OLD | NEW |