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 177 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
188 | 188 |
189 DISALLOW_COPY_AND_ASSIGN(IconWithBadgeImageSource); | 189 DISALLOW_COPY_AND_ASSIGN(IconWithBadgeImageSource); |
190 }; | 190 }; |
191 | 191 |
192 | 192 |
193 const int ExtensionAction::kDefaultTabId = -1; | 193 const int ExtensionAction::kDefaultTabId = -1; |
194 | 194 |
195 ExtensionAction::IconAnimation::IconAnimation( | 195 ExtensionAction::IconAnimation::IconAnimation( |
196 ui::AnimationDelegate* delegate) | 196 ui::AnimationDelegate* delegate) |
197 // 100ms animation at 50fps (so 5 animation frames in total). | 197 // 100ms animation at 50fps (so 5 animation frames in total). |
198 : ui::LinearAnimation(1000, 50, delegate) {} | 198 : ui::LinearAnimation(100, 50, delegate) {} |
199 | 199 |
200 ExtensionAction::IconAnimation::~IconAnimation() {} | 200 ExtensionAction::IconAnimation::~IconAnimation() {} |
201 | 201 |
202 const SkBitmap& ExtensionAction::IconAnimation::Apply( | 202 const SkBitmap& ExtensionAction::IconAnimation::Apply( |
203 const SkBitmap& icon) const { | 203 const SkBitmap& icon) const { |
204 DCHECK_GT(icon.width(), 0); | 204 DCHECK_GT(icon.width(), 0); |
205 DCHECK_GT(icon.height(), 0); | 205 DCHECK_GT(icon.height(), 0); |
206 | 206 |
207 if (!device_.get() || | 207 if (!device_.get() || |
208 (device_->width() != icon.width()) || | 208 (device_->width() != icon.width()) || |
(...skipping 312 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
521 new AnimatedIconImageSource(icon, animation_wrapper->animation()), | 521 new AnimatedIconImageSource(icon, animation_wrapper->animation()), |
522 icon.size()); | 522 icon.size()); |
523 } | 523 } |
524 | 524 |
525 void ExtensionAction::RunIconAnimation(int tab_id) { | 525 void ExtensionAction::RunIconAnimation(int tab_id) { |
526 IconAnimationWrapper* icon_animation = | 526 IconAnimationWrapper* icon_animation = |
527 new IconAnimationWrapper(); | 527 new IconAnimationWrapper(); |
528 icon_animation_[tab_id] = icon_animation->AsWeakPtr(); | 528 icon_animation_[tab_id] = icon_animation->AsWeakPtr(); |
529 icon_animation->animation()->Start(); | 529 icon_animation->animation()->Start(); |
530 } | 530 } |
OLD | NEW |