OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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_EXTENSIONS_BROWSER_ACTIONS_CONTROLLER_H_ | 5 #ifndef CHROME_BROWSER_UI_COCOA_EXTENSIONS_BROWSER_ACTIONS_CONTROLLER_H_ |
6 #define CHROME_BROWSER_UI_COCOA_EXTENSIONS_BROWSER_ACTIONS_CONTROLLER_H_ | 6 #define CHROME_BROWSER_UI_COCOA_EXTENSIONS_BROWSER_ACTIONS_CONTROLLER_H_ |
7 | 7 |
8 #import <Cocoa/Cocoa.h> | 8 #import <Cocoa/Cocoa.h> |
9 | 9 |
10 #include <memory> | 10 #include <memory> |
11 | 11 |
12 #import "base/mac/scoped_nsobject.h" | 12 #import "base/mac/scoped_nsobject.h" |
13 #import "chrome/browser/ui/cocoa/has_weak_browser_pointer.h" | 13 #import "chrome/browser/ui/cocoa/has_weak_browser_pointer.h" |
14 #include "ui/gfx/geometry/size.h" | 14 #include "ui/gfx/geometry/size.h" |
15 | 15 |
16 class Browser; | 16 class Browser; |
17 @class BrowserActionButton; | 17 @class BrowserActionButton; |
18 @class BrowserActionsContainerView; | 18 @class BrowserActionsContainerView; |
19 @class MenuButton; | 19 @class MenuButton; |
20 class ToolbarActionsBar; | 20 class ToolbarActionsBar; |
21 @class ToolbarActionsBarBubbleMac; | 21 @class ToolbarActionsBarBubbleMac; |
| 22 class ToolbarActionsBarBubbleViewsPresenter; |
22 class ToolbarActionsBarDelegate; | 23 class ToolbarActionsBarDelegate; |
23 | 24 |
24 namespace content { | 25 namespace content { |
25 class WebContents; | 26 class WebContents; |
26 } | 27 } |
27 | 28 |
28 // Sent when the visibility of the Browser Actions changes. | 29 // Sent when the visibility of the Browser Actions changes. |
29 extern NSString* const kBrowserActionVisibilityChangedNotification; | 30 extern NSString* const kBrowserActionVisibilityChangedNotification; |
30 | 31 |
31 // Handles state and provides an interface for controlling the Browser Actions | 32 // Handles state and provides an interface for controlling the Browser Actions |
(...skipping 19 matching lines...) Expand all Loading... |
51 | 52 |
52 // True if this is the overflow container for toolbar actions. | 53 // True if this is the overflow container for toolbar actions. |
53 BOOL isOverflow_; | 54 BOOL isOverflow_; |
54 | 55 |
55 // The bubble that is actively showing, if any. | 56 // The bubble that is actively showing, if any. |
56 ToolbarActionsBarBubbleMac* activeBubble_; | 57 ToolbarActionsBarBubbleMac* activeBubble_; |
57 | 58 |
58 // The index of the currently-focused view in the overflow menu, or -1 if | 59 // The index of the currently-focused view in the overflow menu, or -1 if |
59 // no view is focused. | 60 // no view is focused. |
60 NSInteger focusedViewIndex_; | 61 NSInteger focusedViewIndex_; |
| 62 |
| 63 // Bridge for showing the toolkit-views bubble on a Cocoa browser. |
| 64 std::unique_ptr<ToolbarActionsBarBubbleViewsPresenter> viewsBubblePresenter_; |
61 } | 65 } |
62 | 66 |
63 @property(nonatomic) CGFloat maxWidth; | 67 @property(nonatomic) CGFloat maxWidth; |
64 @property(readonly, nonatomic) BrowserActionsContainerView* containerView; | 68 @property(readonly, nonatomic) BrowserActionsContainerView* containerView; |
65 @property(readonly, nonatomic) Browser* browser; | 69 @property(readonly, nonatomic) Browser* browser; |
66 @property(readonly, nonatomic) BOOL isOverflow; | 70 @property(readonly, nonatomic) BOOL isOverflow; |
67 @property(readonly, nonatomic) ToolbarActionsBarBubbleMac* activeBubble; | 71 @property(readonly, nonatomic) ToolbarActionsBarBubbleMac* activeBubble; |
68 | 72 |
69 // Initializes the controller given the current browser and container view that | 73 // Initializes the controller given the current browser and container view that |
70 // will hold the browser action buttons. If |mainController| is nil, the created | 74 // will hold the browser action buttons. If |mainController| is nil, the created |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
102 | 106 |
103 // Returns the associated ToolbarActionsBar. | 107 // Returns the associated ToolbarActionsBar. |
104 - (ToolbarActionsBar*)toolbarActionsBar; | 108 - (ToolbarActionsBar*)toolbarActionsBar; |
105 | 109 |
106 // Sets whether or not the overflow container is focused in the app menu. | 110 // Sets whether or not the overflow container is focused in the app menu. |
107 - (void)setFocusedInOverflow:(BOOL)focused; | 111 - (void)setFocusedInOverflow:(BOOL)focused; |
108 | 112 |
109 // Returns the size for the provided |maxWidth| of the overflow menu. | 113 // Returns the size for the provided |maxWidth| of the overflow menu. |
110 - (gfx::Size)sizeForOverflowWidth:(int)maxWidth; | 114 - (gfx::Size)sizeForOverflowWidth:(int)maxWidth; |
111 | 115 |
| 116 // Called when the window for the active bubble is closing, and sets the active |
| 117 // bubble to nil. |
| 118 - (void)bubbleWindowClosing:(NSNotification*)notification; |
| 119 |
112 @end // @interface BrowserActionsController | 120 @end // @interface BrowserActionsController |
113 | 121 |
114 @interface BrowserActionsController(TestingAPI) | 122 @interface BrowserActionsController(TestingAPI) |
115 - (BrowserActionButton*)buttonWithIndex:(NSUInteger)index; | 123 - (BrowserActionButton*)buttonWithIndex:(NSUInteger)index; |
116 @end | 124 @end |
117 | 125 |
118 #endif // CHROME_BROWSER_UI_COCOA_EXTENSIONS_BROWSER_ACTIONS_CONTROLLER_H_ | 126 #endif // CHROME_BROWSER_UI_COCOA_EXTENSIONS_BROWSER_ACTIONS_CONTROLLER_H_ |
OLD | NEW |