| 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_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 #import "base/memory/scoped_nsobject.h" | 10 #import "base/memory/scoped_nsobject.h" |
| (...skipping 12 matching lines...) Expand all Loading... |
| 23 extern NSString* const kBrowserActionButtonDraggingNotification; | 23 extern NSString* const kBrowserActionButtonDraggingNotification; |
| 24 // Fired when the user drops the button. | 24 // Fired when the user drops the button. |
| 25 extern NSString* const kBrowserActionButtonDragEndNotification; | 25 extern NSString* const kBrowserActionButtonDragEndNotification; |
| 26 | 26 |
| 27 @interface BrowserActionButton : NSButton { | 27 @interface BrowserActionButton : NSButton { |
| 28 @private | 28 @private |
| 29 // Bridge to proxy Chrome notifications to the Obj-C class as well as load the | 29 // Bridge to proxy Chrome notifications to the Obj-C class as well as load the |
| 30 // extension's icon. | 30 // extension's icon. |
| 31 scoped_ptr<ExtensionImageTrackerBridge> imageLoadingBridge_; | 31 scoped_ptr<ExtensionImageTrackerBridge> imageLoadingBridge_; |
| 32 | 32 |
| 33 // The default icon of the Button. | |
| 34 scoped_nsobject<NSImage> defaultIcon_; | |
| 35 | |
| 36 // The icon specific to the active tab. | |
| 37 scoped_nsobject<NSImage> tabSpecificIcon_; | |
| 38 | |
| 39 // Used to move the button and query whether a button is currently animating. | 33 // Used to move the button and query whether a button is currently animating. |
| 40 scoped_nsobject<NSViewAnimation> moveAnimation_; | 34 scoped_nsobject<NSViewAnimation> moveAnimation_; |
| 41 | 35 |
| 42 // The extension for this button. Weak. | 36 // The extension for this button. Weak. |
| 43 const extensions::Extension* extension_; | 37 const extensions::Extension* extension_; |
| 44 | 38 |
| 45 // The ID of the active tab. | 39 // The ID of the active tab. |
| 46 int tabId_; | 40 int tabId_; |
| 47 | 41 |
| 48 // Whether the button is currently being dragged. | 42 // Whether the button is currently being dragged. |
| 49 BOOL isBeingDragged_; | 43 BOOL isBeingDragged_; |
| 50 | 44 |
| 51 // Drag events could be intercepted by other buttons, so to make sure that | 45 // Drag events could be intercepted by other buttons, so to make sure that |
| 52 // this is the only button moving if it ends up being dragged. This is set to | 46 // this is the only button moving if it ends up being dragged. This is set to |
| 53 // YES upon |mouseDown:|. | 47 // YES upon |mouseDown:|. |
| 54 BOOL dragCouldStart_; | 48 BOOL dragCouldStart_; |
| 55 } | 49 } |
| 56 | 50 |
| 57 - (id)initWithFrame:(NSRect)frame | 51 - (id)initWithFrame:(NSRect)frame |
| 58 extension:(const extensions::Extension*)extension | 52 extension:(const extensions::Extension*)extension |
| 59 browser:(Browser*)browser | 53 browser:(Browser*)browser |
| 60 tabId:(int)tabId; | 54 tabId:(int)tabId; |
| 61 | 55 |
| 62 - (void)setFrame:(NSRect)frameRect animate:(BOOL)animate; | 56 - (void)setFrame:(NSRect)frameRect animate:(BOOL)animate; |
| 63 | 57 |
| 64 - (void)setDefaultIcon:(NSImage*)image; | |
| 65 | |
| 66 - (void)setTabSpecificIcon:(NSImage*)image; | |
| 67 | |
| 68 - (void)updateState; | 58 - (void)updateState; |
| 69 | 59 |
| 70 - (BOOL)isAnimating; | 60 - (BOOL)isAnimating; |
| 71 | 61 |
| 72 // Returns a pointer to an autoreleased NSImage with the badge, shadow and | 62 // Returns a pointer to an autoreleased NSImage with the badge, shadow and |
| 73 // cell image drawn into it. | 63 // cell image drawn into it. |
| 74 - (NSImage*)compositedImage; | 64 - (NSImage*)compositedImage; |
| 75 | 65 |
| 76 @property(readonly, nonatomic) BOOL isBeingDragged; | 66 @property(readonly, nonatomic) BOOL isBeingDragged; |
| 77 @property(readonly, nonatomic) const extensions::Extension* extension; | 67 @property(readonly, nonatomic) const extensions::Extension* extension; |
| 78 @property(readwrite, nonatomic) int tabId; | 68 @property(readwrite, nonatomic) int tabId; |
| 79 | 69 |
| 80 @end | 70 @end |
| 81 | 71 |
| 82 @interface BrowserActionCell : GradientButtonCell { | 72 @interface BrowserActionCell : GradientButtonCell { |
| 83 @private | 73 @private |
| 84 // The current tab ID used when drawing the cell. | 74 // The current tab ID used when drawing the cell. |
| 85 int tabId_; | 75 int tabId_; |
| 86 | 76 |
| 87 // The action we're drawing the cell for. Weak. | 77 // The action we're drawing the cell for. Weak. |
| 88 ExtensionAction* extensionAction_; | 78 ExtensionAction* extensionAction_; |
| 89 } | 79 } |
| 90 | 80 |
| 91 @property(readwrite, nonatomic) int tabId; | 81 @property(readwrite, nonatomic) int tabId; |
| 92 @property(readwrite, nonatomic) ExtensionAction* extensionAction; | 82 @property(readwrite, nonatomic) ExtensionAction* extensionAction; |
| 93 | 83 |
| 94 @end | 84 @end |
| 95 | 85 |
| 96 #endif // CHROME_BROWSER_UI_COCOA_EXTENSIONS_BROWSER_ACTION_BUTTON_H_ | 86 #endif // CHROME_BROWSER_UI_COCOA_EXTENSIONS_BROWSER_ACTION_BUTTON_H_ |
| OLD | NEW |