| 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 "content/public/browser/web_contents.h" | 8 #include "content/public/browser/web_contents.h" |
| 9 #include "grit/theme_resources.h" | 9 #include "grit/theme_resources.h" |
| 10 #include "ui/base/resource/resource_bundle.h" | 10 #include "ui/base/resource/resource_bundle.h" |
| (...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 73 | 73 |
| 74 SetImage(&download_image); | 74 SetImage(&download_image); |
| 75 | 75 |
| 76 popup_ = new views::Widget; | 76 popup_ = new views::Widget; |
| 77 | 77 |
| 78 views::Widget::InitParams params(views::Widget::InitParams::TYPE_POPUP); | 78 views::Widget::InitParams params(views::Widget::InitParams::TYPE_POPUP); |
| 79 params.opacity = views::Widget::InitParams::TRANSLUCENT_WINDOW; | 79 params.opacity = views::Widget::InitParams::TRANSLUCENT_WINDOW; |
| 80 params.accept_events = false; | 80 params.accept_events = false; |
| 81 params.parent = web_contents->GetNativeView(); | 81 params.parent = web_contents->GetNativeView(); |
| 82 popup_->Init(params); | 82 popup_->Init(params); |
| 83 popup_->SetOpacity(0x00); | 83 popup_->SetOpacity(0.f); |
| 84 popup_->SetContentsView(this); | 84 popup_->SetContentsView(this); |
| 85 Reposition(); | 85 Reposition(); |
| 86 popup_->Show(); | 86 popup_->Show(); |
| 87 | 87 |
| 88 Start(); | 88 Start(); |
| 89 } | 89 } |
| 90 | 90 |
| 91 void DownloadStartedAnimationViews::Reposition() { | 91 void DownloadStartedAnimationViews::Reposition() { |
| 92 // Align the image with the bottom left of the web contents (so that it | 92 // Align the image with the bottom left of the web contents (so that it |
| 93 // points to the newly created download). | 93 // points to the newly created download). |
| (...skipping 24 matching lines...) Expand all Loading... |
| 118 } | 118 } |
| 119 } | 119 } |
| 120 | 120 |
| 121 } // namespace | 121 } // namespace |
| 122 | 122 |
| 123 // static | 123 // static |
| 124 void DownloadStartedAnimation::Show(content::WebContents* web_contents) { | 124 void DownloadStartedAnimation::Show(content::WebContents* web_contents) { |
| 125 // The animation will delete itself when it's finished. | 125 // The animation will delete itself when it's finished. |
| 126 new DownloadStartedAnimationViews(web_contents); | 126 new DownloadStartedAnimationViews(web_contents); |
| 127 } | 127 } |
| OLD | NEW |