OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 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 | 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_COMMON_EXTENSIONS_API_EXTENSION_ACTION_ACTION_INFO_H_ | 5 #ifndef CHROME_COMMON_EXTENSIONS_API_EXTENSION_ACTION_ACTION_INFO_H_ |
6 #define CHROME_COMMON_EXTENSIONS_API_EXTENSION_ACTION_ACTION_INFO_H_ | 6 #define CHROME_COMMON_EXTENSIONS_API_EXTENSION_ACTION_ACTION_INFO_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #include "chrome/common/extensions/extension_icon_set.h" | 10 #include "chrome/common/extensions/extension_icon_set.h" |
11 #include "googleurl/src/gurl.h" | 11 #include "googleurl/src/gurl.h" |
12 | 12 |
13 namespace extensions { | 13 namespace extensions { |
14 | 14 |
15 class Extension; | 15 class Extension; |
16 | 16 |
17 struct ActionInfo { | 17 struct ActionInfo { |
18 ActionInfo(); | 18 ActionInfo(); |
19 ~ActionInfo(); | 19 ~ActionInfo(); |
20 | 20 |
21 // The types of extension actions. | 21 // The types of extension actions. |
22 enum Type { | 22 enum Type { |
23 TYPE_BROWSER, | 23 TYPE_BROWSER, |
24 TYPE_PAGE, | 24 TYPE_PAGE, |
25 TYPE_SCRIPT_BADGE, | 25 TYPE_SCRIPT_BADGE, |
26 TYPE_SYSTEM_INDICATOR, | 26 TYPE_SYSTEM_INDICATOR, |
27 }; | 27 }; |
28 | 28 |
29 // Returns the appropriate ActionInfo for the given |extension|. | 29 // Returns the extension's page action, if any. |
| 30 static const ActionInfo* GetPageActionInfo(const Extension* extension); |
| 31 |
| 32 // Returns the extension's script badge. |
30 static const ActionInfo* GetScriptBadgeInfo(const Extension* extension); | 33 static const ActionInfo* GetScriptBadgeInfo(const Extension* extension); |
31 | 34 |
32 // Sets the appropriate ActionInfo as ManifestData for the given |extension|. | 35 // Sets the extension's page action. |extension| takes ownership of |info|. |
33 // This is static since |extension| takes ownership of |info|. | 36 static void SetPageActionInfo(Extension* extension, ActionInfo* info); |
| 37 |
| 38 // Sets the extension's script badge. |extension| takes ownership of |info|. |
34 static void SetScriptBadgeInfo(Extension* extension, ActionInfo* info); | 39 static void SetScriptBadgeInfo(Extension* extension, ActionInfo* info); |
35 | 40 |
| 41 // Returns true if the extension needs a verbose install message because |
| 42 // of its page action. |
| 43 static bool IsVerboseInstallMessage(const Extension* extension); |
| 44 |
36 // Empty implies the key wasn't present. | 45 // Empty implies the key wasn't present. |
37 ExtensionIconSet default_icon; | 46 ExtensionIconSet default_icon; |
38 std::string default_title; | 47 std::string default_title; |
39 GURL default_popup_url; | 48 GURL default_popup_url; |
40 // action id -- only used with legacy page actions API. | 49 // action id -- only used with legacy page actions API. |
41 std::string id; | 50 std::string id; |
42 }; | 51 }; |
43 | 52 |
44 } // namespace extensions | 53 } // namespace extensions |
45 | 54 |
46 #endif // CHROME_COMMON_EXTENSIONS_API_EXTENSION_ACTION_ACTION_INFO_H_ | 55 #endif // CHROME_COMMON_EXTENSIONS_API_EXTENSION_ACTION_ACTION_INFO_H_ |
OLD | NEW |