| 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 <math.h> | 7 #include <math.h> |
| 8 | 8 |
| 9 #include <gtk/gtk.h> | 9 #include <gtk/gtk.h> |
| 10 | 10 |
| (...skipping 14 matching lines...) Expand all Loading... |
| 25 using content::WebContents; | 25 using content::WebContents; |
| 26 | 26 |
| 27 namespace { | 27 namespace { |
| 28 | 28 |
| 29 // How long to spend moving downwards and fading out after waiting. | 29 // How long to spend moving downwards and fading out after waiting. |
| 30 const int kMoveTimeMs = 600; | 30 const int kMoveTimeMs = 600; |
| 31 | 31 |
| 32 // The animation framerate. | 32 // The animation framerate. |
| 33 const int kFrameRateHz = 60; | 33 const int kFrameRateHz = 60; |
| 34 | 34 |
| 35 // What fraction of the frame height to move downward from the frame center. | |
| 36 // Note that setting this greater than 0.5 will mean moving past the bottom of | |
| 37 // the frame. | |
| 38 const double kMoveFraction = 1.0 / 3.0; | |
| 39 | |
| 40 class DownloadStartedAnimationGtk : public gfx::LinearAnimation, | 35 class DownloadStartedAnimationGtk : public gfx::LinearAnimation, |
| 41 public content::NotificationObserver { | 36 public content::NotificationObserver { |
| 42 public: | 37 public: |
| 43 explicit DownloadStartedAnimationGtk(WebContents* web_contents); | 38 explicit DownloadStartedAnimationGtk(WebContents* web_contents); |
| 44 | 39 |
| 45 // DownloadStartedAnimation will delete itself, but this is public so | 40 // DownloadStartedAnimation will delete itself, but this is public so |
| 46 // that we can use DeleteSoon(). | 41 // that we can use DeleteSoon(). |
| 47 virtual ~DownloadStartedAnimationGtk(); | 42 virtual ~DownloadStartedAnimationGtk(); |
| 48 | 43 |
| 49 private: | 44 private: |
| (...skipping 156 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 206 Close(); | 201 Close(); |
| 207 } | 202 } |
| 208 | 203 |
| 209 } // namespace | 204 } // namespace |
| 210 | 205 |
| 211 // static | 206 // static |
| 212 void DownloadStartedAnimation::Show(WebContents* web_contents) { | 207 void DownloadStartedAnimation::Show(WebContents* web_contents) { |
| 213 // The animation will delete itself. | 208 // The animation will delete itself. |
| 214 new DownloadStartedAnimationGtk(web_contents); | 209 new DownloadStartedAnimationGtk(web_contents); |
| 215 } | 210 } |
| OLD | NEW |