OLD | NEW |
1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 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/views/download_started_animation.h" | 5 #include "chrome/browser/views/download_started_animation.h" |
6 | 6 |
7 #include "chrome/app/theme/theme_resources.h" | 7 #include "chrome/app/theme/theme_resources.h" |
8 #include "chrome/browser/tab_contents.h" | 8 #include "chrome/browser/tab_contents.h" |
9 #include "chrome/common/resource_bundle.h" | 9 #include "chrome/common/resource_bundle.h" |
10 #include "chrome/views/hwnd_view_container.h" | 10 #include "chrome/views/hwnd_view_container.h" |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
56 | 56 |
57 Start(); | 57 Start(); |
58 } | 58 } |
59 | 59 |
60 void DownloadStartedAnimation::Reposition() { | 60 void DownloadStartedAnimation::Reposition() { |
61 if (!tab_contents_) | 61 if (!tab_contents_) |
62 return; | 62 return; |
63 | 63 |
64 // Align the image with the bottom left of the web contents (so that it | 64 // Align the image with the bottom left of the web contents (so that it |
65 // points to the newly created download). | 65 // points to the newly created download). |
66 CSize size; | 66 gfx::Size size = GetPreferredSize(); |
67 GetPreferredSize(&size); | 67 popup_->MoveWindow( |
68 popup_->MoveWindow(tab_contents_bounds_.x(), | 68 tab_contents_bounds_.x(), |
69 static_cast<int>(tab_contents_bounds_.bottom() - size.cy - | 69 static_cast<int>(tab_contents_bounds_.bottom() - |
70 size.cy * (1 - GetCurrentValue())), | 70 size.height() - size.height() * (1 - GetCurrentValue())), |
71 size.cx, size.cy); | 71 size.width(), |
| 72 size.height()); |
72 } | 73 } |
73 | 74 |
74 void DownloadStartedAnimation::Close() { | 75 void DownloadStartedAnimation::Close() { |
75 if (!tab_contents_) | 76 if (!tab_contents_) |
76 return; | 77 return; |
77 | 78 |
78 NotificationService::current()->RemoveObserver(this, | 79 NotificationService::current()->RemoveObserver(this, |
79 NOTIFY_TAB_CONTENTS_HIDDEN, Source<TabContents>(tab_contents_)); | 80 NOTIFY_TAB_CONTENTS_HIDDEN, Source<TabContents>(tab_contents_)); |
80 NotificationService::current()->RemoveObserver(this, | 81 NotificationService::current()->RemoveObserver(this, |
81 NOTIFY_TAB_CONTENTS_DESTROYED, Source<TabContents>(tab_contents_)); | 82 NOTIFY_TAB_CONTENTS_DESTROYED, Source<TabContents>(tab_contents_)); |
(...skipping 17 matching lines...) Expand all Loading... |
99 // alpha changes, so we need to force a paint. | 100 // alpha changes, so we need to force a paint. |
100 } | 101 } |
101 } | 102 } |
102 | 103 |
103 void DownloadStartedAnimation::Observe(NotificationType type, | 104 void DownloadStartedAnimation::Observe(NotificationType type, |
104 const NotificationSource& source, | 105 const NotificationSource& source, |
105 const NotificationDetails& details) { | 106 const NotificationDetails& details) { |
106 Close(); | 107 Close(); |
107 } | 108 } |
108 | 109 |
OLD | NEW |