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

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

Issue 2719833002: Convert TrackedPreferenceValidationDelegate into a mojo interface. (Closed)
Patch Set: Created 3 years, 9 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/incident_reporting_ser vice.h" 5 #include "chrome/browser/safe_browsing/incident_reporting/incident_reporting_ser vice.h"
6 6
7 #include <math.h> 7 #include <math.h>
8 #include <stddef.h> 8 #include <stddef.h>
9 9
10 #include <algorithm> 10 #include <algorithm>
(...skipping 20 matching lines...) Expand all
31 #include "chrome/browser/safe_browsing/incident_reporting/incident_report_upload er_impl.h" 31 #include "chrome/browser/safe_browsing/incident_reporting/incident_report_upload er_impl.h"
32 #include "chrome/browser/safe_browsing/incident_reporting/preference_validation_ delegate.h" 32 #include "chrome/browser/safe_browsing/incident_reporting/preference_validation_ delegate.h"
33 #include "chrome/browser/safe_browsing/incident_reporting/state_store.h" 33 #include "chrome/browser/safe_browsing/incident_reporting/state_store.h"
34 #include "chrome/browser/safe_browsing/safe_browsing_service.h" 34 #include "chrome/browser/safe_browsing/safe_browsing_service.h"
35 #include "chrome/common/chrome_features.h" 35 #include "chrome/common/chrome_features.h"
36 #include "chrome/common/pref_names.h" 36 #include "chrome/common/pref_names.h"
37 #include "chrome/common/safe_browsing/csd.pb.h" 37 #include "chrome/common/safe_browsing/csd.pb.h"
38 #include "components/prefs/pref_service.h" 38 #include "components/prefs/pref_service.h"
39 #include "components/safe_browsing_db/database_manager.h" 39 #include "components/safe_browsing_db/database_manager.h"
40 #include "components/safe_browsing_db/safe_browsing_prefs.h" 40 #include "components/safe_browsing_db/safe_browsing_prefs.h"
41 #include "components/user_prefs/tracked/tracked_preference_validation_delegate.h "
42 #include "content/public/browser/browser_thread.h" 41 #include "content/public/browser/browser_thread.h"
43 #include "content/public/browser/notification_service.h" 42 #include "content/public/browser/notification_service.h"
44 #include "net/url_request/url_request_context_getter.h" 43 #include "net/url_request/url_request_context_getter.h"
44 #include "services/preferences/public/interfaces/tracked_preference_validation_d elegate.mojom.h"
45 45
46 namespace safe_browsing { 46 namespace safe_browsing {
47 47
48 #if !defined(GOOGLE_CHROME_BUILD) 48 #if !defined(GOOGLE_CHROME_BUILD)
49 // Chromium-only flag to disable incident uploads. 49 // Chromium-only flag to disable incident uploads.
50 extern const base::Feature kIncidentReportingDisableUpload{ 50 extern const base::Feature kIncidentReportingDisableUpload{
51 "IncidentReportingDisableUpload", base::FEATURE_ENABLED_BY_DEFAULT}; 51 "IncidentReportingDisableUpload", base::FEATURE_ENABLED_BY_DEFAULT};
52 #endif 52 #endif
53 53
54 namespace { 54 namespace {
(...skipping 304 matching lines...) Expand 10 before | Expand all | Expand 10 after
359 CancelEnvironmentCollection(); 359 CancelEnvironmentCollection();
360 CancelDownloadCollection(); 360 CancelDownloadCollection();
361 CancelAllReportUploads(); 361 CancelAllReportUploads();
362 } 362 }
363 363
364 std::unique_ptr<IncidentReceiver> 364 std::unique_ptr<IncidentReceiver>
365 IncidentReportingService::GetIncidentReceiver() { 365 IncidentReportingService::GetIncidentReceiver() {
366 return base::MakeUnique<Receiver>(receiver_weak_ptr_factory_.GetWeakPtr()); 366 return base::MakeUnique<Receiver>(receiver_weak_ptr_factory_.GetWeakPtr());
367 } 367 }
368 368
369 std::unique_ptr<TrackedPreferenceValidationDelegate> 369 std::unique_ptr<prefs::mojom::TrackedPreferenceValidationDelegate>
370 IncidentReportingService::CreatePreferenceValidationDelegate(Profile* profile) { 370 IncidentReportingService::CreatePreferenceValidationDelegate(Profile* profile) {
371 DCHECK_CURRENTLY_ON(content::BrowserThread::UI); 371 DCHECK_CURRENTLY_ON(content::BrowserThread::UI);
372 372
373 if (profile->IsOffTheRecord()) 373 if (profile->IsOffTheRecord())
374 return std::unique_ptr<TrackedPreferenceValidationDelegate>(); 374 return std::unique_ptr<prefs::mojom::TrackedPreferenceValidationDelegate>();
375 return std::unique_ptr<TrackedPreferenceValidationDelegate>( 375 return base::MakeUnique<PreferenceValidationDelegate>(profile,
376 new PreferenceValidationDelegate(profile, GetIncidentReceiver())); 376 GetIncidentReceiver());
377 } 377 }
378 378
379 void IncidentReportingService::RegisterDelayedAnalysisCallback( 379 void IncidentReportingService::RegisterDelayedAnalysisCallback(
380 const DelayedAnalysisCallback& callback) { 380 const DelayedAnalysisCallback& callback) {
381 DCHECK_CURRENTLY_ON(content::BrowserThread::UI); 381 DCHECK_CURRENTLY_ON(content::BrowserThread::UI);
382 382
383 // |callback| will be run on the blocking pool. The receiver will bounce back 383 // |callback| will be run on the blocking pool. The receiver will bounce back
384 // to the origin thread if needed. 384 // to the origin thread if needed.
385 delayed_analysis_callbacks_.RegisterCallback( 385 delayed_analysis_callbacks_.RegisterCallback(
386 base::Bind(callback, base::Passed(GetIncidentReceiver()))); 386 base::Bind(callback, base::Passed(GetIncidentReceiver())));
(...skipping 667 matching lines...) Expand 10 before | Expand all | Expand 10 after
1054 if (!profile->IsOffTheRecord()) 1054 if (!profile->IsOffTheRecord())
1055 OnProfileDestroyed(profile); 1055 OnProfileDestroyed(profile);
1056 break; 1056 break;
1057 } 1057 }
1058 default: 1058 default:
1059 break; 1059 break;
1060 } 1060 }
1061 } 1061 }
1062 1062
1063 } // namespace safe_browsing 1063 } // namespace safe_browsing
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698