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 <memory> |
8 #include <string> | 9 #include <string> |
9 | 10 |
10 #include "base/strings/string16.h" | 11 #include "base/strings/string16.h" |
11 #include "extensions/common/extension.h" | 12 #include "extensions/common/extension.h" |
12 #include "extensions/common/extension_icon_set.h" | 13 #include "extensions/common/extension_icon_set.h" |
13 #include "url/gurl.h" | 14 #include "url/gurl.h" |
14 | 15 |
15 namespace base { | 16 namespace base { |
16 class DictionaryValue; | 17 class DictionaryValue; |
17 } | 18 } |
18 | 19 |
19 namespace extensions { | 20 namespace extensions { |
20 | 21 |
21 class Extension; | 22 class Extension; |
22 | 23 |
23 struct ActionInfo { | 24 struct ActionInfo { |
24 ActionInfo(); | 25 ActionInfo(); |
25 ActionInfo(const ActionInfo& other); | 26 ActionInfo(const ActionInfo& other); |
26 ~ActionInfo(); | 27 ~ActionInfo(); |
27 | 28 |
28 // The types of extension actions. | 29 // The types of extension actions. |
29 enum Type { | 30 enum Type { |
30 TYPE_BROWSER, | 31 TYPE_BROWSER, |
31 TYPE_PAGE, | 32 TYPE_PAGE, |
32 TYPE_SYSTEM_INDICATOR, | 33 TYPE_SYSTEM_INDICATOR, |
33 }; | 34 }; |
34 | 35 |
35 // Loads an ActionInfo from the given DictionaryValue. | 36 // Loads an ActionInfo from the given DictionaryValue. |
36 static scoped_ptr<ActionInfo> Load(const Extension* extension, | 37 static std::unique_ptr<ActionInfo> Load(const Extension* extension, |
37 const base::DictionaryValue* dict, | 38 const base::DictionaryValue* dict, |
38 base::string16* error); | 39 base::string16* error); |
39 | 40 |
40 // Returns the extension's browser action, if any. | 41 // Returns the extension's browser action, if any. |
41 static const ActionInfo* GetBrowserActionInfo(const Extension* extension); | 42 static const ActionInfo* GetBrowserActionInfo(const Extension* extension); |
42 | 43 |
43 // Returns the extension's page action, if any. | 44 // Returns the extension's page action, if any. |
44 static const ActionInfo* GetPageActionInfo(const Extension* extension); | 45 static const ActionInfo* GetPageActionInfo(const Extension* extension); |
45 | 46 |
46 // Returns the extension's system indicator, if any. | 47 // Returns the extension's system indicator, if any. |
47 static const ActionInfo* GetSystemIndicatorInfo(const Extension* extension); | 48 static const ActionInfo* GetSystemIndicatorInfo(const Extension* extension); |
48 | 49 |
(...skipping 17 matching lines...) Expand all Loading... |
66 GURL default_popup_url; | 67 GURL default_popup_url; |
67 // action id -- only used with legacy page actions API. | 68 // action id -- only used with legacy page actions API. |
68 std::string id; | 69 std::string id; |
69 // Whether or not this action was synthesized to force visibility. | 70 // Whether or not this action was synthesized to force visibility. |
70 bool synthesized; | 71 bool synthesized; |
71 }; | 72 }; |
72 | 73 |
73 } // namespace extensions | 74 } // namespace extensions |
74 | 75 |
75 #endif // CHROME_COMMON_EXTENSIONS_API_EXTENSION_ACTION_ACTION_INFO_H_ | 76 #endif // CHROME_COMMON_EXTENSIONS_API_EXTENSION_ACTION_ACTION_INFO_H_ |
OLD | NEW |