OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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/incident_reporting/resource_request_detec
tor.h" | 5 #include "chrome/browser/safe_browsing/incident_reporting/resource_request_detec
tor.h" |
6 | 6 |
| 7 #include <utility> |
| 8 |
7 #include "chrome/browser/profiles/profile.h" | 9 #include "chrome/browser/profiles/profile.h" |
8 #include "chrome/browser/safe_browsing/incident_reporting/incident_receiver.h" | 10 #include "chrome/browser/safe_browsing/incident_reporting/incident_receiver.h" |
9 #include "chrome/browser/safe_browsing/incident_reporting/resource_request_incid
ent.h" | 11 #include "chrome/browser/safe_browsing/incident_reporting/resource_request_incid
ent.h" |
10 #include "chrome/common/safe_browsing/csd.pb.h" | 12 #include "chrome/common/safe_browsing/csd.pb.h" |
11 #include "content/public/browser/browser_thread.h" | 13 #include "content/public/browser/browser_thread.h" |
12 #include "content/public/browser/render_frame_host.h" | 14 #include "content/public/browser/render_frame_host.h" |
13 #include "content/public/browser/render_process_host.h" | 15 #include "content/public/browser/render_process_host.h" |
14 #include "content/public/browser/resource_request_info.h" | 16 #include "content/public/browser/resource_request_info.h" |
15 #include "content/public/browser/site_instance.h" | 17 #include "content/public/browser/site_instance.h" |
16 #include "crypto/sha2.h" | 18 #include "crypto/sha2.h" |
(...skipping 227 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
244 return render_frame_host->GetLastCommittedURL(); | 246 return render_frame_host->GetLastCommittedURL(); |
245 return GURL(); | 247 return GURL(); |
246 } | 248 } |
247 | 249 |
248 } // namespace | 250 } // namespace |
249 | 251 |
250 namespace safe_browsing { | 252 namespace safe_browsing { |
251 | 253 |
252 ResourceRequestDetector::ResourceRequestDetector( | 254 ResourceRequestDetector::ResourceRequestDetector( |
253 scoped_ptr<IncidentReceiver> incident_receiver) | 255 scoped_ptr<IncidentReceiver> incident_receiver) |
254 : incident_receiver_(incident_receiver.Pass()), | 256 : incident_receiver_(std::move(incident_receiver)), |
255 allow_null_profile_for_testing_(false), | 257 allow_null_profile_for_testing_(false), |
256 weak_ptr_factory_(this) { | 258 weak_ptr_factory_(this) { |
257 InitializeHashSets(); | 259 InitializeHashSets(); |
258 } | 260 } |
259 | 261 |
260 ResourceRequestDetector::~ResourceRequestDetector() { | 262 ResourceRequestDetector::~ResourceRequestDetector() { |
261 } | 263 } |
262 | 264 |
263 void ResourceRequestDetector::OnResourceRequest( | 265 void ResourceRequestDetector::OnResourceRequest( |
264 const net::URLRequest* request) { | 266 const net::URLRequest* request) { |
(...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
372 | 374 |
373 Profile* profile = GetProfileForRenderProcessId(render_process_id); | 375 Profile* profile = GetProfileForRenderProcessId(render_process_id); |
374 if (profile || allow_null_profile_for_testing_) { | 376 if (profile || allow_null_profile_for_testing_) { |
375 // Add the URL obtained from the RenderFrameHost, if available. | 377 // Add the URL obtained from the RenderFrameHost, if available. |
376 GURL host_url = GetUrlForRenderFrameId(render_process_id, render_frame_id); | 378 GURL host_url = GetUrlForRenderFrameId(render_process_id, render_frame_id); |
377 if (host_url.is_valid()) | 379 if (host_url.is_valid()) |
378 incident_data->set_origin(host_url.GetOrigin().spec()); | 380 incident_data->set_origin(host_url.GetOrigin().spec()); |
379 | 381 |
380 incident_receiver_->AddIncidentForProfile( | 382 incident_receiver_->AddIncidentForProfile( |
381 profile, | 383 profile, |
382 make_scoped_ptr(new ResourceRequestIncident(incident_data.Pass()))); | 384 make_scoped_ptr(new ResourceRequestIncident(std::move(incident_data)))); |
383 } | 385 } |
384 } | 386 } |
385 | 387 |
386 } // namespace safe_browsing | 388 } // namespace safe_browsing |
OLD | NEW |