1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 #ifndef CHROME_COMMON_EXTENSIONS_API_EXTENSION_ACTION_ACTION_INFO_H_
6 #define CHROME_COMMON_EXTENSIONS_API_EXTENSION_ACTION_ACTION_INFO_H_
10 #include "base/strings/string16.h"
11 #include "chrome/common/extensions/extension_icon_set.h"
12 #include "extensions/common/extension.h"
16 class DictionaryValue
;
19 namespace extensions
{
27 // The types of extension actions.
32 TYPE_SYSTEM_INDICATOR
,
35 // Loads an ActionInfo from the given DictionaryValue.
36 static scoped_ptr
<ActionInfo
> Load(const Extension
* extension
,
37 const base::DictionaryValue
* dict
,
38 base::string16
* error
);
40 // Returns the extension's browser action, if any.
41 static const ActionInfo
* GetBrowserActionInfo(const Extension
* extension
);
43 // Returns the extension's page action, if any.
44 static const ActionInfo
* GetPageActionInfo(const Extension
* extension
);
46 // Returns the extension's script badge.
47 static const ActionInfo
* GetScriptBadgeInfo(const Extension
* etxension
);
49 // Returns the extension's system indicator, if any.
50 static const ActionInfo
* GetSystemIndicatorInfo(const Extension
* extension
);
52 // Sets the extension's browser action. |extension| takes ownership of |info|.
53 static void SetBrowserActionInfo(Extension
* extension
, ActionInfo
* info
);
55 // Sets the extension's page action. |extension| takes ownership of |info|.
56 static void SetPageActionInfo(Extension
* extension
, ActionInfo
* info
);
58 // Sets the extension's script badge. |extension| takes ownership of |info|.
59 static void SetScriptBadgeInfo(Extension
* extension
, ActionInfo
* info
);
61 // Sets the extension's system indicator. |extension| takes ownership of
63 static void SetSystemIndicatorInfo(Extension
* extension
, ActionInfo
* info
);
65 // Returns true if the extension needs a verbose install message because
66 // of its page action.
67 static bool IsVerboseInstallMessage(const Extension
* extension
);
69 // Empty implies the key wasn't present.
70 ExtensionIconSet default_icon
;
71 std::string default_title
;
72 GURL default_popup_url
;
73 // action id -- only used with legacy page actions API.
77 } // namespace extensions
79 #endif // CHROME_COMMON_EXTENSIONS_API_EXTENSION_ACTION_ACTION_INFO_H_