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

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

Issue 17948002: Update Linux to use scoped_refptr<T>::get() rather than implicit "operator T*" (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebased 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/download_feedback_service.h" 5 #include "chrome/browser/safe_browsing/download_feedback_service.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/command_line.h" 8 #include "base/command_line.h"
9 #include "base/files/file_path.h" 9 #include "base/files/file_path.h"
10 #include "base/files/file_util_proxy.h" 10 #include "base/files/file_util_proxy.h"
(...skipping 159 matching lines...) Expand 10 before | Expand all | Expand 10 after
170 // static 170 // static
171 void DownloadFeedbackService::BeginFeedbackOrDeleteFile( 171 void DownloadFeedbackService::BeginFeedbackOrDeleteFile(
172 const scoped_refptr<base::TaskRunner>& file_task_runner, 172 const scoped_refptr<base::TaskRunner>& file_task_runner,
173 const base::WeakPtr<DownloadFeedbackService>& service, 173 const base::WeakPtr<DownloadFeedbackService>& service,
174 const std::string& ping_request, 174 const std::string& ping_request,
175 const std::string& ping_response, 175 const std::string& ping_response,
176 const base::FilePath& path) { 176 const base::FilePath& path) {
177 if (service) { 177 if (service) {
178 service->BeginFeedback(ping_request, ping_response, path); 178 service->BeginFeedback(ping_request, ping_response, path);
179 } else { 179 } else {
180 base::FileUtilProxy::Delete(file_task_runner, path, false, 180 base::FileUtilProxy::Delete(file_task_runner.get(),
181 path,
182 false,
181 base::FileUtilProxy::StatusCallback()); 183 base::FileUtilProxy::StatusCallback());
182 } 184 }
183 } 185 }
184 186
185 void DownloadFeedbackService::StartPendingFeedback() { 187 void DownloadFeedbackService::StartPendingFeedback() {
186 DCHECK(!active_feedback_.empty()); 188 DCHECK(!active_feedback_.empty());
187 active_feedback_.front()->Start(base::Bind( 189 active_feedback_.front()->Start(base::Bind(
188 &DownloadFeedbackService::FeedbackComplete, base::Unretained(this))); 190 &DownloadFeedbackService::FeedbackComplete, base::Unretained(this)));
189 } 191 }
190 192
191 void DownloadFeedbackService::BeginFeedback( 193 void DownloadFeedbackService::BeginFeedback(
192 const std::string& ping_request, 194 const std::string& ping_request,
193 const std::string& ping_response, 195 const std::string& ping_response,
194 const base::FilePath& path) { 196 const base::FilePath& path) {
195 DCHECK(CalledOnValidThread()); 197 DCHECK(CalledOnValidThread());
196 DownloadFeedback* feedback = DownloadFeedback::Create( 198 DownloadFeedback* feedback =
197 request_context_getter_, file_task_runner_, path, 199 DownloadFeedback::Create(request_context_getter_.get(),
198 ping_request, ping_response); 200 file_task_runner_.get(),
201 path,
202 ping_request,
203 ping_response);
199 active_feedback_.push_back(feedback); 204 active_feedback_.push_back(feedback);
200 UMA_HISTOGRAM_COUNTS_100("SBDownloadFeedback.ActiveFeedbacks", 205 UMA_HISTOGRAM_COUNTS_100("SBDownloadFeedback.ActiveFeedbacks",
201 active_feedback_.size()); 206 active_feedback_.size());
202 207
203 if (active_feedback_.size() == 1) 208 if (active_feedback_.size() == 1)
204 StartPendingFeedback(); 209 StartPendingFeedback();
205 } 210 }
206 211
207 void DownloadFeedbackService::FeedbackComplete() { 212 void DownloadFeedbackService::FeedbackComplete() {
208 DVLOG(1) << __FUNCTION__; 213 DVLOG(1) << __FUNCTION__;
209 DCHECK(CalledOnValidThread()); 214 DCHECK(CalledOnValidThread());
210 DCHECK(!active_feedback_.empty()); 215 DCHECK(!active_feedback_.empty());
211 active_feedback_.erase(active_feedback_.begin()); 216 active_feedback_.erase(active_feedback_.begin());
212 if (!active_feedback_.empty()) 217 if (!active_feedback_.empty())
213 StartPendingFeedback(); 218 StartPendingFeedback();
214 } 219 }
215 220
216 } // namespace safe_browsing 221 } // namespace safe_browsing
OLDNEW
« no previous file with comments | « chrome/browser/safe_browsing/download_feedback.cc ('k') | chrome/browser/safe_browsing/download_feedback_service_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698