| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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_COCOA_EXTENSIONS_BROWSER_ACTION_BUTTON_H_ | 5 #ifndef CHROME_BROWSER_COCOA_EXTENSIONS_BROWSER_ACTION_BUTTON_H_ |
| 6 #define CHROME_BROWSER_COCOA_EXTENSIONS_BROWSER_ACTION_BUTTON_H_ | 6 #define CHROME_BROWSER_COCOA_EXTENSIONS_BROWSER_ACTION_BUTTON_H_ |
| 7 | 7 |
| 8 #import <Cocoa/Cocoa.h> | 8 #import <Cocoa/Cocoa.h> |
| 9 | 9 |
| 10 #import "base/scoped_nsobject.h" | 10 #import "base/scoped_nsobject.h" |
| 11 #include "base/scoped_ptr.h" | 11 #include "base/scoped_ptr.h" |
| 12 #import "chrome/browser/cocoa/gradient_button_cell.h" | 12 #import "chrome/browser/cocoa/gradient_button_cell.h" |
| 13 | 13 |
| 14 class Extension; | 14 class Extension; |
| 15 class ExtensionAction; | 15 class ExtensionAction; |
| 16 class ExtensionImageTrackerBridge; | 16 class ExtensionImageTrackerBridge; |
| 17 class Profile; | 17 class Profile; |
| 18 | 18 |
| 19 // Fired when the Browser Action's state has changed. Usually the image needs to | 19 // Fired when the Browser Action's state has changed. Usually the image needs to |
| 20 // be updated. | 20 // be updated. |
| 21 extern NSString* const kBrowserActionButtonUpdatedNotification; | 21 extern NSString* const kBrowserActionButtonUpdatedNotification; |
| 22 | 22 |
| 23 // Fired on each drag event while the user is moving the button. | 23 // Fired on each drag event while the user is moving the button. |
| 24 extern NSString* const kBrowserActionButtonDraggingNotification; | 24 extern NSString* const kBrowserActionButtonDraggingNotification; |
| 25 // Fired when the user drops the button. | 25 // Fired when the user drops the button. |
| 26 extern NSString* const kBrowserActionButtonDragEndNotification; | 26 extern NSString* const kBrowserActionButtonDragEndNotification; |
| 27 | 27 |
| 28 extern const CGFloat kBrowserActionWidth; | |
| 29 | |
| 30 @interface BrowserActionButton : NSButton { | 28 @interface BrowserActionButton : NSButton { |
| 31 @private | 29 @private |
| 32 // Bridge to proxy Chrome notifications to the Obj-C class as well as load the | 30 // Bridge to proxy Chrome notifications to the Obj-C class as well as load the |
| 33 // extension's icon. | 31 // extension's icon. |
| 34 scoped_ptr<ExtensionImageTrackerBridge> imageLoadingBridge_; | 32 scoped_ptr<ExtensionImageTrackerBridge> imageLoadingBridge_; |
| 35 | 33 |
| 36 // The default icon of the Button. | 34 // The default icon of the Button. |
| 37 scoped_nsobject<NSImage> defaultIcon_; | 35 scoped_nsobject<NSImage> defaultIcon_; |
| 38 | 36 |
| 39 // The icon specific to the active tab. | 37 // The icon specific to the active tab. |
| (...skipping 10 matching lines...) Expand all Loading... |
| 50 | 48 |
| 51 // Whether the button is currently being dragged. | 49 // Whether the button is currently being dragged. |
| 52 BOOL isBeingDragged_; | 50 BOOL isBeingDragged_; |
| 53 | 51 |
| 54 // Drag events could be intercepted by other buttons, so to make sure that | 52 // Drag events could be intercepted by other buttons, so to make sure that |
| 55 // this is the only button moving if it ends up being dragged. This is set to | 53 // this is the only button moving if it ends up being dragged. This is set to |
| 56 // YES upon |mouseDown:|. | 54 // YES upon |mouseDown:|. |
| 57 BOOL dragCouldStart_; | 55 BOOL dragCouldStart_; |
| 58 } | 56 } |
| 59 | 57 |
| 60 - (id)initWithExtension:(Extension*)extension | 58 - (id)initWithFrame:(NSRect)frame |
| 61 profile:(Profile*)profile | 59 extension:(Extension*)extension |
| 62 tabId:(int)tabId; | 60 profile:(Profile*)profile |
| 61 tabId:(int)tabId; |
| 63 | 62 |
| 64 - (void)setFrame:(NSRect)frameRect animate:(BOOL)animate; | 63 - (void)setFrame:(NSRect)frameRect animate:(BOOL)animate; |
| 65 | 64 |
| 66 - (void)setDefaultIcon:(NSImage*)image; | 65 - (void)setDefaultIcon:(NSImage*)image; |
| 67 | 66 |
| 68 - (void)setTabSpecificIcon:(NSImage*)image; | 67 - (void)setTabSpecificIcon:(NSImage*)image; |
| 69 | 68 |
| 70 - (void)updateState; | 69 - (void)updateState; |
| 71 | 70 |
| 72 - (BOOL)isAnimating; | 71 - (BOOL)isAnimating; |
| (...skipping 16 matching lines...) Expand all Loading... |
| 89 // The action we're drawing the cell for. Weak. | 88 // The action we're drawing the cell for. Weak. |
| 90 ExtensionAction* extensionAction_; | 89 ExtensionAction* extensionAction_; |
| 91 } | 90 } |
| 92 | 91 |
| 93 @property(readwrite, nonatomic) int tabId; | 92 @property(readwrite, nonatomic) int tabId; |
| 94 @property(readwrite, nonatomic) ExtensionAction* extensionAction; | 93 @property(readwrite, nonatomic) ExtensionAction* extensionAction; |
| 95 | 94 |
| 96 @end | 95 @end |
| 97 | 96 |
| 98 #endif // CHROME_BROWSER_COCOA_EXTENSIONS_BROWSER_ACTION_BUTTON_H_ | 97 #endif // CHROME_BROWSER_COCOA_EXTENSIONS_BROWSER_ACTION_BUTTON_H_ |
| OLD | NEW |