| 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 | 7 |
| 8 #include <map> | 8 #include <map> |
| 9 #include <string> | 9 #include <string> |
| 10 #include <vector> | 10 #include <vector> |
| (...skipping 210 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 221 // Set this action's badge visibility on a specific tab. This takes | 221 // Set this action's badge visibility on a specific tab. This takes |
| 222 // care of any appropriate transition animations. Returns true if | 222 // care of any appropriate transition animations. Returns true if |
| 223 // the appearance has changed. | 223 // the appearance has changed. |
| 224 bool SetAppearance(int tab_id, Appearance value); | 224 bool SetAppearance(int tab_id, Appearance value); |
| 225 // Get the badge visibility for a tab, or the default badge visibility | 225 // Get the badge visibility for a tab, or the default badge visibility |
| 226 // if none was set. | 226 // if none was set. |
| 227 bool GetIsVisible(int tab_id) const { | 227 bool GetIsVisible(int tab_id) const { |
| 228 return GetValue(&appearance_, tab_id) != INVISIBLE; | 228 return GetValue(&appearance_, tab_id) != INVISIBLE; |
| 229 } | 229 } |
| 230 | 230 |
| 231 // True if the tab's action wants the user's attention. |
| 232 bool WantsAttention(int tab_id) const { |
| 233 return GetValue(&appearance_, tab_id) == WANTS_ATTENTION; |
| 234 } |
| 235 |
| 231 // Remove all tab-specific state. | 236 // Remove all tab-specific state. |
| 232 void ClearAllValuesForTab(int tab_id); | 237 void ClearAllValuesForTab(int tab_id); |
| 233 | 238 |
| 234 // If the specified tab has a badge, paint it into the provided bounds. | 239 // If the specified tab has a badge, paint it into the provided bounds. |
| 235 void PaintBadge(gfx::Canvas* canvas, const gfx::Rect& bounds, int tab_id); | 240 void PaintBadge(gfx::Canvas* canvas, const gfx::Rect& bounds, int tab_id); |
| 236 | 241 |
| 237 // Returns icon image with badge for specified tab. | 242 // Returns icon image with badge for specified tab. |
| 238 gfx::ImageSkia GetIconWithBadge(const gfx::ImageSkia& icon, | 243 gfx::ImageSkia GetIconWithBadge(const gfx::ImageSkia& icon, |
| 239 int tab_id, | 244 int tab_id, |
| 240 const gfx::Size& spacing) const; | 245 const gfx::Size& spacing) const; |
| (...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 329 }; | 334 }; |
| 330 | 335 |
| 331 template<> | 336 template<> |
| 332 struct ExtensionAction::ValueTraits<int> { | 337 struct ExtensionAction::ValueTraits<int> { |
| 333 static int CreateEmpty() { | 338 static int CreateEmpty() { |
| 334 return -1; | 339 return -1; |
| 335 } | 340 } |
| 336 }; | 341 }; |
| 337 | 342 |
| 338 #endif // CHROME_COMMON_EXTENSIONS_EXTENSION_ACTION_H_ | 343 #endif // CHROME_COMMON_EXTENSIONS_EXTENSION_ACTION_H_ |
| OLD | NEW |