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/download/download_request_manager.h" | 5 #include "chrome/browser/download/download_request_manager.h" |
6 | 6 |
7 #include "base/message_loop.h" | 7 #include "base/message_loop.h" |
8 #include "base/thread.h" | 8 #include "base/thread.h" |
9 #include "chrome/browser/download/download_request_dialog_delegate.h" | 9 #include "chrome/browser/download/download_request_dialog_delegate.h" |
10 #include "chrome/browser/tab_contents/navigation_controller.h" | 10 #include "chrome/browser/tab_contents/navigation_controller.h" |
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
59 } | 59 } |
60 | 60 |
61 void DownloadRequestManager::TabDownloadState::PromptUserForDownload( | 61 void DownloadRequestManager::TabDownloadState::PromptUserForDownload( |
62 TabContents* tab, | 62 TabContents* tab, |
63 DownloadRequestManager::Callback* callback) { | 63 DownloadRequestManager::Callback* callback) { |
64 callbacks_.push_back(callback); | 64 callbacks_.push_back(callback); |
65 | 65 |
66 if (is_showing_prompt()) | 66 if (is_showing_prompt()) |
67 return; // Already showing prompt. | 67 return; // Already showing prompt. |
68 | 68 |
69 if (DownloadRequestManager::delegate_) | 69 if (DownloadRequestManager::delegate_) { |
70 NotifyCallbacks(DownloadRequestManager::delegate_->ShouldAllowDownload()); | 70 NotifyCallbacks(DownloadRequestManager::delegate_->ShouldAllowDownload()); |
71 else | 71 } else { |
72 dialog_delegate_ = DownloadRequestDialogDelegate::Create(tab, this); | 72 dialog_delegate_ = DownloadRequestDialogDelegate::Create(tab, this); |
| 73 // TODO(estade): the dialog delegate isn't yet implemented on linux. Just |
| 74 // assume we shouldn't allow the download. |
| 75 if (dialog_delegate_ == NULL) |
| 76 NotifyCallbacks(false); |
| 77 } |
73 } | 78 } |
74 | 79 |
75 void DownloadRequestManager::TabDownloadState::Cancel() { | 80 void DownloadRequestManager::TabDownloadState::Cancel() { |
76 NotifyCallbacks(false); | 81 NotifyCallbacks(false); |
77 } | 82 } |
78 | 83 |
79 void DownloadRequestManager::TabDownloadState::Accept() { | 84 void DownloadRequestManager::TabDownloadState::Accept() { |
80 NotifyCallbacks(true); | 85 NotifyCallbacks(true); |
81 } | 86 } |
82 | 87 |
(...skipping 213 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
296 | 301 |
297 void DownloadRequestManager::Remove(TabDownloadState* state) { | 302 void DownloadRequestManager::Remove(TabDownloadState* state) { |
298 DCHECK(state_map_.find(state->controller()) != state_map_.end()); | 303 DCHECK(state_map_.find(state->controller()) != state_map_.end()); |
299 state_map_.erase(state->controller()); | 304 state_map_.erase(state->controller()); |
300 delete state; | 305 delete state; |
301 } | 306 } |
302 | 307 |
303 // static | 308 // static |
304 DownloadRequestManager::TestingDelegate* DownloadRequestManager::delegate_ = | 309 DownloadRequestManager::TestingDelegate* DownloadRequestManager::delegate_ = |
305 NULL; | 310 NULL; |
OLD | NEW |