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

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

Issue 2821193005: Rewrite base::Bind to base::BindOnce with base_bind_rewriters in //chrome/browser/safe_browsing (Closed)
Patch Set: Created 3 years, 8 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
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 "chrome/browser/safe_browsing/client_side_detection_service.h" 5 #include "chrome/browser/safe_browsing/client_side_detection_service.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <memory> 8 #include <memory>
9 9
10 #include "base/bind.h" 10 #include "base/bind.h"
(...skipping 148 matching lines...) Expand 10 before | Expand all | Expand 10 after
159 } 159 }
160 } 160 }
161 161
162 void ClientSideDetectionService::SendClientReportPhishingRequest( 162 void ClientSideDetectionService::SendClientReportPhishingRequest(
163 ClientPhishingRequest* verdict, 163 ClientPhishingRequest* verdict,
164 bool is_extended_reporting, 164 bool is_extended_reporting,
165 const ClientReportPhishingRequestCallback& callback) { 165 const ClientReportPhishingRequestCallback& callback) {
166 DCHECK_CURRENTLY_ON(BrowserThread::UI); 166 DCHECK_CURRENTLY_ON(BrowserThread::UI);
167 base::ThreadTaskRunnerHandle::Get()->PostTask( 167 base::ThreadTaskRunnerHandle::Get()->PostTask(
168 FROM_HERE, 168 FROM_HERE,
169 base::Bind(&ClientSideDetectionService::StartClientReportPhishingRequest, 169 base::BindOnce(
170 weak_factory_.GetWeakPtr(), verdict, is_extended_reporting, 170 &ClientSideDetectionService::StartClientReportPhishingRequest,
171 callback)); 171 weak_factory_.GetWeakPtr(), verdict, is_extended_reporting,
172 callback));
172 } 173 }
173 174
174 void ClientSideDetectionService::SendClientReportMalwareRequest( 175 void ClientSideDetectionService::SendClientReportMalwareRequest(
175 ClientMalwareRequest* verdict, 176 ClientMalwareRequest* verdict,
176 const ClientReportMalwareRequestCallback& callback) { 177 const ClientReportMalwareRequestCallback& callback) {
177 DCHECK_CURRENTLY_ON(BrowserThread::UI); 178 DCHECK_CURRENTLY_ON(BrowserThread::UI);
178 base::ThreadTaskRunnerHandle::Get()->PostTask( 179 base::ThreadTaskRunnerHandle::Get()->PostTask(
179 FROM_HERE, 180 FROM_HERE,
180 base::Bind(&ClientSideDetectionService::StartClientReportMalwareRequest, 181 base::BindOnce(
181 weak_factory_.GetWeakPtr(), verdict, callback)); 182 &ClientSideDetectionService::StartClientReportMalwareRequest,
183 weak_factory_.GetWeakPtr(), verdict, callback));
182 } 184 }
183 185
184 bool ClientSideDetectionService::IsPrivateIPAddress( 186 bool ClientSideDetectionService::IsPrivateIPAddress(
185 const std::string& ip_address) const { 187 const std::string& ip_address) const {
186 net::IPAddress address; 188 net::IPAddress address;
187 if (!address.AssignFromIPLiteral(ip_address)) { 189 if (!address.AssignFromIPLiteral(ip_address)) {
188 DVLOG(2) << "Unable to parse IP address: '" << ip_address << "'"; 190 DVLOG(2) << "Unable to parse IP address: '" << ip_address << "'";
189 // Err on the side of safety and assume this might be private. 191 // Err on the side of safety and assume this might be private.
190 return true; 192 return true;
191 } 193 }
(...skipping 325 matching lines...) Expand 10 before | Expand all | Expand 10 after
517 const std::string& report_url) { 519 const std::string& report_url) {
518 GURL url(report_url); 520 GURL url(report_url);
519 std::string api_key = google_apis::GetAPIKey(); 521 std::string api_key = google_apis::GetAPIKey();
520 if (!api_key.empty()) 522 if (!api_key.empty())
521 url = url.Resolve("?key=" + net::EscapeQueryParamValue(api_key, true)); 523 url = url.Resolve("?key=" + net::EscapeQueryParamValue(api_key, true));
522 524
523 return url; 525 return url;
524 } 526 }
525 527
526 } // namespace safe_browsing 528 } // namespace safe_browsing
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698