| 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/browser/download/download_started_animation.h" | 5 #include "chrome/browser/download/download_started_animation.h" |
| 6 | 6 |
| 7 #include "content/public/browser/notification_details.h" | 7 #include "content/public/browser/notification_details.h" |
| 8 #include "content/public/browser/notification_observer.h" | 8 #include "content/public/browser/notification_observer.h" |
| 9 #include "content/public/browser/notification_registrar.h" | 9 #include "content/public/browser/notification_registrar.h" |
| 10 #include "content/public/browser/notification_source.h" | 10 #include "content/public/browser/notification_source.h" |
| (...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 75 content::NotificationRegistrar registrar_; | 75 content::NotificationRegistrar registrar_; |
| 76 | 76 |
| 77 DISALLOW_COPY_AND_ASSIGN(DownloadStartedAnimationWin); | 77 DISALLOW_COPY_AND_ASSIGN(DownloadStartedAnimationWin); |
| 78 }; | 78 }; |
| 79 | 79 |
| 80 DownloadStartedAnimationWin::DownloadStartedAnimationWin( | 80 DownloadStartedAnimationWin::DownloadStartedAnimationWin( |
| 81 WebContents* web_contents) | 81 WebContents* web_contents) |
| 82 : ui::LinearAnimation(kMoveTimeMs, kFrameRateHz, NULL), | 82 : ui::LinearAnimation(kMoveTimeMs, kFrameRateHz, NULL), |
| 83 popup_(NULL), | 83 popup_(NULL), |
| 84 web_contents_(web_contents) { | 84 web_contents_(web_contents) { |
| 85 static SkBitmap* kDownloadImage = NULL; | 85 static gfx::ImageSkia* kDownloadImage = NULL; |
| 86 if (!kDownloadImage) { | 86 if (!kDownloadImage) { |
| 87 kDownloadImage = ui::ResourceBundle::GetSharedInstance().GetBitmapNamed( | 87 kDownloadImage = ui::ResourceBundle::GetSharedInstance().GetImageSkiaNamed( |
| 88 IDR_DOWNLOAD_ANIMATION_BEGIN); | 88 IDR_DOWNLOAD_ANIMATION_BEGIN); |
| 89 } | 89 } |
| 90 | 90 |
| 91 // If we're too small to show the download image, then don't bother - | 91 // If we're too small to show the download image, then don't bother - |
| 92 // the shelf will be enough. | 92 // the shelf will be enough. |
| 93 web_contents_->GetContainerBounds(&web_contents_bounds_); | 93 web_contents_->GetContainerBounds(&web_contents_bounds_); |
| 94 if (web_contents_bounds_.height() < kDownloadImage->height()) | 94 if (web_contents_bounds_.height() < kDownloadImage->height()) |
| 95 return; | 95 return; |
| 96 | 96 |
| 97 registrar_.Add( | 97 registrar_.Add( |
| (...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 175 } | 175 } |
| 176 | 176 |
| 177 } // namespace | 177 } // namespace |
| 178 | 178 |
| 179 // static | 179 // static |
| 180 void DownloadStartedAnimation::Show(WebContents* web_contents) { | 180 void DownloadStartedAnimation::Show(WebContents* web_contents) { |
| 181 // The animation will delete itself when it's finished or when the tab | 181 // The animation will delete itself when it's finished or when the tab |
| 182 // contents is hidden or destroyed. | 182 // contents is hidden or destroyed. |
| 183 new DownloadStartedAnimationWin(web_contents); | 183 new DownloadStartedAnimationWin(web_contents); |
| 184 } | 184 } |
| OLD | NEW |