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