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 #ifndef CHROME_BROWSER_UI_COCOA_PERMISSION_BUBBLE_PERMISSION_BUBBLE_CONTROLLER_H
_ | 5 #ifndef CHROME_BROWSER_UI_COCOA_PERMISSION_BUBBLE_PERMISSION_BUBBLE_CONTROLLER_H
_ |
6 #define CHROME_BROWSER_UI_COCOA_PERMISSION_BUBBLE_PERMISSION_BUBBLE_CONTROLLER_H
_ | 6 #define CHROME_BROWSER_UI_COCOA_PERMISSION_BUBBLE_PERMISSION_BUBBLE_CONTROLLER_H
_ |
7 | 7 |
8 #import <Cocoa/Cocoa.h> | 8 #import <Cocoa/Cocoa.h> |
9 | 9 |
10 #include "base/mac/scoped_nsobject.h" | 10 #include "base/mac/scoped_nsobject.h" |
11 #import "chrome/browser/ui/cocoa/base_bubble_controller.h" | 11 #import "chrome/browser/ui/cocoa/base_bubble_controller.h" |
12 #include "chrome/browser/ui/permission_bubble/permission_prompt.h" | 12 #include "chrome/browser/ui/permission_bubble/permission_prompt.h" |
13 #include "ui/base/models/simple_menu_model.h" | 13 #include "ui/base/models/simple_menu_model.h" |
14 | 14 |
15 class Browser; | 15 class Browser; |
16 class LocationBarDecoration; | 16 class LocationBarDecoration; |
17 @class MenuController; | 17 @class MenuController; |
18 class PermissionBubbleCocoa; | 18 class PermissionBubbleCocoa; |
19 class PermissionRequest; | |
20 | 19 |
21 @interface PermissionBubbleController | 20 @interface PermissionBubbleController |
22 : BaseBubbleController<NSTextViewDelegate> { | 21 : BaseBubbleController<NSTextViewDelegate> { |
23 @private | 22 @private |
24 // Array of views that are the checkboxes for every requested permission. | 23 // Array of views that are the checkboxes for every requested permission. |
25 // Only populated if multiple requests are shown at once. | 24 // Only populated if multiple requests are shown at once. |
26 base::scoped_nsobject<NSMutableArray> checkboxes_; | 25 base::scoped_nsobject<NSMutableArray> checkboxes_; |
27 | 26 |
28 // Delegate to be informed of user actions. | 27 // Delegate to be informed of user actions. |
29 PermissionPrompt::Delegate* delegate_; // Weak. | 28 PermissionPrompt::Delegate* delegate_; // Weak. |
(...skipping 17 matching lines...) Expand all Loading... |
47 // Designated initializer. |browser| and |bridge| must both be non-nil. | 46 // Designated initializer. |browser| and |bridge| must both be non-nil. |
48 - (id)initWithBrowser:(Browser*)browser bridge:(PermissionBubbleCocoa*)bridge; | 47 - (id)initWithBrowser:(Browser*)browser bridge:(PermissionBubbleCocoa*)bridge; |
49 | 48 |
50 // Returns the anchor point to use for the given Cocoa |browser|. | 49 // Returns the anchor point to use for the given Cocoa |browser|. |
51 + (NSPoint)getAnchorPointForBrowser:(Browser*)browser; | 50 + (NSPoint)getAnchorPointForBrowser:(Browser*)browser; |
52 | 51 |
53 // Returns true if |browser| has a visible location bar. | 52 // Returns true if |browser| has a visible location bar. |
54 + (bool)hasVisibleLocationBarForBrowser:(Browser*)browser; | 53 + (bool)hasVisibleLocationBarForBrowser:(Browser*)browser; |
55 | 54 |
56 // Makes the bubble visible. The bubble will be populated with text retrieved | 55 // Makes the bubble visible. The bubble will be populated with text retrieved |
57 // from |requests|. |delegate| will receive callbacks for user actions. | 56 // from |delegate|, which will also receive callbacks for user actions. |
58 - (void)showWithDelegate:(PermissionPrompt::Delegate*)delegate | 57 - (void)showWithDelegate:(PermissionPrompt::Delegate*)delegate; |
59 forRequests:(const std::vector<PermissionRequest*>&)requests | |
60 acceptStates:(const std::vector<bool>&)acceptStates; | |
61 | 58 |
62 // Will reposition the bubble based in case the anchor or parent should change. | 59 // Will reposition the bubble based in case the anchor or parent should change. |
63 - (void)updateAnchorPosition; | 60 - (void)updateAnchorPosition; |
64 | 61 |
65 // Will calculate the expected anchor point for this bubble. | 62 // Will calculate the expected anchor point for this bubble. |
66 // Should only be used outside this class for tests. | 63 // Should only be used outside this class for tests. |
67 - (NSPoint)getExpectedAnchorPoint; | 64 - (NSPoint)getExpectedAnchorPoint; |
68 | 65 |
69 // Returns true if the browser has a visible location bar. | 66 // Returns true if the browser has a visible location bar. |
70 // Should only be used outside this class for tests. | 67 // Should only be used outside this class for tests. |
71 - (bool)hasVisibleLocationBar; | 68 - (bool)hasVisibleLocationBar; |
72 | 69 |
73 @end | 70 @end |
74 | 71 |
75 #endif // CHROME_BROWSER_UI_COCOA_PERMISSION_BUBBLE_PERMISSION_BUBBLE_CONTROLLE
R_H_ | 72 #endif // CHROME_BROWSER_UI_COCOA_PERMISSION_BUBBLE_PERMISSION_BUBBLE_CONTROLLE
R_H_ |
OLD | NEW |