| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 // This file contains the Mac implementation the download animation, displayed | 5 // This file contains the Mac implementation the download animation, displayed |
| 6 // at the start of a download. The animation produces an arrow pointing | 6 // at the start of a download. The animation produces an arrow pointing |
| 7 // downwards and animates towards the bottom of the window where the new | 7 // downwards and animates towards the bottom of the window where the new |
| 8 // download appears in the download shelf. | 8 // download appears in the download shelf. |
| 9 | 9 |
| 10 #include "chrome/browser/download/download_started_animation.h" | 10 #include "chrome/browser/download/download_started_animation.h" |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 44 | 44 |
| 45 // A helper class to monitor tab hidden and closed notifications. If we receive | 45 // A helper class to monitor tab hidden and closed notifications. If we receive |
| 46 // such a notification, we stop the animation. | 46 // such a notification, we stop the animation. |
| 47 class DownloadAnimationTabObserver : public NotificationObserver { | 47 class DownloadAnimationTabObserver : public NotificationObserver { |
| 48 public: | 48 public: |
| 49 DownloadAnimationTabObserver(DownloadStartedAnimationMac* owner, | 49 DownloadAnimationTabObserver(DownloadStartedAnimationMac* owner, |
| 50 TabContents* tab_contents) | 50 TabContents* tab_contents) |
| 51 : owner_(owner), | 51 : owner_(owner), |
| 52 tab_contents_(tab_contents) { | 52 tab_contents_(tab_contents) { |
| 53 registrar_.Add(this, | 53 registrar_.Add(this, |
| 54 NotificationType::TAB_CONTENTS_HIDDEN, | 54 content::NOTIFICATION_TAB_CONTENTS_HIDDEN, |
| 55 Source<TabContents>(tab_contents_)); | 55 Source<TabContents>(tab_contents_)); |
| 56 registrar_.Add(this, | 56 registrar_.Add(this, |
| 57 NotificationType::TAB_CONTENTS_DESTROYED, | 57 content::NOTIFICATION_TAB_CONTENTS_DESTROYED, |
| 58 Source<TabContents>(tab_contents_)); | 58 Source<TabContents>(tab_contents_)); |
| 59 } | 59 } |
| 60 | 60 |
| 61 // Runs when a tab is hidden or destroyed. Let our owner know we should end | 61 // Runs when a tab is hidden or destroyed. Let our owner know we should end |
| 62 // the animation. | 62 // the animation. |
| 63 void Observe(NotificationType type, | 63 void Observe(int type, |
| 64 const NotificationSource& source, | 64 const NotificationSource& source, |
| 65 const NotificationDetails& details) { | 65 const NotificationDetails& details) { |
| 66 // This ends up deleting us. | 66 // This ends up deleting us. |
| 67 [owner_ closeAnimation]; | 67 [owner_ closeAnimation]; |
| 68 } | 68 } |
| 69 | 69 |
| 70 private: | 70 private: |
| 71 // The object we need to inform when we get a notification. Weak. | 71 // The object we need to inform when we get a notification. Weak. |
| 72 DownloadStartedAnimationMac* owner_; | 72 DownloadStartedAnimationMac* owner_; |
| 73 | 73 |
| (...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 188 } | 188 } |
| 189 | 189 |
| 190 @end | 190 @end |
| 191 | 191 |
| 192 void DownloadStartedAnimation::Show(TabContents* tab_contents) { | 192 void DownloadStartedAnimation::Show(TabContents* tab_contents) { |
| 193 DCHECK(tab_contents); | 193 DCHECK(tab_contents); |
| 194 | 194 |
| 195 // Will be deleted when the animation is complete. | 195 // Will be deleted when the animation is complete. |
| 196 [DownloadStartedAnimationMac startAnimationWithTabContents:tab_contents]; | 196 [DownloadStartedAnimationMac startAnimationWithTabContents:tab_contents]; |
| 197 } | 197 } |
| OLD | NEW |