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 #include "chrome/common/extensions/extension_action.h" | 5 #include "chrome/common/extensions/extension_action.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 | 8 |
9 #include "base/logging.h" | 9 #include "base/logging.h" |
10 #include "chrome/common/badge_util.h" | 10 #include "chrome/common/badge_util.h" |
(...skipping 205 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
216 GURL ExtensionAction::GetPopupUrl(int tab_id) const { | 216 GURL ExtensionAction::GetPopupUrl(int tab_id) const { |
217 return GetValue(&popup_url_, tab_id); | 217 return GetValue(&popup_url_, tab_id); |
218 } | 218 } |
219 | 219 |
220 void ExtensionAction::CacheIcon(const std::string& path, | 220 void ExtensionAction::CacheIcon(const std::string& path, |
221 const gfx::Image& icon) { | 221 const gfx::Image& icon) { |
222 if (!icon.IsEmpty()) | 222 if (!icon.IsEmpty()) |
223 path_to_icon_cache_.insert(std::make_pair(path, icon)); | 223 path_to_icon_cache_.insert(std::make_pair(path, icon)); |
224 } | 224 } |
225 | 225 |
226 void ExtensionAction::SetIcon(int tab_id, const SkBitmap& bitmap) { | 226 void ExtensionAction::SetIcon(int tab_id, const gfx::Image& image) { |
227 SetValue(&icon_, tab_id, gfx::Image(bitmap)); | 227 SetValue(&icon_, tab_id, image); |
228 } | 228 } |
229 | 229 |
230 gfx::Image ExtensionAction::GetIcon(int tab_id) const { | 230 gfx::Image ExtensionAction::GetIcon(int tab_id) const { |
231 // Check if a specific icon is set for this tab. | 231 // Check if a specific icon is set for this tab. |
232 gfx::Image icon = GetValue(&icon_, tab_id); | 232 gfx::Image icon = GetValue(&icon_, tab_id); |
233 if (icon.IsEmpty()) { | 233 if (icon.IsEmpty()) { |
234 // Need to find an icon from a path. | 234 // Need to find an icon from a path. |
235 const std::string* path = NULL; | 235 const std::string* path = NULL; |
236 // Check if one of the elements of icon_path() was selected. | 236 // Check if one of the elements of icon_path() was selected. |
237 int icon_index = GetIconIndex(tab_id); | 237 int icon_index = GetIconIndex(tab_id); |
(...skipping 185 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
423 return orig; | 423 return orig; |
424 return gfx::Image(wrapper->animation()->Apply(*orig.ToSkBitmap())); | 424 return gfx::Image(wrapper->animation()->Apply(*orig.ToSkBitmap())); |
425 } | 425 } |
426 | 426 |
427 void ExtensionAction::RunIconAnimation(int tab_id) { | 427 void ExtensionAction::RunIconAnimation(int tab_id) { |
428 IconAnimationWrapper* icon_animation = | 428 IconAnimationWrapper* icon_animation = |
429 new IconAnimationWrapper(); | 429 new IconAnimationWrapper(); |
430 icon_animation_[tab_id] = icon_animation->AsWeakPtr(); | 430 icon_animation_[tab_id] = icon_animation->AsWeakPtr(); |
431 icon_animation->animation()->Start(); | 431 icon_animation->animation()->Start(); |
432 } | 432 } |
OLD | NEW |