blob: c6b2e2474cfc2bde3ed1fe134f63d46487173fb5 (
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
66
67
68
69
70
71
72
73
74
|
// 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_EXTENSIONS_EXTENSION_BROWSER_ACTIONS_API_H_
#define CHROME_BROWSER_EXTENSIONS_EXTENSION_BROWSER_ACTIONS_API_H_
#pragma once
#include "chrome/browser/extensions/extension_function.h"
#include "chrome/common/extensions/extension_action.h"
class DictionaryValue;
class ExtensionAction;
// Base class for chrome.browserAction.* APIs.
class BrowserActionFunction : public SyncExtensionFunction {
protected:
BrowserActionFunction()
: details_(NULL),
tab_id_(ExtensionAction::kDefaultTabId),
browser_action_(NULL) {}
virtual ~BrowserActionFunction() {}
virtual bool RunImpl();
virtual bool RunBrowserAction() = 0;
// All the browser action APIs take a single argument called details that is
// a dictionary.
DictionaryValue* details_;
// The tab id the browser action function should apply to, if any, or
// kDefaultTabId if none was specified.
int tab_id_;
// The browser action for the current extension.
ExtensionAction* browser_action_;
};
// Implement chrome.browserAction.setIcon().
class BrowserActionSetIconFunction : public BrowserActionFunction {
~BrowserActionSetIconFunction() {}
virtual bool RunBrowserAction();
DECLARE_EXTENSION_FUNCTION_NAME("browserAction.setIcon")
};
// Implement chrome.browserAction.setTitle().
class BrowserActionSetTitleFunction : public BrowserActionFunction {
~BrowserActionSetTitleFunction() {}
virtual bool RunBrowserAction();
DECLARE_EXTENSION_FUNCTION_NAME("browserAction.setTitle")
};
// Implement chrome.browserActions.setPopup().
class BrowserActionSetPopupFunction : public BrowserActionFunction {
~BrowserActionSetPopupFunction() {}
virtual bool RunBrowserAction();
DECLARE_EXTENSION_FUNCTION_NAME("browserAction.setPopup")
};
// Implement chrome.browserAction.setBadgeText().
class BrowserActionSetBadgeTextFunction : public BrowserActionFunction {
~BrowserActionSetBadgeTextFunction() {}
virtual bool RunBrowserAction();
DECLARE_EXTENSION_FUNCTION_NAME("browserAction.setBadgeText")
};
// Implement chrome.browserAction.setBadgeBackgroundColor().
class BrowserActionSetBadgeBackgroundColorFunction
: public BrowserActionFunction {
~BrowserActionSetBadgeBackgroundColorFunction() {}
virtual bool RunBrowserAction();
DECLARE_EXTENSION_FUNCTION_NAME("browserAction.setBadgeBackgroundColor")
};
#endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_BROWSER_ACTIONS_API_H_
|