OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/ui/views/download/download_shelf_view.h" | 5 #include "chrome/browser/ui/views/download/download_shelf_view.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <vector> | 8 #include <vector> |
9 | 9 |
10 #include "base/logging.h" | 10 #include "base/logging.h" |
(...skipping 349 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
360 } | 360 } |
361 | 361 |
362 bool DownloadShelfView::IsShowing() const { | 362 bool DownloadShelfView::IsShowing() const { |
363 return visible() && shelf_animation_.IsShowing(); | 363 return visible() && shelf_animation_.IsShowing(); |
364 } | 364 } |
365 | 365 |
366 bool DownloadShelfView::IsClosing() const { | 366 bool DownloadShelfView::IsClosing() const { |
367 return shelf_animation_.IsClosing(); | 367 return shelf_animation_.IsClosing(); |
368 } | 368 } |
369 | 369 |
370 void DownloadShelfView::DoShow() { | 370 void DownloadShelfView::DoOpen() { |
371 SetVisible(true); | 371 SetVisible(true); |
372 shelf_animation_.Show(); | 372 shelf_animation_.Show(); |
373 } | 373 } |
374 | 374 |
375 void DownloadShelfView::DoClose(CloseReason reason) { | 375 void DownloadShelfView::DoClose(CloseReason reason) { |
376 int num_in_progress = 0; | 376 int num_in_progress = 0; |
377 for (size_t i = 0; i < download_views_.size(); ++i) { | 377 for (size_t i = 0; i < download_views_.size(); ++i) { |
378 if (download_views_[i]->download()->GetState() == DownloadItem::IN_PROGRESS) | 378 if (download_views_[i]->download()->GetState() == DownloadItem::IN_PROGRESS) |
379 ++num_in_progress; | 379 ++num_in_progress; |
380 } | 380 } |
381 RecordDownloadShelfClose( | 381 RecordDownloadShelfClose( |
382 download_views_.size(), num_in_progress, reason == AUTOMATIC); | 382 download_views_.size(), num_in_progress, reason == AUTOMATIC); |
383 parent_->SetDownloadShelfVisible(false); | 383 parent_->SetDownloadShelfVisible(false); |
384 shelf_animation_.Hide(); | 384 shelf_animation_.Hide(); |
385 } | 385 } |
386 | 386 |
| 387 void DownloadShelfView::DoHide() { |
| 388 SetVisible(false); |
| 389 parent_->ToolbarSizeChanged(false); |
| 390 parent_->SetDownloadShelfVisible(false); |
| 391 } |
| 392 |
| 393 void DownloadShelfView::DoUnhide() { |
| 394 SetVisible(true); |
| 395 parent_->ToolbarSizeChanged(true); |
| 396 parent_->SetDownloadShelfVisible(true); |
| 397 } |
| 398 |
387 Browser* DownloadShelfView::browser() const { | 399 Browser* DownloadShelfView::browser() const { |
388 return browser_; | 400 return browser_; |
389 } | 401 } |
390 | 402 |
391 void DownloadShelfView::Closed() { | 403 void DownloadShelfView::Closed() { |
392 // Don't remove completed downloads if the shelf is just being auto-hidden | 404 // Don't remove completed downloads if the shelf is just being auto-hidden |
393 // rather than explicitly closed by the user. | 405 // rather than explicitly closed by the user. |
394 if (is_hidden()) | 406 if (is_hidden()) |
395 return; | 407 return; |
396 // When the close animation is complete, remove all completed downloads. | 408 // When the close animation is complete, remove all completed downloads. |
(...skipping 16 matching lines...) Expand all Loading... |
413 SetVisible(false); | 425 SetVisible(false); |
414 } | 426 } |
415 | 427 |
416 bool DownloadShelfView::CanAutoClose() { | 428 bool DownloadShelfView::CanAutoClose() { |
417 for (size_t i = 0; i < download_views_.size(); ++i) { | 429 for (size_t i = 0; i < download_views_.size(); ++i) { |
418 if (!download_views_[i]->download()->GetOpened()) | 430 if (!download_views_[i]->download()->GetOpened()) |
419 return false; | 431 return false; |
420 } | 432 } |
421 return true; | 433 return true; |
422 } | 434 } |
OLD | NEW |