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

Side by Side Diff: content/browser/download/download_file_impl.cc

Issue 148133007: [Downloads] Always call DM::StartDownload() for explicit downloads. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Comment updates Created 4 years, 10 months 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) 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 "content/browser/download/download_file_impl.h" 5 #include "content/browser/download/download_file_impl.h"
6 6
7 #include <string> 7 #include <string>
8 #include <utility> 8 #include <utility>
9 9
10 #include "base/bind.h" 10 #include "base/bind.h"
(...skipping 17 matching lines...) Expand all
28 28
29 // These constants control the default retry behavior for failing renames. Each 29 // These constants control the default retry behavior for failing renames. Each
30 // retry is performed after a delay that is twice the previous delay. The 30 // retry is performed after a delay that is twice the previous delay. The
31 // initial delay is specified by kInitialRenameRetryDelayMs. 31 // initial delay is specified by kInitialRenameRetryDelayMs.
32 const int kMaxRenameRetries = 3; 32 const int kMaxRenameRetries = 3;
33 const int kInitialRenameRetryDelayMs = 200; 33 const int kInitialRenameRetryDelayMs = 200;
34 34
35 int DownloadFile::number_active_objects_ = 0; 35 int DownloadFile::number_active_objects_ = 0;
36 36
37 DownloadFileImpl::DownloadFileImpl( 37 DownloadFileImpl::DownloadFileImpl(
38 scoped_ptr<DownloadSaveInfo> save_info, 38 const DownloadSaveInfo& save_info,
39 const base::FilePath& default_download_directory, 39 const base::FilePath& default_download_directory,
40 const GURL& url, 40 const GURL& url,
41 const GURL& referrer_url, 41 const GURL& referrer_url,
42 bool calculate_hash, 42 bool calculate_hash,
43 base::File file,
43 scoped_ptr<ByteStreamReader> stream, 44 scoped_ptr<ByteStreamReader> stream,
44 const net::BoundNetLog& bound_net_log, 45 const net::BoundNetLog& bound_net_log,
45 base::WeakPtr<DownloadDestinationObserver> observer) 46 base::WeakPtr<DownloadDestinationObserver> observer)
46 : file_(save_info->file_path, 47 : file_(save_info.file_path,
47 url, 48 url,
48 referrer_url, 49 referrer_url,
49 save_info->offset, 50 save_info.offset,
50 calculate_hash, 51 calculate_hash,
51 save_info->hash_state, 52 save_info.hash_state,
52 std::move(save_info->file), 53 std::move(file),
53 bound_net_log), 54 bound_net_log),
54 default_download_directory_(default_download_directory), 55 default_download_directory_(default_download_directory),
55 stream_reader_(std::move(stream)), 56 stream_reader_(std::move(stream)),
56 bytes_seen_(0), 57 bytes_seen_(0),
57 bound_net_log_(bound_net_log), 58 bound_net_log_(bound_net_log),
58 observer_(observer), 59 observer_(observer),
59 weak_factory_(this) {} 60 weak_factory_(this) {}
60 61
61 DownloadFileImpl::~DownloadFileImpl() { 62 DownloadFileImpl::~DownloadFileImpl() {
62 DCHECK_CURRENTLY_ON(BrowserThread::FILE); 63 DCHECK_CURRENTLY_ON(BrowserThread::FILE);
(...skipping 292 matching lines...) Expand 10 before | Expand all | Expand 10 after
355 observer_, file_.bytes_so_far(), CurrentSpeed(), 356 observer_, file_.bytes_so_far(), CurrentSpeed(),
356 GetHashState())); 357 GetHashState()));
357 } 358 }
358 359
359 // static 360 // static
360 int DownloadFile::GetNumberOfDownloadFiles() { 361 int DownloadFile::GetNumberOfDownloadFiles() {
361 return number_active_objects_; 362 return number_active_objects_;
362 } 363 }
363 364
364 } // namespace content 365 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698