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_EXTENSIONS_EXTENSION_BROWSER_ACTIONS_API_H_ | 5 #ifndef CHROME_BROWSER_EXTENSIONS_EXTENSION_BROWSER_ACTIONS_API_H_ |
6 #define CHROME_BROWSER_EXTENSIONS_EXTENSION_BROWSER_ACTIONS_API_H_ | 6 #define CHROME_BROWSER_EXTENSIONS_EXTENSION_BROWSER_ACTIONS_API_H_ |
7 #pragma once | 7 #pragma once |
8 | 8 |
9 #include "chrome/browser/extensions/extension_function.h" | 9 #include "chrome/browser/extensions/extension_function.h" |
10 #include "chrome/common/extensions/extension_action.h" | 10 #include "chrome/common/extensions/extension_action.h" |
11 | 11 |
| 12 class ExtensionAction; |
| 13 |
| 14 namespace base { |
12 class DictionaryValue; | 15 class DictionaryValue; |
13 class ExtensionAction; | 16 } |
14 | 17 |
15 // Base class for chrome.browserAction.* APIs. | 18 // Base class for chrome.browserAction.* APIs. |
16 class BrowserActionFunction : public SyncExtensionFunction { | 19 class BrowserActionFunction : public SyncExtensionFunction { |
17 protected: | 20 protected: |
18 BrowserActionFunction() | 21 BrowserActionFunction() |
19 : details_(NULL), | 22 : details_(NULL), |
20 tab_id_(ExtensionAction::kDefaultTabId), | 23 tab_id_(ExtensionAction::kDefaultTabId), |
21 browser_action_(NULL) {} | 24 browser_action_(NULL) {} |
22 virtual ~BrowserActionFunction() {} | 25 virtual ~BrowserActionFunction() {} |
23 virtual bool RunImpl(); | 26 virtual bool RunImpl(); |
24 virtual bool RunBrowserAction() = 0; | 27 virtual bool RunBrowserAction() = 0; |
25 | 28 |
26 // All the browser action APIs take a single argument called details that is | 29 // All the browser action APIs take a single argument called details that is |
27 // a dictionary. | 30 // a dictionary. |
28 DictionaryValue* details_; | 31 base::DictionaryValue* details_; |
29 | 32 |
30 // The tab id the browser action function should apply to, if any, or | 33 // The tab id the browser action function should apply to, if any, or |
31 // kDefaultTabId if none was specified. | 34 // kDefaultTabId if none was specified. |
32 int tab_id_; | 35 int tab_id_; |
33 | 36 |
34 // The browser action for the current extension. | 37 // The browser action for the current extension. |
35 ExtensionAction* browser_action_; | 38 ExtensionAction* browser_action_; |
36 }; | 39 }; |
37 | 40 |
38 // Implement chrome.browserAction.setIcon(). | 41 // Implement chrome.browserAction.setIcon(). |
(...skipping 26 matching lines...) Expand all Loading... |
65 | 68 |
66 // Implement chrome.browserAction.setBadgeBackgroundColor(). | 69 // Implement chrome.browserAction.setBadgeBackgroundColor(). |
67 class BrowserActionSetBadgeBackgroundColorFunction | 70 class BrowserActionSetBadgeBackgroundColorFunction |
68 : public BrowserActionFunction { | 71 : public BrowserActionFunction { |
69 virtual ~BrowserActionSetBadgeBackgroundColorFunction() {} | 72 virtual ~BrowserActionSetBadgeBackgroundColorFunction() {} |
70 virtual bool RunBrowserAction(); | 73 virtual bool RunBrowserAction(); |
71 DECLARE_EXTENSION_FUNCTION_NAME("browserAction.setBadgeBackgroundColor") | 74 DECLARE_EXTENSION_FUNCTION_NAME("browserAction.setBadgeBackgroundColor") |
72 }; | 75 }; |
73 | 76 |
74 #endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_BROWSER_ACTIONS_API_H_ | 77 #endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_BROWSER_ACTIONS_API_H_ |
OLD | NEW |