| 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.h" |
| 10 #include "chrome/common/extensions/extension_icon_set.h" | 11 #include "chrome/common/extensions/extension_icon_set.h" |
| 11 #include "googleurl/src/gurl.h" | 12 #include "googleurl/src/gurl.h" |
| 12 | 13 |
| 13 namespace extensions { | 14 namespace extensions { |
| 14 | 15 |
| 15 class Extension; | 16 class Extension; |
| 16 | 17 |
| 17 struct ActionInfo { | 18 struct ActionInfo { |
| 18 ActionInfo(); | 19 ActionInfo(); |
| 19 ~ActionInfo(); | 20 ~ActionInfo(); |
| 20 | 21 |
| 21 // The types of extension actions. | 22 // The types of extension actions. |
| 22 enum Type { | 23 enum Type { |
| 23 TYPE_BROWSER, | 24 TYPE_BROWSER, |
| 24 TYPE_PAGE, | 25 TYPE_PAGE, |
| 25 TYPE_SCRIPT_BADGE, | 26 TYPE_SCRIPT_BADGE, |
| 26 TYPE_SYSTEM_INDICATOR, | 27 TYPE_SYSTEM_INDICATOR, |
| 27 }; | 28 }; |
| 28 | 29 |
| 29 // Returns the appropriate ActionInfo for the given |extension|. | 30 // Returns the extension's browser action, if any. |
| 30 static const ActionInfo* GetScriptBadgeInfo(const Extension* extension); | 31 static const ActionInfo* GetBrowserActionInfo(const Extension* extension); |
| 31 | 32 |
| 32 // Sets the appropriate ActionInfo as ManifestData for the given |extension|. | 33 // Returns the extension's script badge. |
| 33 // This is static since |extension| takes ownership of |info|. | 34 static const ActionInfo* GetScriptBadgeInfo(const Extension* etxension); |
| 34 static void SetScriptBadgeInfo(Extension* extension, ActionInfo* info); | 35 |
| 36 // Sets the extension's browser action. |extension| takes ownership of |info|. |
| 37 static void SetBrowserActionInfo(Extension* extension, ActionInfo* info); |
| 38 |
| 39 // Sets the extension's script badge. |extension| takes ownership of |info|. |
| 40 static void SetScriptBadgeInfo(Extension* etxension, ActionInfo* info); |
| 35 | 41 |
| 36 // Empty implies the key wasn't present. | 42 // Empty implies the key wasn't present. |
| 37 ExtensionIconSet default_icon; | 43 ExtensionIconSet default_icon; |
| 38 std::string default_title; | 44 std::string default_title; |
| 39 GURL default_popup_url; | 45 GURL default_popup_url; |
| 40 // action id -- only used with legacy page actions API. | 46 // action id -- only used with legacy page actions API. |
| 41 std::string id; | 47 std::string id; |
| 42 }; | 48 }; |
| 43 | 49 |
| 44 } // namespace extensions | 50 } // namespace extensions |
| 45 | 51 |
| 46 #endif // CHROME_COMMON_EXTENSIONS_API_EXTENSION_ACTION_ACTION_INFO_H_ | 52 #endif // CHROME_COMMON_EXTENSIONS_API_EXTENSION_ACTION_ACTION_INFO_H_ |
| OLD | NEW |