Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(148)

Side by Side Diff: chrome/browser/download/chrome_download_manager_delegate.cc

Issue 8351052: Created a DownloadManager interface, for use in unit tests.. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created a non-inlined destructor for MockDownloadManager. Created 9 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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
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
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 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698