OLD | NEW |
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 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 | 7 |
8 #include "chrome/browser/extensions/extension_function.h" | 8 #include "chrome/browser/extensions/extension_function.h" |
9 #include "chrome/common/extensions/extension_action2.h" | 9 #include "chrome/common/extensions/extension_action.h" |
10 | 10 |
11 class ExtensionAction; | 11 class ExtensionAction; |
12 class ExtensionActionState; | 12 class ExtensionActionState; |
13 | 13 |
14 class BrowserActionFunction : public SyncExtensionFunction { | 14 class BrowserActionFunction : public SyncExtensionFunction { |
15 protected: | 15 protected: |
16 BrowserActionFunction() : tab_id_(ExtensionAction2::kDefaultTabId) {} | 16 BrowserActionFunction() : tab_id_(ExtensionAction::kDefaultTabId) {} |
17 virtual bool RunImpl(); | 17 virtual bool RunImpl(); |
18 virtual bool RunBrowserAction() = 0; | 18 virtual bool RunBrowserAction() = 0; |
19 | 19 |
20 // All the browser action APIs take a single argument called details that is | 20 // All the browser action APIs take a single argument called details that is |
21 // a dictionary. | 21 // a dictionary. |
22 DictionaryValue* details_; | 22 DictionaryValue* details_; |
23 | 23 |
24 // The tab id the browser action function should apply to, if any, or | 24 // The tab id the browser action function should apply to, if any, or |
25 // kDefaultTabId if none was specified. | 25 // kDefaultTabId if none was specified. |
26 int tab_id_; | 26 int tab_id_; |
27 | 27 |
28 // The browser action for the current extension. | 28 // The browser action for the current extension. |
29 ExtensionAction2* browser_action_; | 29 ExtensionAction* browser_action_; |
30 }; | 30 }; |
31 | 31 |
32 class BrowserActionSetIconFunction : public BrowserActionFunction { | 32 class BrowserActionSetIconFunction : public BrowserActionFunction { |
33 virtual bool RunBrowserAction(); | 33 virtual bool RunBrowserAction(); |
34 DECLARE_EXTENSION_FUNCTION_NAME("browserAction.setIcon") | 34 DECLARE_EXTENSION_FUNCTION_NAME("browserAction.setIcon") |
35 }; | 35 }; |
36 | 36 |
37 class BrowserActionSetTitleFunction : public BrowserActionFunction { | 37 class BrowserActionSetTitleFunction : public BrowserActionFunction { |
38 virtual bool RunBrowserAction(); | 38 virtual bool RunBrowserAction(); |
39 DECLARE_EXTENSION_FUNCTION_NAME("browserAction.setTitle") | 39 DECLARE_EXTENSION_FUNCTION_NAME("browserAction.setTitle") |
40 }; | 40 }; |
41 | 41 |
42 class BrowserActionSetBadgeTextFunction : public BrowserActionFunction { | 42 class BrowserActionSetBadgeTextFunction : public BrowserActionFunction { |
43 virtual bool RunBrowserAction(); | 43 virtual bool RunBrowserAction(); |
44 DECLARE_EXTENSION_FUNCTION_NAME("browserAction.setBadgeText") | 44 DECLARE_EXTENSION_FUNCTION_NAME("browserAction.setBadgeText") |
45 }; | 45 }; |
46 | 46 |
47 class BrowserActionSetBadgeBackgroundColorFunction | 47 class BrowserActionSetBadgeBackgroundColorFunction |
48 : public BrowserActionFunction { | 48 : public BrowserActionFunction { |
49 virtual bool RunBrowserAction(); | 49 virtual bool RunBrowserAction(); |
50 DECLARE_EXTENSION_FUNCTION_NAME("browserAction.setBadgeBackgroundColor") | 50 DECLARE_EXTENSION_FUNCTION_NAME("browserAction.setBadgeBackgroundColor") |
51 }; | 51 }; |
52 | 52 |
53 #endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_BROWSER_ACTIONS_API_H_ | 53 #endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_BROWSER_ACTIONS_API_H_ |
OLD | NEW |