| 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_EXTENSION_ACTION_H_ | 5 #ifndef CHROME_COMMON_EXTENSIONS_EXTENSION_ACTION_H_ |
| 6 #define CHROME_COMMON_EXTENSIONS_EXTENSION_ACTION_H_ | 6 #define CHROME_COMMON_EXTENSIONS_EXTENSION_ACTION_H_ |
| 7 #pragma once | 7 #pragma once |
| 8 | 8 |
| 9 #include <map> | 9 #include <map> |
| 10 #include <string> | 10 #include <string> |
| 11 #include <vector> | 11 #include <vector> |
| 12 | 12 |
| 13 #include "base/basictypes.h" | 13 #include "base/basictypes.h" |
| 14 #include "third_party/skia/include/core/SkColor.h" | 14 #include "third_party/skia/include/core/SkColor.h" |
| 15 | 15 |
| 16 namespace gfx { | 16 namespace gfx { |
| 17 class Canvas; | 17 class Canvas; |
| 18 class Rect; | 18 class Rect; |
| 19 } | 19 } |
| 20 | 20 |
| 21 class GURL; | 21 class GURL; |
| 22 class SkBitmap; | 22 class SkBitmap; |
| 23 | 23 |
| 24 // ExtensionAction encapsulates the state of a browser or page action. | 24 // ExtensionAction encapsulates the state of a browser action, page action, or |
| 25 // script badge. |
| 25 // Instances can have both global and per-tab state. If a property does not have | 26 // Instances can have both global and per-tab state. If a property does not have |
| 26 // a per-tab value, the global value is used instead. | 27 // a per-tab value, the global value is used instead. |
| 27 class ExtensionAction { | 28 class ExtensionAction { |
| 28 public: | 29 public: |
| 29 // Use this ID to indicate the default state for properties that take a tab_id | 30 // Use this ID to indicate the default state for properties that take a tab_id |
| 30 // parameter. | 31 // parameter. |
| 31 static const int kDefaultTabId; | 32 static const int kDefaultTabId; |
| 32 | 33 |
| 33 // The types of extension actions. | 34 // The types of extension actions. |
| 34 enum Type { | 35 enum Type { |
| 35 TYPE_NONE, | 36 TYPE_NONE, |
| 36 TYPE_BROWSER, | 37 TYPE_BROWSER, |
| 37 TYPE_PAGE, | 38 TYPE_PAGE, |
| 39 TYPE_SCRIPT_BADGE, |
| 38 }; | 40 }; |
| 39 | 41 |
| 40 explicit ExtensionAction(const std::string& extension_id); | 42 explicit ExtensionAction(const std::string& extension_id); |
| 41 ~ExtensionAction(); | 43 ~ExtensionAction(); |
| 42 | 44 |
| 43 // extension id | 45 // extension id |
| 44 const std::string& extension_id() const { return extension_id_; } | 46 const std::string& extension_id() const { return extension_id_; } |
| 45 | 47 |
| 46 // action id -- only used with legacy page actions API | 48 // action id -- only used with legacy page actions API |
| 47 std::string id() const { return id_; } | 49 std::string id() const { return id_; } |
| (...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 197 }; | 199 }; |
| 198 | 200 |
| 199 template<> | 201 template<> |
| 200 struct ExtensionAction::ValueTraits<int> { | 202 struct ExtensionAction::ValueTraits<int> { |
| 201 static int CreateEmpty() { | 203 static int CreateEmpty() { |
| 202 return -1; | 204 return -1; |
| 203 } | 205 } |
| 204 }; | 206 }; |
| 205 | 207 |
| 206 #endif // CHROME_COMMON_EXTENSIONS_EXTENSION_ACTION_H_ | 208 #endif // CHROME_COMMON_EXTENSIONS_EXTENSION_ACTION_H_ |
| OLD | NEW |