Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(110)

Side by Side Diff: chrome/browser/extensions/extension_browser_actions_api.h

Issue 306044: Refactor implementation of BrowserActions, and add support for (Closed)
Patch Set: Make it work on linux too Created 11 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 10
10 class BrowserActionSetIconFunction : public SyncExtensionFunction { 11 class ExtensionAction;
12 class ExtensionActionState;
13
14 class BrowserActionFunction : public SyncExtensionFunction {
15 protected:
16 BrowserActionFunction() : tab_id_(ExtensionAction2::kDefaultTabId) {}
11 virtual bool RunImpl(); 17 virtual bool RunImpl();
18 virtual bool RunBrowserAction() = 0;
19
20 // All the browser action APIs take a single argument called details that is
21 // a dictionary.
22 DictionaryValue* details_;
23
24 // The tab id the browser action function should apply to, if any, or
25 // kDefaultTabId if none was specified.
26 int tab_id_;
27
28 // The browser action for the current extension.
29 ExtensionAction2* browser_action_;
30 };
31
32 class BrowserActionSetIconFunction : public BrowserActionFunction {
33 virtual bool RunBrowserAction();
12 DECLARE_EXTENSION_FUNCTION_NAME("browserAction.setIcon") 34 DECLARE_EXTENSION_FUNCTION_NAME("browserAction.setIcon")
13 }; 35 };
14 36
15 class BrowserActionSetTitleFunction : public SyncExtensionFunction { 37 class BrowserActionSetTitleFunction : public BrowserActionFunction {
16 virtual bool RunImpl(); 38 virtual bool RunBrowserAction();
17 DECLARE_EXTENSION_FUNCTION_NAME("browserAction.setTitle") 39 DECLARE_EXTENSION_FUNCTION_NAME("browserAction.setTitle")
18 }; 40 };
19 41
20 class BrowserActionSetBadgeTextFunction : public SyncExtensionFunction { 42 class BrowserActionSetBadgeTextFunction : public BrowserActionFunction {
21 virtual bool RunImpl(); 43 virtual bool RunBrowserAction();
22 DECLARE_EXTENSION_FUNCTION_NAME("browserAction.setBadgeText") 44 DECLARE_EXTENSION_FUNCTION_NAME("browserAction.setBadgeText")
23 }; 45 };
24 46
25 class BrowserActionSetBadgeBackgroundColorFunction 47 class BrowserActionSetBadgeBackgroundColorFunction
26 : public SyncExtensionFunction { 48 : public BrowserActionFunction {
27 virtual bool RunImpl(); 49 virtual bool RunBrowserAction();
28 DECLARE_EXTENSION_FUNCTION_NAME("browserAction.setBadgeBackgroundColor") 50 DECLARE_EXTENSION_FUNCTION_NAME("browserAction.setBadgeBackgroundColor")
29 }; 51 };
30 52
31 #endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_BROWSER_ACTIONS_API_H_ 53 #endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_BROWSER_ACTIONS_API_H_
OLDNEW
« no previous file with comments | « chrome/browser/extensions/browser_action_apitest.cc ('k') | chrome/browser/extensions/extension_browser_actions_api.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698