| 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 // 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 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 58 registrar_.Add(this, | 58 registrar_.Add(this, |
| 59 content::NOTIFICATION_WEB_CONTENTS_VISIBILITY_CHANGED, | 59 content::NOTIFICATION_WEB_CONTENTS_VISIBILITY_CHANGED, |
| 60 content::Source<WebContents>(web_contents_)); | 60 content::Source<WebContents>(web_contents_)); |
| 61 registrar_.Add(this, | 61 registrar_.Add(this, |
| 62 content::NOTIFICATION_WEB_CONTENTS_DESTROYED, | 62 content::NOTIFICATION_WEB_CONTENTS_DESTROYED, |
| 63 content::Source<WebContents>(web_contents_)); | 63 content::Source<WebContents>(web_contents_)); |
| 64 } | 64 } |
| 65 | 65 |
| 66 // Runs when a tab is hidden or destroyed. Let our owner know we should end | 66 // Runs when a tab is hidden or destroyed. Let our owner know we should end |
| 67 // the animation. | 67 // the animation. |
| 68 void Observe(int type, | 68 virtual void Observe( |
| 69 const content::NotificationSource& source, | 69 int type, |
| 70 const content::NotificationDetails& details) { | 70 const content::NotificationSource& source, |
| 71 const content::NotificationDetails& details) OVERRIDE { |
| 71 if (type == content::NOTIFICATION_WEB_CONTENTS_VISIBILITY_CHANGED) { | 72 if (type == content::NOTIFICATION_WEB_CONTENTS_VISIBILITY_CHANGED) { |
| 72 bool visible = *content::Details<bool>(details).ptr(); | 73 bool visible = *content::Details<bool>(details).ptr(); |
| 73 if (visible) | 74 if (visible) |
| 74 return; | 75 return; |
| 75 } | 76 } |
| 76 // This ends up deleting us. | 77 // This ends up deleting us. |
| 77 [owner_ closeAnimation]; | 78 [owner_ closeAnimation]; |
| 78 } | 79 } |
| 79 | 80 |
| 80 private: | 81 private: |
| (...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 199 } | 200 } |
| 200 | 201 |
| 201 @end | 202 @end |
| 202 | 203 |
| 203 void DownloadStartedAnimation::Show(WebContents* web_contents) { | 204 void DownloadStartedAnimation::Show(WebContents* web_contents) { |
| 204 DCHECK(web_contents); | 205 DCHECK(web_contents); |
| 205 | 206 |
| 206 // Will be deleted when the animation is complete. | 207 // Will be deleted when the animation is complete. |
| 207 [DownloadStartedAnimationMac startAnimationWithWebContents:web_contents]; | 208 [DownloadStartedAnimationMac startAnimationWithWebContents:web_contents]; |
| 208 } | 209 } |
| OLD | NEW |