OLD | NEW |
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 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 "app/animation.h" | 7 #include "app/animation.h" |
8 #include "app/resource_bundle.h" | 8 #include "app/resource_bundle.h" |
9 #include "base/gfx/rect.h" | 9 #include "base/gfx/rect.h" |
10 #include "chrome/browser/tab_contents/tab_contents.h" | 10 #include "chrome/browser/tab_contents/tab_contents.h" |
(...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
114 Start(); | 114 Start(); |
115 } | 115 } |
116 | 116 |
117 void DownloadStartedAnimationWin::Reposition() { | 117 void DownloadStartedAnimationWin::Reposition() { |
118 if (!tab_contents_) | 118 if (!tab_contents_) |
119 return; | 119 return; |
120 | 120 |
121 // Align the image with the bottom left of the web contents (so that it | 121 // Align the image with the bottom left of the web contents (so that it |
122 // points to the newly created download). | 122 // points to the newly created download). |
123 gfx::Size size = GetPreferredSize(); | 123 gfx::Size size = GetPreferredSize(); |
| 124 int x = UILayoutIsRightToLeft() ? |
| 125 tab_contents_bounds_.right() - size.width() : tab_contents_bounds_.x(); |
124 popup_->MoveWindow( | 126 popup_->MoveWindow( |
125 tab_contents_bounds_.x(), | 127 x, |
126 static_cast<int>(tab_contents_bounds_.bottom() - | 128 static_cast<int>(tab_contents_bounds_.bottom() - |
127 size.height() - size.height() * (1 - GetCurrentValue())), | 129 size.height() - size.height() * (1 - GetCurrentValue())), |
128 size.width(), | 130 size.width(), |
129 size.height()); | 131 size.height()); |
130 } | 132 } |
131 | 133 |
132 void DownloadStartedAnimationWin::Close() { | 134 void DownloadStartedAnimationWin::Close() { |
133 if (!tab_contents_) | 135 if (!tab_contents_) |
134 return; | 136 return; |
135 | 137 |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
169 } | 171 } |
170 | 172 |
171 } // namespace | 173 } // namespace |
172 | 174 |
173 // static | 175 // static |
174 void DownloadStartedAnimation::Show(TabContents* tab_contents) { | 176 void DownloadStartedAnimation::Show(TabContents* tab_contents) { |
175 // The animation will delete itself when it's finished or when the tab | 177 // The animation will delete itself when it's finished or when the tab |
176 // contents is hidden or destroyed. | 178 // contents is hidden or destroyed. |
177 new DownloadStartedAnimationWin(tab_contents); | 179 new DownloadStartedAnimationWin(tab_contents); |
178 } | 180 } |
OLD | NEW |