OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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_manager.h" | 5 #include "chrome/browser/download/download_manager.h" |
6 | 6 |
7 #include "base/callback.h" | 7 #include "base/callback.h" |
8 #include "base/file_util.h" | 8 #include "base/file_util.h" |
9 #include "base/logging.h" | 9 #include "base/logging.h" |
10 #include "base/path_service.h" | 10 #include "base/path_service.h" |
(...skipping 271 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
282 } else { | 282 } else { |
283 info->suggested_path = download_prefs_->download_path(); | 283 info->suggested_path = download_prefs_->download_path(); |
284 } | 284 } |
285 info->suggested_path = info->suggested_path.Append(generated_name); | 285 info->suggested_path = info->suggested_path.Append(generated_name); |
286 } else { | 286 } else { |
287 info->suggested_path = info->save_info.file_path; | 287 info->suggested_path = info->save_info.file_path; |
288 } | 288 } |
289 | 289 |
290 if (!info->prompt_user_for_save_location && | 290 if (!info->prompt_user_for_save_location && |
291 info->save_info.file_path.empty()) { | 291 info->save_info.file_path.empty()) { |
292 info->is_dangerous = download_util::IsDangerous(info, profile()); | 292 info->is_dangerous = download_util::IsDangerous( |
| 293 info, profile(), ShouldOpenFileBasedOnExtension(info->suggested_path)); |
293 } | 294 } |
294 | 295 |
295 // We need to move over to the download thread because we don't want to stat | 296 // We need to move over to the download thread because we don't want to stat |
296 // the suggested path on the UI thread. | 297 // the suggested path on the UI thread. |
297 // We can only access preferences on the UI thread, so check the download path | 298 // We can only access preferences on the UI thread, so check the download path |
298 // now and pass the value to the FILE thread. | 299 // now and pass the value to the FILE thread. |
299 BrowserThread::PostTask( | 300 BrowserThread::PostTask( |
300 BrowserThread::FILE, FROM_HERE, | 301 BrowserThread::FILE, FROM_HERE, |
301 NewRunnableMethod( | 302 NewRunnableMethod( |
302 this, | 303 this, |
(...skipping 826 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1129 observed_download_manager_->RemoveObserver(this); | 1130 observed_download_manager_->RemoveObserver(this); |
1130 } | 1131 } |
1131 | 1132 |
1132 void DownloadManager::OtherDownloadManagerObserver::ModelChanged() { | 1133 void DownloadManager::OtherDownloadManagerObserver::ModelChanged() { |
1133 observing_download_manager_->NotifyModelChanged(); | 1134 observing_download_manager_->NotifyModelChanged(); |
1134 } | 1135 } |
1135 | 1136 |
1136 void DownloadManager::OtherDownloadManagerObserver::ManagerGoingDown() { | 1137 void DownloadManager::OtherDownloadManagerObserver::ManagerGoingDown() { |
1137 observed_download_manager_ = NULL; | 1138 observed_download_manager_ = NULL; |
1138 } | 1139 } |
OLD | NEW |