| OLD | NEW |
| 1 // Copyright (c) 2011 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 |
| 11 #include "base/message_loop.h" | 11 #include "base/message_loop.h" |
| (...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 84 }; | 84 }; |
| 85 | 85 |
| 86 DownloadStartedAnimationGtk::DownloadStartedAnimationGtk( | 86 DownloadStartedAnimationGtk::DownloadStartedAnimationGtk( |
| 87 WebContents* web_contents) | 87 WebContents* web_contents) |
| 88 : ui::LinearAnimation(kMoveTimeMs, kFrameRateHz, NULL), | 88 : ui::LinearAnimation(kMoveTimeMs, kFrameRateHz, NULL), |
| 89 popup_(NULL), | 89 popup_(NULL), |
| 90 web_contents_(web_contents) { | 90 web_contents_(web_contents) { |
| 91 static GdkPixbuf* kDownloadImage = NULL; | 91 static GdkPixbuf* kDownloadImage = NULL; |
| 92 if (!kDownloadImage) { | 92 if (!kDownloadImage) { |
| 93 ui::ResourceBundle& rb = ui::ResourceBundle::GetSharedInstance(); | 93 ui::ResourceBundle& rb = ui::ResourceBundle::GetSharedInstance(); |
| 94 kDownloadImage = rb.GetNativeImageNamed(IDR_DOWNLOAD_ANIMATION_BEGIN); | 94 kDownloadImage = rb.GetNativeImageNamed( |
| 95 IDR_DOWNLOAD_ANIMATION_BEGIN).ToGdkPixbuf(); |
| 95 } | 96 } |
| 96 | 97 |
| 97 width_ = gdk_pixbuf_get_width(kDownloadImage); | 98 width_ = gdk_pixbuf_get_width(kDownloadImage); |
| 98 height_ = gdk_pixbuf_get_height(kDownloadImage); | 99 height_ = gdk_pixbuf_get_height(kDownloadImage); |
| 99 | 100 |
| 100 // If we're too small to show the download image, then don't bother - | 101 // If we're too small to show the download image, then don't bother - |
| 101 // the shelf will be enough. | 102 // the shelf will be enough. |
| 102 web_contents_->GetContainerBounds(&web_contents_bounds_); | 103 web_contents_->GetContainerBounds(&web_contents_bounds_); |
| 103 if (web_contents_bounds_.height() < height_) | 104 if (web_contents_bounds_.height() < height_) |
| 104 return; | 105 return; |
| (...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 198 Close(); | 199 Close(); |
| 199 } | 200 } |
| 200 | 201 |
| 201 } // namespace | 202 } // namespace |
| 202 | 203 |
| 203 // static | 204 // static |
| 204 void DownloadStartedAnimation::Show(WebContents* web_contents) { | 205 void DownloadStartedAnimation::Show(WebContents* web_contents) { |
| 205 // The animation will delete itself. | 206 // The animation will delete itself. |
| 206 new DownloadStartedAnimationGtk(web_contents); | 207 new DownloadStartedAnimationGtk(web_contents); |
| 207 } | 208 } |
| OLD | NEW |