OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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/safe_browsing/two_phase_uploader.h" | 5 #include "chrome/browser/safe_browsing/two_phase_uploader.h" |
6 | 6 |
| 7 #include "base/basictypes.h" |
7 #include "base/bind.h" | 8 #include "base/bind.h" |
8 #include "base/task_runner.h" | 9 #include "base/task_runner.h" |
9 #include "net/base/net_errors.h" | 10 #include "net/base/net_errors.h" |
10 #include "net/http/http_response_headers.h" | 11 #include "net/http/http_response_headers.h" |
11 #include "net/url_request/url_fetcher.h" | 12 #include "net/url_request/url_fetcher.h" |
12 #include "net/url_request/url_request_status.h" | 13 #include "net/url_request/url_request_status.h" |
13 | 14 |
14 namespace { | 15 namespace { |
15 | 16 |
16 // Header sent on initial request to start the two phase upload process. | 17 // Header sent on initial request to start the two phase upload process. |
(...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
127 | 128 |
128 void TwoPhaseUploader::UploadFile() { | 129 void TwoPhaseUploader::UploadFile() { |
129 DCHECK(CalledOnValidThread()); | 130 DCHECK(CalledOnValidThread()); |
130 state_ = UPLOAD_FILE; | 131 state_ = UPLOAD_FILE; |
131 | 132 |
132 url_fetcher_.reset(net::URLFetcher::Create(upload_url_, net::URLFetcher::PUT, | 133 url_fetcher_.reset(net::URLFetcher::Create(upload_url_, net::URLFetcher::PUT, |
133 this)); | 134 this)); |
134 url_fetcher_->SetRequestContext(url_request_context_getter_); | 135 url_fetcher_->SetRequestContext(url_request_context_getter_); |
135 url_fetcher_->SetUploadFilePath(kUploadContentType, | 136 url_fetcher_->SetUploadFilePath(kUploadContentType, |
136 file_path_, | 137 file_path_, |
| 138 0, |
| 139 kuint64max, |
137 file_task_runner_); | 140 file_task_runner_); |
138 url_fetcher_->Start(); | 141 url_fetcher_->Start(); |
139 } | 142 } |
140 | 143 |
141 void TwoPhaseUploader::Finish(int net_error, | 144 void TwoPhaseUploader::Finish(int net_error, |
142 int response_code, | 145 int response_code, |
143 const std::string& response) { | 146 const std::string& response) { |
144 DCHECK(CalledOnValidThread()); | 147 DCHECK(CalledOnValidThread()); |
145 finish_callback_.Run(state_, net_error, response_code, response); | 148 finish_callback_.Run(state_, net_error, response_code, response); |
146 } | 149 } |
OLD | NEW |