| 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 218 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 229 // Set this action's badge visibility on a specific tab. This takes | 229 // Set this action's badge visibility on a specific tab. This takes |
| 230 // care of any appropriate transition animations. Returns true if | 230 // care of any appropriate transition animations. Returns true if |
| 231 // the appearance has changed. | 231 // the appearance has changed. |
| 232 bool SetAppearance(int tab_id, Appearance value); | 232 bool SetAppearance(int tab_id, Appearance value); |
| 233 // Get the badge visibility for a tab, or the default badge visibility | 233 // Get the badge visibility for a tab, or the default badge visibility |
| 234 // if none was set. | 234 // if none was set. |
| 235 bool GetIsVisible(int tab_id) const { | 235 bool GetIsVisible(int tab_id) const { |
| 236 return GetValue(&appearance_, tab_id) != INVISIBLE; | 236 return GetValue(&appearance_, tab_id) != INVISIBLE; |
| 237 } | 237 } |
| 238 | 238 |
| 239 // True if the tab's action wants the user's attention. |
| 240 bool WantsAttention(int tab_id) const { |
| 241 return GetValue(&appearance_, tab_id) == WANTS_ATTENTION; |
| 242 } |
| 243 |
| 239 // Remove all tab-specific state. | 244 // Remove all tab-specific state. |
| 240 void ClearAllValuesForTab(int tab_id); | 245 void ClearAllValuesForTab(int tab_id); |
| 241 | 246 |
| 242 // If the specified tab has a badge, paint it into the provided bounds. | 247 // If the specified tab has a badge, paint it into the provided bounds. |
| 243 void PaintBadge(gfx::Canvas* canvas, const gfx::Rect& bounds, int tab_id); | 248 void PaintBadge(gfx::Canvas* canvas, const gfx::Rect& bounds, int tab_id); |
| 244 | 249 |
| 245 // Returns icon image with badge for specified tab. | 250 // Returns icon image with badge for specified tab. |
| 246 gfx::ImageSkia GetIconWithBadge(const gfx::ImageSkia& icon, | 251 gfx::ImageSkia GetIconWithBadge(const gfx::ImageSkia& icon, |
| 247 int tab_id, | 252 int tab_id, |
| 248 const gfx::Size& spacing) const; | 253 const gfx::Size& spacing) const; |
| (...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 345 }; | 350 }; |
| 346 | 351 |
| 347 template<> | 352 template<> |
| 348 struct ExtensionAction::ValueTraits<int> { | 353 struct ExtensionAction::ValueTraits<int> { |
| 349 static int CreateEmpty() { | 354 static int CreateEmpty() { |
| 350 return -1; | 355 return -1; |
| 351 } | 356 } |
| 352 }; | 357 }; |
| 353 | 358 |
| 354 #endif // CHROME_COMMON_EXTENSIONS_EXTENSION_ACTION_H_ | 359 #endif // CHROME_COMMON_EXTENSIONS_EXTENSION_ACTION_H_ |
| OLD | NEW |