OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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_ACTION_BUTTON_H_ | 5 #ifndef CHROME_BROWSER_UI_COCOA_EXTENSIONS_BROWSER_ACTION_BUTTON_H_ |
6 #define CHROME_BROWSER_UI_COCOA_EXTENSIONS_BROWSER_ACTION_BUTTON_H_ | 6 #define CHROME_BROWSER_UI_COCOA_EXTENSIONS_BROWSER_ACTION_BUTTON_H_ |
7 | 7 |
8 #import <Cocoa/Cocoa.h> | 8 #import <Cocoa/Cocoa.h> |
9 | 9 |
10 #include <string> | |
11 | |
12 #import "base/mac/scoped_nsobject.h" | 10 #import "base/mac/scoped_nsobject.h" |
13 #include "base/memory/scoped_ptr.h" | 11 #include "base/memory/scoped_ptr.h" |
14 #import "chrome/browser/ui/cocoa/image_button_cell.h" | 12 #import "chrome/browser/ui/cocoa/image_button_cell.h" |
15 | 13 |
16 class Browser; | 14 class Browser; |
17 @class BrowserActionsController; | 15 @class BrowserActionsController; |
18 @class ExtensionActionContextMenuController; | |
19 class ToolbarActionViewController; | 16 class ToolbarActionViewController; |
20 class ToolbarActionViewDelegateBridge; | 17 class ToolbarActionViewDelegateBridge; |
21 | 18 |
22 // Fired on each drag event while the user is moving the button. | 19 // Fired on each drag event while the user is moving the button. |
23 extern NSString* const kBrowserActionButtonDraggingNotification; | 20 extern NSString* const kBrowserActionButtonDraggingNotification; |
24 // Fired when the user drops the button. | 21 // Fired when the user drops the button. |
25 extern NSString* const kBrowserActionButtonDragEndNotification; | 22 extern NSString* const kBrowserActionButtonDragEndNotification; |
26 | 23 |
27 @interface BrowserActionButton : NSButton<NSMenuDelegate> { | 24 @interface BrowserActionButton : NSButton<NSMenuDelegate> { |
28 @private | 25 @private |
(...skipping 13 matching lines...) Expand all Loading... |
42 BOOL isBeingDragged_; | 39 BOOL isBeingDragged_; |
43 | 40 |
44 // Drag events could be intercepted by other buttons, so to make sure that | 41 // Drag events could be intercepted by other buttons, so to make sure that |
45 // this is the only button moving if it ends up being dragged. This is set to | 42 // this is the only button moving if it ends up being dragged. This is set to |
46 // YES upon |mouseDown:|. | 43 // YES upon |mouseDown:|. |
47 BOOL dragCouldStart_; | 44 BOOL dragCouldStart_; |
48 | 45 |
49 // The point where the mouse down event occurred. Used to prevent a drag from | 46 // The point where the mouse down event occurred. Used to prevent a drag from |
50 // starting until it moves at least kMinimumDragDistance. | 47 // starting until it moves at least kMinimumDragDistance. |
51 NSPoint dragStartPoint_; | 48 NSPoint dragStartPoint_; |
52 | |
53 base::scoped_nsobject< | |
54 ExtensionActionContextMenuController> contextMenuController_; | |
55 } | 49 } |
56 | 50 |
57 // Init the button with the frame. Takes ownership of |viewController| and | 51 // Init the button with the frame. Takes ownership of |viewController|, but |
58 // |menuController|, does not own |controller|. | 52 // does not own |controller|. |
59 - (id)initWithFrame:(NSRect)frame | 53 - (id)initWithFrame:(NSRect)frame |
60 viewController:(scoped_ptr<ToolbarActionViewController>)viewController | 54 viewController:(scoped_ptr<ToolbarActionViewController>)viewController |
61 controller:(BrowserActionsController*)controller | 55 controller:(BrowserActionsController*)controller; |
62 menuController:(ExtensionActionContextMenuController*)menuController; | |
63 | 56 |
64 - (void)setFrame:(NSRect)frameRect animate:(BOOL)animate; | 57 - (void)setFrame:(NSRect)frameRect animate:(BOOL)animate; |
65 | 58 |
66 - (void)updateState; | 59 - (void)updateState; |
67 | 60 |
68 - (BOOL)isAnimating; | 61 - (BOOL)isAnimating; |
69 | 62 |
70 - (ToolbarActionViewController*)viewController; | 63 - (ToolbarActionViewController*)viewController; |
71 | 64 |
72 // Returns a pointer to an autoreleased NSImage with the badge, shadow and | 65 // Returns a pointer to an autoreleased NSImage with the badge, shadow and |
(...skipping 13 matching lines...) Expand all Loading... |
86 ToolbarActionViewController* viewController_; | 79 ToolbarActionViewController* viewController_; |
87 } | 80 } |
88 | 81 |
89 @property(assign, nonatomic) | 82 @property(assign, nonatomic) |
90 BrowserActionsController* browserActionsController; | 83 BrowserActionsController* browserActionsController; |
91 @property(readwrite, nonatomic) ToolbarActionViewController* viewController; | 84 @property(readwrite, nonatomic) ToolbarActionViewController* viewController; |
92 | 85 |
93 @end | 86 @end |
94 | 87 |
95 #endif // CHROME_BROWSER_UI_COCOA_EXTENSIONS_BROWSER_ACTION_BUTTON_H_ | 88 #endif // CHROME_BROWSER_UI_COCOA_EXTENSIONS_BROWSER_ACTION_BUTTON_H_ |
OLD | NEW |