Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(200)

Side by Side Diff: chrome/browser/ui/cocoa/extensions/browser_actions_controller.h

Issue 670463004: Make a platform-independent ToolbarActionViewController (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 #import "base/mac/scoped_nsobject.h" 10 #import "base/mac/scoped_nsobject.h"
11 #include "base/memory/scoped_ptr.h" 11 #include "base/memory/scoped_ptr.h"
12 12
13 class Browser; 13 class Browser;
14 @class BrowserActionButton; 14 @class BrowserActionButton;
15 @class BrowserActionsContainerView; 15 @class BrowserActionsContainerView;
16 @class ExtensionPopupController; 16 @class ExtensionPopupController;
17 class ExtensionServiceObserverBridge; 17 class ExtensionServiceObserverBridge;
18 @class MenuButton; 18 @class MenuButton;
19 class Profile; 19 class Profile;
20 20
21 namespace extensions { 21 namespace extensions {
22 class Extension; 22 class Extension;
23 class ExtensionToolbarModel; 23 class ExtensionToolbarModel;
24 } 24 }
25 25
26 namespace content {
27 class WebContents;
28 }
29
26 // Sent when the visibility of the Browser Actions changes. 30 // Sent when the visibility of the Browser Actions changes.
27 extern NSString* const kBrowserActionVisibilityChangedNotification; 31 extern NSString* const kBrowserActionVisibilityChangedNotification;
28 32
29 // Handles state and provides an interface for controlling the Browser Actions 33 // Handles state and provides an interface for controlling the Browser Actions
30 // container within the Toolbar. 34 // container within the Toolbar.
31 @interface BrowserActionsController : NSObject<NSMenuDelegate> { 35 @interface BrowserActionsController : NSObject<NSMenuDelegate> {
32 @private 36 @private
33 // Reference to the current browser. Weak. 37 // Reference to the current browser. Weak.
34 Browser* browser_; 38 Browser* browser_;
35 39
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
78 - (NSUInteger)buttonCount; 82 - (NSUInteger)buttonCount;
79 83
80 // Returns the current number of browser action buttons displayed in the 84 // Returns the current number of browser action buttons displayed in the
81 // container. 85 // container.
82 - (NSUInteger)visibleButtonCount; 86 - (NSUInteger)visibleButtonCount;
83 87
84 // Resizes the container given the number of visible buttons, taking into 88 // Resizes the container given the number of visible buttons, taking into
85 // account the size of the grippy. Also updates the persistent width preference. 89 // account the size of the grippy. Also updates the persistent width preference.
86 - (void)resizeContainerAndAnimate:(BOOL)animate; 90 - (void)resizeContainerAndAnimate:(BOOL)animate;
87 91
88 // Returns the NSView for the action button associated with an extension.
89 - (NSView*)browserActionViewForExtension:(
90 const extensions::Extension*)extension;
91
92 // Returns the saved width determined by the number of shown Browser Actions 92 // Returns the saved width determined by the number of shown Browser Actions
93 // preference property. If no preference is found, then the width for the 93 // preference property. If no preference is found, then the width for the
94 // container is returned as if all buttons are shown. 94 // container is returned as if all buttons are shown.
95 - (CGFloat)savedWidth; 95 - (CGFloat)savedWidth;
96 96
97 // Returns where the popup arrow should point to for a given Browser Action. If 97 // Returns where the popup arrow should point to for the action with the given
98 // it is passed an extension that is not a Browser Action, then it will return 98 // |id|. If passed an id with no corresponding button, returns NSZeroPoint.
99 // NSZeroPoint. 99 - (NSPoint)popupPointForId:(const std::string&)id;
100 - (NSPoint)popupPointForBrowserAction:(const extensions::Extension*)extension;
101 100
102 // Returns whether the chevron button is currently hidden or in the process of 101 // Returns whether the chevron button is currently hidden or in the process of
103 // being hidden (fading out). Will return NO if it is not hidden or is in the 102 // being hidden (fading out). Will return NO if it is not hidden or is in the
104 // process of fading in. 103 // process of fading in.
105 - (BOOL)chevronIsHidden; 104 - (BOOL)chevronIsHidden;
106 105
107 // Activates the browser action for the extension that has the given id. 106 // Activates the browser action for the extension that has the given id.
108 - (void)activateBrowserAction:(const std::string&)extension_id; 107 - (void)activateBrowserAction:(const std::string&)extension_id;
109 108
109 // Returns the currently-active web contents.
110 - (content::WebContents*)currentWebContents;
111
110 @end // @interface BrowserActionsController 112 @end // @interface BrowserActionsController
111 113
112 @interface BrowserActionsController(TestingAPI) 114 @interface BrowserActionsController(TestingAPI)
113 - (BrowserActionButton*)buttonWithIndex:(NSUInteger)index; 115 - (BrowserActionButton*)buttonWithIndex:(NSUInteger)index;
114 @end 116 @end
115 117
116 #endif // CHROME_BROWSER_UI_COCOA_EXTENSIONS_BROWSER_ACTIONS_CONTROLLER_H_ 118 #endif // CHROME_BROWSER_UI_COCOA_EXTENSIONS_BROWSER_ACTIONS_CONTROLLER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698