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

Side by Side Diff: chrome/browser/safe_browsing/incident_reporting/variations_seed_signature_analyzer.cc

Issue 1870003002: Convert //chrome/browser/safe_browsing from scoped_ptr to std::unique_ptr (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase and address comments Created 4 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 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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/variations_seed_signat ure_analyzer.h" 5 #include "chrome/browser/safe_browsing/incident_reporting/variations_seed_signat ure_analyzer.h"
6 6
7 #include <string> 7 #include <string>
8 #include <utility> 8 #include <utility>
9 9
10 #include "base/bind.h" 10 #include "base/bind.h"
11 #include "base/location.h" 11 #include "base/location.h"
12 #include "base/memory/ptr_util.h"
12 #include "chrome/browser/browser_process.h" 13 #include "chrome/browser/browser_process.h"
13 #include "chrome/browser/safe_browsing/incident_reporting/incident_receiver.h" 14 #include "chrome/browser/safe_browsing/incident_reporting/incident_receiver.h"
14 #include "chrome/browser/safe_browsing/incident_reporting/variations_seed_signat ure_incident.h" 15 #include "chrome/browser/safe_browsing/incident_reporting/variations_seed_signat ure_incident.h"
15 #include "chrome/browser/safe_browsing/safe_browsing_service.h" 16 #include "chrome/browser/safe_browsing/safe_browsing_service.h"
16 #include "chrome/common/safe_browsing/csd.pb.h" 17 #include "chrome/common/safe_browsing/csd.pb.h"
17 #include "components/variations/service/variations_service.h" 18 #include "components/variations/service/variations_service.h"
18 #include "content/public/browser/browser_thread.h" 19 #include "content/public/browser/browser_thread.h"
19 20
20 namespace safe_browsing { 21 namespace safe_browsing {
21 22
22 namespace { 23 namespace {
23 24
24 void VerifyVariationsSeedSignatureOnUIThread( 25 void VerifyVariationsSeedSignatureOnUIThread(
25 scoped_ptr<IncidentReceiver> incident_receiver) { 26 std::unique_ptr<IncidentReceiver> incident_receiver) {
26 variations::VariationsService* variations_service = 27 variations::VariationsService* variations_service =
27 g_browser_process->variations_service(); 28 g_browser_process->variations_service();
28 if (!variations_service) 29 if (!variations_service)
29 return; 30 return;
30 std::string invalid_signature = 31 std::string invalid_signature =
31 variations_service->GetInvalidVariationsSeedSignature(); 32 variations_service->GetInvalidVariationsSeedSignature();
32 if (!invalid_signature.empty()) { 33 if (!invalid_signature.empty()) {
33 scoped_ptr< 34 std::unique_ptr<
34 ClientIncidentReport_IncidentData_VariationsSeedSignatureIncident> 35 ClientIncidentReport_IncidentData_VariationsSeedSignatureIncident>
35 variations_seed_signature( 36 variations_seed_signature(
36 new ClientIncidentReport_IncidentData_VariationsSeedSignatureInciden t()); 37 new ClientIncidentReport_IncidentData_VariationsSeedSignatureInciden t());
37 variations_seed_signature->set_variations_seed_signature(invalid_signature); 38 variations_seed_signature->set_variations_seed_signature(invalid_signature);
38 incident_receiver->AddIncidentForProcess( 39 incident_receiver->AddIncidentForProcess(
39 make_scoped_ptr(new VariationsSeedSignatureIncident( 40 base::WrapUnique(new VariationsSeedSignatureIncident(
40 std::move(variations_seed_signature)))); 41 std::move(variations_seed_signature))));
41 } 42 }
42 } 43 }
43 44
44 } // namespace 45 } // namespace
45 46
46 void RegisterVariationsSeedSignatureAnalysis() { 47 void RegisterVariationsSeedSignatureAnalysis() {
47 scoped_refptr<SafeBrowsingService> safe_browsing_service( 48 scoped_refptr<SafeBrowsingService> safe_browsing_service(
48 g_browser_process->safe_browsing_service()); 49 g_browser_process->safe_browsing_service());
49 50
50 safe_browsing_service->RegisterDelayedAnalysisCallback( 51 safe_browsing_service->RegisterDelayedAnalysisCallback(
51 base::Bind(&VerifyVariationsSeedSignature)); 52 base::Bind(&VerifyVariationsSeedSignature));
52 } 53 }
53 54
54 void VerifyVariationsSeedSignature( 55 void VerifyVariationsSeedSignature(
55 scoped_ptr<IncidentReceiver> incident_receiver) { 56 std::unique_ptr<IncidentReceiver> incident_receiver) {
56 content::BrowserThread::PostTask( 57 content::BrowserThread::PostTask(
57 content::BrowserThread::UI, 58 content::BrowserThread::UI,
58 FROM_HERE, 59 FROM_HERE,
59 base::Bind(&VerifyVariationsSeedSignatureOnUIThread, 60 base::Bind(&VerifyVariationsSeedSignatureOnUIThread,
60 base::Passed(&incident_receiver))); 61 base::Passed(&incident_receiver)));
61 } 62 }
62 63
63 } // namespace safe_browsing 64 } // namespace safe_browsing
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698