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/omnibox_decoration_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 MenuController; | 17 @class MenuController; |
17 class PermissionBubbleCocoa; | 18 class PermissionBubbleCocoa; |
18 class PermissionRequest; | 19 class PermissionRequest; |
19 | 20 |
20 @interface PermissionBubbleController | 21 @interface PermissionBubbleController |
21 : OmniboxDecorationBubbleController<NSTextViewDelegate> { | 22 : BaseBubbleController<NSTextViewDelegate> { |
22 @private | 23 @private |
23 // Array of views that are the checkboxes for every requested permission. | 24 // Array of views that are the checkboxes for every requested permission. |
24 // Only populated if multiple requests are shown at once. | 25 // Only populated if multiple requests are shown at once. |
25 base::scoped_nsobject<NSMutableArray> checkboxes_; | 26 base::scoped_nsobject<NSMutableArray> checkboxes_; |
26 | 27 |
27 // Delegate to be informed of user actions. | 28 // Delegate to be informed of user actions. |
28 PermissionPrompt::Delegate* delegate_; // Weak. | 29 PermissionPrompt::Delegate* delegate_; // Weak. |
29 | 30 |
30 // Used to determine the correct anchor location and parent window. | 31 // Used to determine the correct anchor location and parent window. |
31 Browser* browser_; // Weak. | 32 Browser* browser_; // Weak. |
32 | 33 |
33 // Delegate that receives menu events on behalf of this. | 34 // Delegate that receives menu events on behalf of this. |
34 std::unique_ptr<ui::SimpleMenuModel::Delegate> menuDelegate_; | 35 std::unique_ptr<ui::SimpleMenuModel::Delegate> menuDelegate_; |
35 | 36 |
36 // Bridge to the C++ class that created this object. | 37 // Bridge to the C++ class that created this object. |
37 PermissionBubbleCocoa* bridge_; // Weak. | 38 PermissionBubbleCocoa* bridge_; // Weak. |
| 39 |
| 40 // The omnibox icon the bubble is anchored to. The icon is set as active |
| 41 // when the bubble is opened, and inactive when the bubble is closed. |
| 42 // Usually we would override OmniboxDecorationBubbleController but the page |
| 43 // info icon has a special case where it might cause a race condition. |
| 44 LocationBarDecoration* decoration_; // Weak. |
38 } | 45 } |
39 | 46 |
40 // Designated initializer. |browser| and |bridge| must both be non-nil. | 47 // Designated initializer. |browser| and |bridge| must both be non-nil. |
41 - (id)initWithBrowser:(Browser*)browser bridge:(PermissionBubbleCocoa*)bridge; | 48 - (id)initWithBrowser:(Browser*)browser bridge:(PermissionBubbleCocoa*)bridge; |
42 | 49 |
43 // Returns the anchor point to use for the given Cocoa |browser|. | 50 // Returns the anchor point to use for the given Cocoa |browser|. |
44 + (NSPoint)getAnchorPointForBrowser:(Browser*)browser; | 51 + (NSPoint)getAnchorPointForBrowser:(Browser*)browser; |
45 | 52 |
46 // Returns true if |browser| has a visible location bar. | 53 // Returns true if |browser| has a visible location bar. |
47 + (bool)hasVisibleLocationBarForBrowser:(Browser*)browser; | 54 + (bool)hasVisibleLocationBarForBrowser:(Browser*)browser; |
(...skipping 11 matching lines...) Expand all Loading... |
59 // Should only be used outside this class for tests. | 66 // Should only be used outside this class for tests. |
60 - (NSPoint)getExpectedAnchorPoint; | 67 - (NSPoint)getExpectedAnchorPoint; |
61 | 68 |
62 // Returns true if the browser has a visible location bar. | 69 // Returns true if the browser has a visible location bar. |
63 // Should only be used outside this class for tests. | 70 // Should only be used outside this class for tests. |
64 - (bool)hasVisibleLocationBar; | 71 - (bool)hasVisibleLocationBar; |
65 | 72 |
66 @end | 73 @end |
67 | 74 |
68 #endif // CHROME_BROWSER_UI_COCOA_PERMISSION_BUBBLE_PERMISSION_BUBBLE_CONTROLLE
R_H_ | 75 #endif // CHROME_BROWSER_UI_COCOA_PERMISSION_BUBBLE_PERMISSION_BUBBLE_CONTROLLE
R_H_ |
OLD | NEW |