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