| 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 gfx::Rect rc(0, 0, 0, 0); | 104 popup_ = views::Widget::CreateWidget(); |
| 105 popup_->SetOpacity(0x00); |
| 106 |
| 105 views::Widget::CreateParams params(views::Widget::CreateParams::TYPE_POPUP); | 107 views::Widget::CreateParams params(views::Widget::CreateParams::TYPE_POPUP); |
| 106 params.transparent = true; | 108 params.transparent = true; |
| 107 params.accept_events = false; | 109 params.accept_events = false; |
| 108 popup_ = views::Widget::CreateWidget(params); | 110 params.parent = tab_contents_->GetNativeView(); |
| 109 popup_->SetOpacity(0x00); | 111 popup_->Init(params); |
| 110 popup_->Init(tab_contents_->GetNativeView(), rc); | |
| 111 popup_->SetContentsView(this); | 112 popup_->SetContentsView(this); |
| 112 Reposition(); | 113 Reposition(); |
| 113 popup_->Show(); | 114 popup_->Show(); |
| 114 | 115 |
| 115 Start(); | 116 Start(); |
| 116 } | 117 } |
| 117 | 118 |
| 118 void DownloadStartedAnimationWin::Reposition() { | 119 void DownloadStartedAnimationWin::Reposition() { |
| 119 if (!tab_contents_) | 120 if (!tab_contents_) |
| 120 return; | 121 return; |
| (...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 172 } | 173 } |
| 173 | 174 |
| 174 } // namespace | 175 } // namespace |
| 175 | 176 |
| 176 // static | 177 // static |
| 177 void DownloadStartedAnimation::Show(TabContents* tab_contents) { | 178 void DownloadStartedAnimation::Show(TabContents* tab_contents) { |
| 178 // 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 |
| 179 // contents is hidden or destroyed. | 180 // contents is hidden or destroyed. |
| 180 new DownloadStartedAnimationWin(tab_contents); | 181 new DownloadStartedAnimationWin(tab_contents); |
| 181 } | 182 } |
| OLD | NEW |