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/chrome_download_manager_delegate.h" | 5 #include "chrome/browser/download/chrome_download_manager_delegate.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/bind_helpers.h" | 8 #include "base/bind_helpers.h" |
9 #include "base/callback.h" | 9 #include "base/callback.h" |
10 #include "base/file_util.h" | 10 #include "base/file_util.h" |
(...skipping 368 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
379 state.prompt_user_for_save_location = true; | 379 state.prompt_user_for_save_location = true; |
380 } | 380 } |
381 if (download_prefs_->IsDownloadPathManaged()) { | 381 if (download_prefs_->IsDownloadPathManaged()) { |
382 state.prompt_user_for_save_location = false; | 382 state.prompt_user_for_save_location = false; |
383 } | 383 } |
384 | 384 |
385 // Determine the proper path for a download, by either one of the following: | 385 // Determine the proper path for a download, by either one of the following: |
386 // 1) using the default download directory. | 386 // 1) using the default download directory. |
387 // 2) prompting the user. | 387 // 2) prompting the user. |
388 if (state.prompt_user_for_save_location && | 388 if (state.prompt_user_for_save_location && |
389 !download_manager_->last_download_path().empty()) { | 389 !download_manager_->LastDownloadPath().empty()) { |
390 state.suggested_path = download_manager_->last_download_path(); | 390 state.suggested_path = download_manager_->LastDownloadPath(); |
391 } else { | 391 } else { |
392 state.suggested_path = download_prefs_->download_path(); | 392 state.suggested_path = download_prefs_->download_path(); |
393 } | 393 } |
394 state.suggested_path = state.suggested_path.Append(generated_name); | 394 state.suggested_path = state.suggested_path.Append(generated_name); |
395 } else { | 395 } else { |
396 state.suggested_path = state.force_file_name; | 396 state.suggested_path = state.force_file_name; |
397 } | 397 } |
398 | 398 |
399 if (!state.prompt_user_for_save_location && state.force_file_name.empty()) { | 399 if (!state.prompt_user_for_save_location && state.force_file_name.empty()) { |
400 state.is_dangerous_file = | 400 state.is_dangerous_file = |
(...skipping 159 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
560 // TODO(noelutz): This function currently works as a callback place holder. | 560 // TODO(noelutz): This function currently works as a callback place holder. |
561 // Once we decide the hash check is reliable, we could move the | 561 // Once we decide the hash check is reliable, we could move the |
562 // MaybeCompleteDownload in OnAllDataSaved to this function. | 562 // MaybeCompleteDownload in OnAllDataSaved to this function. |
563 void ChromeDownloadManagerDelegate::CheckDownloadHashDone( | 563 void ChromeDownloadManagerDelegate::CheckDownloadHashDone( |
564 int32 download_id, | 564 int32 download_id, |
565 bool is_dangerous_hash) { | 565 bool is_dangerous_hash) { |
566 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 566 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
567 DVLOG(1) << "CheckDownloadHashDone, download_id: " << download_id | 567 DVLOG(1) << "CheckDownloadHashDone, download_id: " << download_id |
568 << " is dangerous_hash: " << is_dangerous_hash; | 568 << " is dangerous_hash: " << is_dangerous_hash; |
569 } | 569 } |
OLD | NEW |