| OLD | NEW |
| 1 // Copyright (c) 2010 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 CanvasSkia; |
| 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 or page action. |
| 25 // Instances can have both global and per-tab state. If a property does not have | 25 // 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. | 26 // a per-tab value, the global value is used instead. |
| 27 class ExtensionAction { | 27 class ExtensionAction { |
| (...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 133 // Get the badge visibility for a tab, or the default badge visibility | 133 // Get the badge visibility for a tab, or the default badge visibility |
| 134 // if none was set. | 134 // if none was set. |
| 135 bool GetIsVisible(int tab_id) { | 135 bool GetIsVisible(int tab_id) { |
| 136 return GetValue(&visible_, tab_id); | 136 return GetValue(&visible_, tab_id); |
| 137 } | 137 } |
| 138 | 138 |
| 139 // Remove all tab-specific state. | 139 // Remove all tab-specific state. |
| 140 void ClearAllValuesForTab(int tab_id); | 140 void ClearAllValuesForTab(int tab_id); |
| 141 | 141 |
| 142 // If the specified tab has a badge, paint it into the provided bounds. | 142 // If the specified tab has a badge, paint it into the provided bounds. |
| 143 void PaintBadge(gfx::Canvas* canvas, const gfx::Rect& bounds, int tab_id); | 143 void PaintBadge(gfx::CanvasSkia* canvas, const gfx::Rect& bounds, int tab_id); |
| 144 | 144 |
| 145 private: | 145 private: |
| 146 template <class T> | 146 template <class T> |
| 147 struct ValueTraits { | 147 struct ValueTraits { |
| 148 static T CreateEmpty() { | 148 static T CreateEmpty() { |
| 149 return T(); | 149 return T(); |
| 150 } | 150 } |
| 151 }; | 151 }; |
| 152 | 152 |
| 153 template<class T> | 153 template<class T> |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 193 }; | 193 }; |
| 194 | 194 |
| 195 template<> | 195 template<> |
| 196 struct ExtensionAction::ValueTraits<int> { | 196 struct ExtensionAction::ValueTraits<int> { |
| 197 static int CreateEmpty() { | 197 static int CreateEmpty() { |
| 198 return -1; | 198 return -1; |
| 199 } | 199 } |
| 200 }; | 200 }; |
| 201 | 201 |
| 202 #endif // CHROME_COMMON_EXTENSIONS_EXTENSION_ACTION_H_ | 202 #endif // CHROME_COMMON_EXTENSIONS_EXTENSION_ACTION_H_ |
| OLD | NEW |