OLD | NEW |
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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" |
11 | 11 |
(...skipping 157 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
169 | 169 |
170 - (void)animationComplete { | 170 - (void)animationComplete { |
171 [[animation_ parentWindow] removeChildWindow:animation_]; | 171 [[animation_ parentWindow] removeChildWindow:animation_]; |
172 [self release]; | 172 [self release]; |
173 } | 173 } |
174 | 174 |
175 + (void)startAnimationWithTabContents:(TabContents*)contents { | 175 + (void)startAnimationWithTabContents:(TabContents*)contents { |
176 // Will be deleted when the animation is complete in -animationComplete. | 176 // Will be deleted when the animation is complete in -animationComplete. |
177 DownloadStartedAnimationMac* controller = | 177 DownloadStartedAnimationMac* controller = |
178 [[self alloc] initWithTabContents:contents]; | 178 [[self alloc] initWithTabContents:contents]; |
| 179 // The initializer can return nil. |
| 180 if (!controller) |
| 181 return; |
| 182 |
179 // The |animation_| releaes itself when done. | 183 // The |animation_| releaes itself when done. |
180 [controller->animation_ startAnimation]; | 184 [controller->animation_ startAnimation]; |
181 } | 185 } |
182 | 186 |
183 @end | 187 @end |
184 | 188 |
185 void DownloadStartedAnimation::Show(TabContents* tab_contents) { | 189 void DownloadStartedAnimation::Show(TabContents* tab_contents) { |
186 DCHECK(tab_contents); | 190 DCHECK(tab_contents); |
187 | 191 |
188 // Will be deleted when the animation is complete. | 192 // Will be deleted when the animation is complete. |
189 [DownloadStartedAnimationMac startAnimationWithTabContents:tab_contents]; | 193 [DownloadStartedAnimationMac startAnimationWithTabContents:tab_contents]; |
190 } | 194 } |
OLD | NEW |