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

Side by Side Diff: chrome/browser/safe_browsing/two_phase_uploader.cc

Issue 15881012: Implement safebrowsing download feedback service, enabled for dev & canary only. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase Created 7 years, 6 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 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/basictypes.h"
8 #include "base/bind.h" 8 #include "base/bind.h"
9 #include "base/task_runner.h" 9 #include "base/task_runner.h"
10 #include "net/base/net_errors.h" 10 #include "net/base/net_errors.h"
(...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after
146 }; 146 };
147 } 147 }
148 148
149 void TwoPhaseUploaderImpl::OnURLFetchUploadProgress( 149 void TwoPhaseUploaderImpl::OnURLFetchUploadProgress(
150 const net::URLFetcher* source, 150 const net::URLFetcher* source,
151 int64 current, 151 int64 current,
152 int64 total) { 152 int64 total) {
153 DCHECK(CalledOnValidThread()); 153 DCHECK(CalledOnValidThread());
154 DVLOG(3) << __FUNCTION__ << " " << source->GetURL().spec() 154 DVLOG(3) << __FUNCTION__ << " " << source->GetURL().spec()
155 << " " << current << "/" << total; 155 << " " << current << "/" << total;
156 if (state_ == UPLOAD_FILE) 156 if (state_ == UPLOAD_FILE && !progress_callback_.is_null())
157 progress_callback_.Run(current, total); 157 progress_callback_.Run(current, total);
158 } 158 }
159 159
160 void TwoPhaseUploaderImpl::UploadMetadata() { 160 void TwoPhaseUploaderImpl::UploadMetadata() {
161 DCHECK(CalledOnValidThread()); 161 DCHECK(CalledOnValidThread());
162 state_ = UPLOAD_METADATA; 162 state_ = UPLOAD_METADATA;
163 url_fetcher_.reset(net::URLFetcher::Create(base_url_, net::URLFetcher::POST, 163 url_fetcher_.reset(net::URLFetcher::Create(base_url_, net::URLFetcher::POST,
164 this)); 164 this));
165 url_fetcher_->SetRequestContext(url_request_context_getter_.get()); 165 url_fetcher_->SetRequestContext(url_request_context_getter_.get());
166 url_fetcher_->SetExtraRequestHeaders(kStartHeader); 166 url_fetcher_->SetExtraRequestHeaders(kStartHeader);
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
202 const ProgressCallback& progress_callback, 202 const ProgressCallback& progress_callback,
203 const FinishCallback& finish_callback) { 203 const FinishCallback& finish_callback) {
204 if (!TwoPhaseUploader::factory_) 204 if (!TwoPhaseUploader::factory_)
205 return new TwoPhaseUploaderImpl( 205 return new TwoPhaseUploaderImpl(
206 url_request_context_getter, file_task_runner, base_url, metadata, 206 url_request_context_getter, file_task_runner, base_url, metadata,
207 file_path, progress_callback, finish_callback); 207 file_path, progress_callback, finish_callback);
208 return TwoPhaseUploader::factory_->CreateTwoPhaseUploader( 208 return TwoPhaseUploader::factory_->CreateTwoPhaseUploader(
209 url_request_context_getter, file_task_runner, base_url, metadata, 209 url_request_context_getter, file_task_runner, base_url, metadata,
210 file_path, progress_callback, finish_callback); 210 file_path, progress_callback, finish_callback);
211 } 211 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698