| 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 "ios/chrome/browser/safe_browsing/safe_browsing_service.h" | 5 #include "ios/chrome/browser/safe_browsing/safe_browsing_service.h" |
| 6 | 6 |
| 7 #include <vector> | 7 #include <vector> |
| 8 | 8 |
| 9 #include "base/bind.h" | 9 #include "base/bind.h" |
| 10 #include "base/bind_helpers.h" | 10 #include "base/bind_helpers.h" |
| (...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 83 void ServiceShuttingDown(); | 83 void ServiceShuttingDown(); |
| 84 | 84 |
| 85 protected: | 85 protected: |
| 86 ~SafeBrowsingURLRequestContextGetter() override; | 86 ~SafeBrowsingURLRequestContextGetter() override; |
| 87 | 87 |
| 88 private: | 88 private: |
| 89 bool shut_down_; | 89 bool shut_down_; |
| 90 | 90 |
| 91 scoped_refptr<net::URLRequestContextGetter> system_context_getter_; | 91 scoped_refptr<net::URLRequestContextGetter> system_context_getter_; |
| 92 | 92 |
| 93 scoped_ptr<net::CookieStore> safe_browsing_cookie_store_; | 93 std::unique_ptr<net::CookieStore> safe_browsing_cookie_store_; |
| 94 | 94 |
| 95 scoped_ptr<net::URLRequestContext> safe_browsing_request_context_; | 95 std::unique_ptr<net::URLRequestContext> safe_browsing_request_context_; |
| 96 | 96 |
| 97 scoped_refptr<base::SingleThreadTaskRunner> network_task_runner_; | 97 scoped_refptr<base::SingleThreadTaskRunner> network_task_runner_; |
| 98 }; | 98 }; |
| 99 | 99 |
| 100 SafeBrowsingURLRequestContextGetter::SafeBrowsingURLRequestContextGetter( | 100 SafeBrowsingURLRequestContextGetter::SafeBrowsingURLRequestContextGetter( |
| 101 scoped_refptr<net::URLRequestContextGetter> system_context_getter) | 101 scoped_refptr<net::URLRequestContextGetter> system_context_getter) |
| 102 : shut_down_(false), | 102 : shut_down_(false), |
| 103 system_context_getter_(system_context_getter), | 103 system_context_getter_(system_context_getter), |
| 104 network_task_runner_( | 104 network_task_runner_( |
| 105 web::WebThread::GetTaskRunnerForThread(web::WebThread::IO)) {} | 105 web::WebThread::GetTaskRunnerForThread(web::WebThread::IO)) {} |
| (...skipping 274 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 380 void SafeBrowsingService::RemovePrefService(PrefService* pref_service) { | 380 void SafeBrowsingService::RemovePrefService(PrefService* pref_service) { |
| 381 if (prefs_map_.find(pref_service) != prefs_map_.end()) { | 381 if (prefs_map_.find(pref_service) != prefs_map_.end()) { |
| 382 delete prefs_map_[pref_service]; | 382 delete prefs_map_[pref_service]; |
| 383 prefs_map_.erase(pref_service); | 383 prefs_map_.erase(pref_service); |
| 384 RefreshState(); | 384 RefreshState(); |
| 385 } else { | 385 } else { |
| 386 NOTREACHED(); | 386 NOTREACHED(); |
| 387 } | 387 } |
| 388 } | 388 } |
| 389 | 389 |
| 390 scoped_ptr<SafeBrowsingService::StateSubscription> | 390 std::unique_ptr<SafeBrowsingService::StateSubscription> |
| 391 SafeBrowsingService::RegisterStateCallback( | 391 SafeBrowsingService::RegisterStateCallback( |
| 392 const base::Callback<void(void)>& callback) { | 392 const base::Callback<void(void)>& callback) { |
| 393 DCHECK_CURRENTLY_ON(web::WebThread::UI); | 393 DCHECK_CURRENTLY_ON(web::WebThread::UI); |
| 394 return state_callback_list_.Add(callback); | 394 return state_callback_list_.Add(callback); |
| 395 } | 395 } |
| 396 | 396 |
| 397 void SafeBrowsingService::RefreshState() { | 397 void SafeBrowsingService::RefreshState() { |
| 398 DCHECK_CURRENTLY_ON(web::WebThread::UI); | 398 DCHECK_CURRENTLY_ON(web::WebThread::UI); |
| 399 // Check if any browser state requires the service to be active. | 399 // Check if any browser state requires the service to be active. |
| 400 bool enable = false; | 400 bool enable = false; |
| (...skipping 25 matching lines...) Expand all Loading... |
| 426 } | 426 } |
| 427 | 427 |
| 428 void SafeBrowsingService::OnSendDownloadRecoveryReport( | 428 void SafeBrowsingService::OnSendDownloadRecoveryReport( |
| 429 const std::string& report) { | 429 const std::string& report) { |
| 430 DCHECK_CURRENTLY_ON(web::WebThread::IO); | 430 DCHECK_CURRENTLY_ON(web::WebThread::IO); |
| 431 if (ping_manager()) | 431 if (ping_manager()) |
| 432 ping_manager()->ReportThreatDetails(report); | 432 ping_manager()->ReportThreatDetails(report); |
| 433 } | 433 } |
| 434 | 434 |
| 435 } // namespace safe_browsing | 435 } // namespace safe_browsing |
| OLD | NEW |