| 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_shelf_view.h" | 5 #include "chrome/browser/views/download_shelf_view.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 | 8 |
| 9 #include "app/gfx/canvas.h" | 9 #include "app/gfx/canvas.h" |
| 10 #include "app/l10n_util.h" | 10 #include "app/l10n_util.h" |
| (...skipping 181 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 192 void DownloadShelfView::Layout() { | 192 void DownloadShelfView::Layout() { |
| 193 // Now that we know we have a parent, we can safely set our theme colors. | 193 // Now that we know we have a parent, we can safely set our theme colors. |
| 194 show_all_view_->SetColor( | 194 show_all_view_->SetColor( |
| 195 GetThemeProvider()->GetColor(BrowserThemeProvider::COLOR_BOOKMARK_TEXT)); | 195 GetThemeProvider()->GetColor(BrowserThemeProvider::COLOR_BOOKMARK_TEXT)); |
| 196 set_background(views::Background::CreateSolidBackground( | 196 set_background(views::Background::CreateSolidBackground( |
| 197 GetThemeProvider()->GetColor(BrowserThemeProvider::COLOR_TOOLBAR))); | 197 GetThemeProvider()->GetColor(BrowserThemeProvider::COLOR_TOOLBAR))); |
| 198 | 198 |
| 199 // Let our base class layout our child views | 199 // Let our base class layout our child views |
| 200 views::View::Layout(); | 200 views::View::Layout(); |
| 201 | 201 |
| 202 // If there is not enought room to show the first download item, show the | 202 // If there is not enough room to show the first download item, show the |
| 203 // "Show all downloads" link to the left to make it more visible that there is | 203 // "Show all downloads" link to the left to make it more visible that there is |
| 204 // something to see. | 204 // something to see. |
| 205 bool show_link_only = !CanFitFirstDownloadItem(); | 205 bool show_link_only = !CanFitFirstDownloadItem(); |
| 206 | 206 |
| 207 gfx::Size image_size = arrow_image_->GetPreferredSize(); | 207 gfx::Size image_size = arrow_image_->GetPreferredSize(); |
| 208 gfx::Size close_button_size = close_button_->GetPreferredSize(); | 208 gfx::Size close_button_size = close_button_->GetPreferredSize(); |
| 209 gfx::Size show_all_size = show_all_view_->GetPreferredSize(); | 209 gfx::Size show_all_size = show_all_view_->GetPreferredSize(); |
| 210 int max_download_x = | 210 int max_download_x = |
| 211 std::max<int>(0, width() - kRightPadding - close_button_size.width() - | 211 std::max<int>(0, width() - kRightPadding - close_button_size.width() - |
| 212 kCloseAndLinkPadding - show_all_size.width() - | 212 kCloseAndLinkPadding - show_all_size.width() - |
| (...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 290 | 290 |
| 291 void DownloadShelfView::ButtonPressed(views::Button* button) { | 291 void DownloadShelfView::ButtonPressed(views::Button* button) { |
| 292 Close(); | 292 Close(); |
| 293 } | 293 } |
| 294 | 294 |
| 295 bool DownloadShelfView::IsShowing() const { | 295 bool DownloadShelfView::IsShowing() const { |
| 296 return shelf_animation_->IsShowing(); | 296 return shelf_animation_->IsShowing(); |
| 297 } | 297 } |
| 298 | 298 |
| 299 bool DownloadShelfView::IsClosing() const { | 299 bool DownloadShelfView::IsClosing() const { |
| 300 // TODO(estade): This is never called. For now just return false. | 300 return shelf_animation_->IsClosing(); |
| 301 return false; | |
| 302 } | 301 } |
| 303 | 302 |
| 304 void DownloadShelfView::Show() { | 303 void DownloadShelfView::Show() { |
| 305 shelf_animation_->Show(); | 304 shelf_animation_->Show(); |
| 306 } | 305 } |
| 307 | 306 |
| 308 void DownloadShelfView::Close() { | 307 void DownloadShelfView::Close() { |
| 309 parent_->SetDownloadShelfVisible(false); | 308 parent_->SetDownloadShelfVisible(false); |
| 310 shelf_animation_->Hide(); | 309 shelf_animation_->Hide(); |
| 311 } | 310 } |
| OLD | NEW |