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 #define _USE_MATH_DEFINES // For VC++ to get M_PI. This has to be first. | 5 #define _USE_MATH_DEFINES // For VC++ to get M_PI. This has to be first. |
6 | 6 |
7 #include "chrome/browser/download/download_shelf.h" | 7 #include "chrome/browser/download/download_shelf.h" |
8 | 8 |
9 #include <cmath> | 9 #include <cmath> |
10 | 10 |
(...skipping 25 matching lines...) Expand all Loading... |
36 #include "ui/base/resource/resource_bundle.h" | 36 #include "ui/base/resource/resource_bundle.h" |
37 #include "ui/base/theme_provider.h" | 37 #include "ui/base/theme_provider.h" |
38 #include "ui/gfx/animation/animation.h" | 38 #include "ui/gfx/animation/animation.h" |
39 #include "ui/gfx/canvas.h" | 39 #include "ui/gfx/canvas.h" |
40 | 40 |
41 using content::DownloadItem; | 41 using content::DownloadItem; |
42 | 42 |
43 namespace { | 43 namespace { |
44 | 44 |
45 // Delay before we show a transient download. | 45 // Delay before we show a transient download. |
46 const int64 kDownloadShowDelayInSeconds = 2; | 46 const int64_t kDownloadShowDelayInSeconds = 2; |
47 | 47 |
48 // Get the opacity based on |animation_progress|, with values in [0.0, 1.0]. | 48 // Get the opacity based on |animation_progress|, with values in [0.0, 1.0]. |
49 // Range of return value is [0, 255]. | 49 // Range of return value is [0, 255]. |
50 int GetOpacity(double animation_progress) { | 50 int GetOpacity(double animation_progress) { |
51 DCHECK(animation_progress >= 0 && animation_progress <= 1); | 51 DCHECK(animation_progress >= 0 && animation_progress <= 1); |
52 | 52 |
53 // How many times to cycle the complete animation. This should be an odd | 53 // How many times to cycle the complete animation. This should be an odd |
54 // number so that the animation ends faded out. | 54 // number so that the animation ends faded out. |
55 static const int kCompleteAnimationCycles = 5; | 55 static const int kCompleteAnimationCycles = 5; |
56 double temp = animation_progress * kCompleteAnimationCycles * M_PI + M_PI_2; | 56 double temp = animation_progress * kCompleteAnimationCycles * M_PI + M_PI_2; |
(...skipping 165 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
222 content::WebContents* shelf_tab = | 222 content::WebContents* shelf_tab = |
223 browser()->tab_strip_model()->GetActiveWebContents(); | 223 browser()->tab_strip_model()->GetActiveWebContents(); |
224 if (DownloadItemModel(download).ShouldShowDownloadStartedAnimation() && | 224 if (DownloadItemModel(download).ShouldShowDownloadStartedAnimation() && |
225 shelf_tab && | 225 shelf_tab && |
226 platform_util::IsVisible(shelf_tab->GetNativeView()) && | 226 platform_util::IsVisible(shelf_tab->GetNativeView()) && |
227 gfx::Animation::ShouldRenderRichAnimation()) { | 227 gfx::Animation::ShouldRenderRichAnimation()) { |
228 DownloadStartedAnimation::Show(shelf_tab); | 228 DownloadStartedAnimation::Show(shelf_tab); |
229 } | 229 } |
230 } | 230 } |
231 | 231 |
232 void DownloadShelf::ShowDownloadById(int32 download_id) { | 232 void DownloadShelf::ShowDownloadById(int32_t download_id) { |
233 content::DownloadManager* download_manager = GetDownloadManager(); | 233 content::DownloadManager* download_manager = GetDownloadManager(); |
234 if (!download_manager) | 234 if (!download_manager) |
235 return; | 235 return; |
236 | 236 |
237 DownloadItem* download = download_manager->GetDownload(download_id); | 237 DownloadItem* download = download_manager->GetDownload(download_id); |
238 if (!download) | 238 if (!download) |
239 return; | 239 return; |
240 | 240 |
241 ShowDownload(download); | 241 ShowDownload(download); |
242 } | 242 } |
OLD | NEW |