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

Side by Side Diff: chrome/browser/safe_browsing/safe_browsing_service.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 (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/safe_browsing_service.h" 5 #include "chrome/browser/safe_browsing/safe_browsing_service.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 8
9 #include <vector> 9 #include <vector>
10 10
(...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after
122 void ServiceShuttingDown(); 122 void ServiceShuttingDown();
123 123
124 protected: 124 protected:
125 ~SafeBrowsingURLRequestContextGetter() override; 125 ~SafeBrowsingURLRequestContextGetter() override;
126 126
127 private: 127 private:
128 bool shut_down_; 128 bool shut_down_;
129 129
130 scoped_refptr<net::URLRequestContextGetter> system_context_getter_; 130 scoped_refptr<net::URLRequestContextGetter> system_context_getter_;
131 131
132 scoped_ptr<net::CookieStore> safe_browsing_cookie_store_; 132 std::unique_ptr<net::CookieStore> safe_browsing_cookie_store_;
133 133
134 scoped_ptr<net::URLRequestContext> safe_browsing_request_context_; 134 std::unique_ptr<net::URLRequestContext> safe_browsing_request_context_;
135 135
136 scoped_refptr<base::SingleThreadTaskRunner> network_task_runner_; 136 scoped_refptr<base::SingleThreadTaskRunner> network_task_runner_;
137 }; 137 };
138 138
139 SafeBrowsingURLRequestContextGetter::SafeBrowsingURLRequestContextGetter( 139 SafeBrowsingURLRequestContextGetter::SafeBrowsingURLRequestContextGetter(
140 scoped_refptr<net::URLRequestContextGetter> system_context_getter) 140 scoped_refptr<net::URLRequestContextGetter> system_context_getter)
141 : shut_down_(false), 141 : shut_down_(false),
142 system_context_getter_(system_context_getter), 142 system_context_getter_(system_context_getter),
143 network_task_runner_( 143 network_task_runner_(
144 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::IO)) {} 144 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::IO)) {}
(...skipping 228 matching lines...) Expand 10 before | Expand all | Expand 10 after
373 SafeBrowsingProtocolManager* SafeBrowsingService::protocol_manager() const { 373 SafeBrowsingProtocolManager* SafeBrowsingService::protocol_manager() const {
374 DCHECK_CURRENTLY_ON(BrowserThread::IO); 374 DCHECK_CURRENTLY_ON(BrowserThread::IO);
375 return protocol_manager_; 375 return protocol_manager_;
376 } 376 }
377 377
378 SafeBrowsingPingManager* SafeBrowsingService::ping_manager() const { 378 SafeBrowsingPingManager* SafeBrowsingService::ping_manager() const {
379 DCHECK_CURRENTLY_ON(BrowserThread::IO); 379 DCHECK_CURRENTLY_ON(BrowserThread::IO);
380 return ping_manager_; 380 return ping_manager_;
381 } 381 }
382 382
383 scoped_ptr<TrackedPreferenceValidationDelegate> 383 std::unique_ptr<TrackedPreferenceValidationDelegate>
384 SafeBrowsingService::CreatePreferenceValidationDelegate( 384 SafeBrowsingService::CreatePreferenceValidationDelegate(
385 Profile* profile) const { 385 Profile* profile) const {
386 #if defined(FULL_SAFE_BROWSING) 386 #if defined(FULL_SAFE_BROWSING)
387 return incident_service_->CreatePreferenceValidationDelegate(profile); 387 return incident_service_->CreatePreferenceValidationDelegate(profile);
388 #else 388 #else
389 return scoped_ptr<TrackedPreferenceValidationDelegate>(); 389 return std::unique_ptr<TrackedPreferenceValidationDelegate>();
390 #endif 390 #endif
391 } 391 }
392 392
393 #if defined(FULL_SAFE_BROWSING) 393 #if defined(FULL_SAFE_BROWSING)
394 void SafeBrowsingService::RegisterDelayedAnalysisCallback( 394 void SafeBrowsingService::RegisterDelayedAnalysisCallback(
395 const DelayedAnalysisCallback& callback) { 395 const DelayedAnalysisCallback& callback) {
396 incident_service_->RegisterDelayedAnalysisCallback(callback); 396 incident_service_->RegisterDelayedAnalysisCallback(callback);
397 } 397 }
398 398
399 void SafeBrowsingService::RegisterExtendedReportingOnlyDelayedAnalysisCallback( 399 void SafeBrowsingService::RegisterExtendedReportingOnlyDelayedAnalysisCallback(
(...skipping 240 matching lines...) Expand 10 before | Expand all | Expand 10 after
640 void SafeBrowsingService::RemovePrefService(PrefService* pref_service) { 640 void SafeBrowsingService::RemovePrefService(PrefService* pref_service) {
641 if (prefs_map_.find(pref_service) != prefs_map_.end()) { 641 if (prefs_map_.find(pref_service) != prefs_map_.end()) {
642 delete prefs_map_[pref_service]; 642 delete prefs_map_[pref_service];
643 prefs_map_.erase(pref_service); 643 prefs_map_.erase(pref_service);
644 RefreshState(); 644 RefreshState();
645 } else { 645 } else {
646 NOTREACHED(); 646 NOTREACHED();
647 } 647 }
648 } 648 }
649 649
650 scoped_ptr<SafeBrowsingService::StateSubscription> 650 std::unique_ptr<SafeBrowsingService::StateSubscription>
651 SafeBrowsingService::RegisterStateCallback( 651 SafeBrowsingService::RegisterStateCallback(
652 const base::Callback<void(void)>& callback) { 652 const base::Callback<void(void)>& callback) {
653 DCHECK_CURRENTLY_ON(BrowserThread::UI); 653 DCHECK_CURRENTLY_ON(BrowserThread::UI);
654 return state_callback_list_.Add(callback); 654 return state_callback_list_.Add(callback);
655 } 655 }
656 656
657 void SafeBrowsingService::RefreshState() { 657 void SafeBrowsingService::RefreshState() {
658 DCHECK_CURRENTLY_ON(BrowserThread::UI); 658 DCHECK_CURRENTLY_ON(BrowserThread::UI);
659 // Check if any profile requires the service to be active. 659 // Check if any profile requires the service to be active.
660 bool enable = false; 660 bool enable = false;
661 std::map<PrefService*, PrefChangeRegistrar*>::iterator iter; 661 std::map<PrefService*, PrefChangeRegistrar*>::iterator iter;
662 for (iter = prefs_map_.begin(); iter != prefs_map_.end(); ++iter) { 662 for (iter = prefs_map_.begin(); iter != prefs_map_.end(); ++iter) {
(...skipping 30 matching lines...) Expand all
693 } 693 }
694 694
695 void SafeBrowsingService::OnSendSerializedDownloadReport( 695 void SafeBrowsingService::OnSendSerializedDownloadReport(
696 const std::string& report) { 696 const std::string& report) {
697 DCHECK_CURRENTLY_ON(BrowserThread::IO); 697 DCHECK_CURRENTLY_ON(BrowserThread::IO);
698 if (ping_manager()) 698 if (ping_manager())
699 ping_manager()->ReportThreatDetails(report); 699 ping_manager()->ReportThreatDetails(report);
700 } 700 }
701 701
702 } // namespace safe_browsing 702 } // namespace safe_browsing
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698