| 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 "base/macros.h" | 7 #include "base/macros.h" |
| 8 #include "chrome/app/vector_icons/vector_icons.h" |
| 8 #include "content/public/browser/web_contents.h" | 9 #include "content/public/browser/web_contents.h" |
| 9 #include "ui/base/resource/resource_bundle.h" | 10 #include "ui/base/resource/resource_bundle.h" |
| 10 #include "ui/gfx/animation/linear_animation.h" | 11 #include "ui/gfx/animation/linear_animation.h" |
| 11 #include "ui/gfx/color_palette.h" | 12 #include "ui/gfx/color_palette.h" |
| 12 #include "ui/gfx/geometry/rect.h" | 13 #include "ui/gfx/geometry/rect.h" |
| 13 #include "ui/gfx/paint_vector_icon.h" | 14 #include "ui/gfx/paint_vector_icon.h" |
| 14 #include "ui/gfx/vector_icons_public.h" | 15 #include "ui/gfx/vector_icons_public.h" |
| 15 #include "ui/views/controls/image_view.h" | 16 #include "ui/views/controls/image_view.h" |
| 16 #include "ui/views/widget/widget.h" | 17 #include "ui/views/widget/widget.h" |
| 17 | 18 |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 54 // much heartbreak. | 55 // much heartbreak. |
| 55 gfx::Rect web_contents_bounds_; | 56 gfx::Rect web_contents_bounds_; |
| 56 | 57 |
| 57 DISALLOW_COPY_AND_ASSIGN(DownloadStartedAnimationViews); | 58 DISALLOW_COPY_AND_ASSIGN(DownloadStartedAnimationViews); |
| 58 }; | 59 }; |
| 59 | 60 |
| 60 DownloadStartedAnimationViews::DownloadStartedAnimationViews( | 61 DownloadStartedAnimationViews::DownloadStartedAnimationViews( |
| 61 content::WebContents* web_contents) | 62 content::WebContents* web_contents) |
| 62 : gfx::LinearAnimation(kMoveTimeMs, kFrameRateHz, NULL), | 63 : gfx::LinearAnimation(kMoveTimeMs, kFrameRateHz, NULL), |
| 63 popup_(NULL) { | 64 popup_(NULL) { |
| 64 gfx::ImageSkia download_image = gfx::CreateVectorIcon( | 65 gfx::ImageSkia download_image = |
| 65 gfx::VectorIconId::FILE_DOWNLOAD_SHELF, 72, gfx::kGoogleBlue500); | 66 gfx::CreateVectorIcon(kFileDownloadShelfIcon, 72, gfx::kGoogleBlue500); |
| 66 | 67 |
| 67 // If we're too small to show the download image, then don't bother - | 68 // If we're too small to show the download image, then don't bother - |
| 68 // the shelf will be enough. | 69 // the shelf will be enough. |
| 69 web_contents_bounds_ = web_contents->GetContainerBounds(); | 70 web_contents_bounds_ = web_contents->GetContainerBounds(); |
| 70 if (web_contents_bounds_.height() < download_image.height()) | 71 if (web_contents_bounds_.height() < download_image.height()) |
| 71 return; | 72 return; |
| 72 | 73 |
| 73 SetImage(&download_image); | 74 SetImage(&download_image); |
| 74 | 75 |
| 75 popup_ = new views::Widget; | 76 popup_ = new views::Widget; |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 117 } | 118 } |
| 118 } | 119 } |
| 119 | 120 |
| 120 } // namespace | 121 } // namespace |
| 121 | 122 |
| 122 // static | 123 // static |
| 123 void DownloadStartedAnimation::Show(content::WebContents* web_contents) { | 124 void DownloadStartedAnimation::Show(content::WebContents* web_contents) { |
| 124 // The animation will delete itself when it's finished. | 125 // The animation will delete itself when it's finished. |
| 125 new DownloadStartedAnimationViews(web_contents); | 126 new DownloadStartedAnimationViews(web_contents); |
| 126 } | 127 } |
| OLD | NEW |