summaryrefslogtreecommitdiffstats
path: root/chrome/browser/cocoa/extensions/browser_action_button.h
blob: 8321828768223eaedc658916070c16dcf7a98a63 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
// Copyright (c) 2010 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#ifndef CHROME_BROWSER_COCOA_EXTENSIONS_BROWSER_ACTION_BUTTON_H_
#define CHROME_BROWSER_COCOA_EXTENSIONS_BROWSER_ACTION_BUTTON_H_

#import <Cocoa/Cocoa.h>

#import "base/scoped_nsobject.h"
#include "base/scoped_ptr.h"
#include "chrome/browser/cocoa/toolbar_button_cell.h"

class Extension;
class ExtensionAction;
class ExtensionImageTrackerBridge;
class Profile;

extern const CGFloat kBrowserActionWidth;

@interface BrowserActionButton : NSButton {
 @private
  scoped_ptr<ExtensionImageTrackerBridge> imageLoadingBridge_;

  scoped_nsobject<NSImage> defaultIcon_;

  scoped_nsobject<NSImage> tabSpecificIcon_;

  // The extension for this button. Weak.
  Extension* extension_;

  // The ID of the active tab.
  int tabId_;
}

- (id)initWithExtension:(Extension*)extension
                profile:(Profile*)profile
                  tabId:(int)tabId;

- (void)setDefaultIcon:(NSImage*)image;

- (void)setTabSpecificIcon:(NSImage*)image;

- (void)updateState;

@property(readwrite, nonatomic) int tabId;
@property(readonly, nonatomic) Extension* extension;

@end

@interface BrowserActionCell : ToolbarButtonCell {
 @private
  // The current tab ID used when drawing the cell.
  int tabId_;

  // The action we're drawing the cell for. Weak.
  ExtensionAction* extensionAction_;
}

@property(readwrite, nonatomic) int tabId;
@property(readwrite, nonatomic) ExtensionAction* extensionAction;

@end

#endif  // CHROME_BROWSER_COCOA_EXTENSIONS_BROWSER_ACTION_BUTTON_H_