OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 "content/browser/tab_contents/tab_contents.h" | 7 #include "content/browser/tab_contents/tab_contents.h" |
8 #include "content/common/notification_details.h" | 8 #include "content/common/notification_details.h" |
9 #include "content/common/notification_registrar.h" | 9 #include "content/common/notification_registrar.h" |
10 #include "content/common/notification_source.h" | 10 #include "content/common/notification_source.h" |
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
94 this, | 94 this, |
95 NotificationType::TAB_CONTENTS_HIDDEN, | 95 NotificationType::TAB_CONTENTS_HIDDEN, |
96 Source<TabContents>(tab_contents_)); | 96 Source<TabContents>(tab_contents_)); |
97 registrar_.Add( | 97 registrar_.Add( |
98 this, | 98 this, |
99 NotificationType::TAB_CONTENTS_DESTROYED, | 99 NotificationType::TAB_CONTENTS_DESTROYED, |
100 Source<TabContents>(tab_contents_)); | 100 Source<TabContents>(tab_contents_)); |
101 | 101 |
102 SetImage(kDownloadImage); | 102 SetImage(kDownloadImage); |
103 | 103 |
104 popup_ = views::Widget::CreateWidget(); | 104 popup_ = new views::Widget; |
105 popup_->SetOpacity(0x00); | |
106 | 105 |
107 views::Widget::InitParams params(views::Widget::InitParams::TYPE_POPUP); | 106 views::Widget::InitParams params(views::Widget::InitParams::TYPE_POPUP); |
108 params.transparent = true; | 107 params.transparent = true; |
109 params.accept_events = false; | 108 params.accept_events = false; |
110 params.parent = tab_contents_->GetNativeView(); | 109 params.parent = tab_contents_->GetNativeView(); |
111 popup_->Init(params); | 110 popup_->Init(params); |
| 111 popup_->SetOpacity(0x00); |
112 popup_->SetContentsView(this); | 112 popup_->SetContentsView(this); |
113 Reposition(); | 113 Reposition(); |
114 popup_->Show(); | 114 popup_->Show(); |
115 | 115 |
116 Start(); | 116 Start(); |
117 } | 117 } |
118 | 118 |
119 void DownloadStartedAnimationWin::Reposition() { | 119 void DownloadStartedAnimationWin::Reposition() { |
120 if (!tab_contents_) | 120 if (!tab_contents_) |
121 return; | 121 return; |
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
173 } | 173 } |
174 | 174 |
175 } // namespace | 175 } // namespace |
176 | 176 |
177 // static | 177 // static |
178 void DownloadStartedAnimation::Show(TabContents* tab_contents) { | 178 void DownloadStartedAnimation::Show(TabContents* tab_contents) { |
179 // The animation will delete itself when it's finished or when the tab | 179 // The animation will delete itself when it's finished or when the tab |
180 // contents is hidden or destroyed. | 180 // contents is hidden or destroyed. |
181 new DownloadStartedAnimationWin(tab_contents); | 181 new DownloadStartedAnimationWin(tab_contents); |
182 } | 182 } |
OLD | NEW |