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 |customizationMode| is YES when the UI is shown. | 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 // Delegate that receives menu events on behalf of this. | 26 // Delegate that receives menu events on behalf of this. |
27 scoped_ptr<ui::SimpleMenuModel::Delegate> menuDelegate_; | 27 scoped_ptr<ui::SimpleMenuModel::Delegate> menuDelegate_; |
28 | 28 |
29 // Bridge to the C++ class that created this object. | 29 // Bridge to the C++ class that created this object. |
30 PermissionBubbleCocoa* bridge_; // Weak. | 30 PermissionBubbleCocoa* bridge_; // Weak. |
31 } | 31 } |
32 | 32 |
33 // Designated initializer. |parentWindow| and |bridge| must both be non-nil. | 33 // Designated initializer. |parentWindow| and |bridge| must both be non-nil. |
34 - (id)initWithParentWindow:(NSWindow*)parentWindow | 34 - (id)initWithParentWindow:(NSWindow*)parentWindow |
35 bridge:(PermissionBubbleCocoa*)bridge; | 35 bridge:(PermissionBubbleCocoa*)bridge; |
36 | 36 |
37 // Makes the bubble visible, with an arrow pointing to |anchor|. The bubble | 37 // Makes the bubble visible, with an arrow pointing to |anchor|. The bubble |
38 // will be populated with text retrieved from |requests|. If | 38 // will be populated with text retrieved from |requests|. If |
39 // |customizationMode| is YES, each request will have a checkbox, with its state | 39 // |customizationMode| is YES, each request will have a checkbox, with its state |
40 // set to the corresponding element in |acceptStates|. If it is NO, each | 40 // set to the corresponding element in |acceptStates|. If it is NO, each |
41 // request will have a bullet point and |acceptStates| may be empty. |delegate| | 41 // request will have a bullet point and |acceptStates| may be empty. |delegate| |
42 // will receive callbacks for user actions. | 42 // will receive callbacks for user actions. |
43 - (void)showAtAnchor:(NSPoint)anchor | 43 - (void)showAtAnchor:(NSPoint)anchor |
44 withDelegate:(PermissionBubbleView::Delegate*)delegate | 44 withDelegate:(PermissionBubbleView::Delegate*)delegate |
45 forRequests:(const std::vector<PermissionBubbleRequest*>&)requests | 45 forRequests:(const std::vector<PermissionBubbleRequest*>&)requests |
46 acceptStates:(const std::vector<bool>&)acceptStates | 46 acceptStates:(const std::vector<bool>&)acceptStates; |
47 customizationMode:(BOOL)customizationMode; | |
48 | |
49 // Called when a menu item is selected. | |
50 - (void)onMenuItemClicked:(int)commandId; | |
51 | 47 |
52 @end | 48 @end |
OLD | NEW |