| 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/download/download_shelf.h" | 5 #include "chrome/browser/download/download_shelf.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/callback.h" | 8 #include "base/callback.h" |
| 9 #include "base/message_loop.h" | 9 #include "base/message_loop.h" |
| 10 #include "chrome/browser/download/download_item_model.h" | 10 #include "chrome/browser/download/download_item_model.h" |
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 56 } | 56 } |
| 57 | 57 |
| 58 void DownloadShelf::Show() { | 58 void DownloadShelf::Show() { |
| 59 if (is_hidden_) { | 59 if (is_hidden_) { |
| 60 should_show_on_unhide_ = true; | 60 should_show_on_unhide_ = true; |
| 61 return; | 61 return; |
| 62 } | 62 } |
| 63 DoShow(); | 63 DoShow(); |
| 64 } | 64 } |
| 65 | 65 |
| 66 void DownloadShelf::Close() { | 66 void DownloadShelf::Close(CloseReason reason) { |
| 67 if (is_hidden_) { | 67 if (is_hidden_) { |
| 68 should_show_on_unhide_ = false; | 68 should_show_on_unhide_ = false; |
| 69 return; | 69 return; |
| 70 } | 70 } |
| 71 DoClose(); | 71 DoClose(reason); |
| 72 } | 72 } |
| 73 | 73 |
| 74 void DownloadShelf::Hide() { | 74 void DownloadShelf::Hide() { |
| 75 if (is_hidden_) | 75 if (is_hidden_) |
| 76 return; | 76 return; |
| 77 is_hidden_ = true; | 77 is_hidden_ = true; |
| 78 if (IsShowing()) { | 78 if (IsShowing()) { |
| 79 should_show_on_unhide_ = true; | 79 should_show_on_unhide_ = true; |
| 80 DoClose(); | 80 DoClose(AUTOMATIC); |
| 81 } | 81 } |
| 82 } | 82 } |
| 83 | 83 |
| 84 void DownloadShelf::Unhide() { | 84 void DownloadShelf::Unhide() { |
| 85 if (!is_hidden_) | 85 if (!is_hidden_) |
| 86 return; | 86 return; |
| 87 is_hidden_ = false; | 87 is_hidden_ = false; |
| 88 if (should_show_on_unhide_) { | 88 if (should_show_on_unhide_) { |
| 89 should_show_on_unhide_ = false; | 89 should_show_on_unhide_ = false; |
| 90 DoShow(); | 90 DoShow(); |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 135 content::DownloadManager* download_manager = GetDownloadManager(); | 135 content::DownloadManager* download_manager = GetDownloadManager(); |
| 136 if (!download_manager) | 136 if (!download_manager) |
| 137 return; | 137 return; |
| 138 | 138 |
| 139 DownloadItem* download = download_manager->GetDownload(download_id); | 139 DownloadItem* download = download_manager->GetDownload(download_id); |
| 140 if (!download) | 140 if (!download) |
| 141 return; | 141 return; |
| 142 | 142 |
| 143 ShowDownload(download); | 143 ShowDownload(download); |
| 144 } | 144 } |
| OLD | NEW |