| OLD | NEW |
| 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 121 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 132 | 132 |
| 133 // Implementation for net::UrlRequestContextGetter. | 133 // Implementation for net::UrlRequestContextGetter. |
| 134 net::URLRequestContext* GetURLRequestContext() override; | 134 net::URLRequestContext* GetURLRequestContext() override; |
| 135 scoped_refptr<base::SingleThreadTaskRunner> GetNetworkTaskRunner() | 135 scoped_refptr<base::SingleThreadTaskRunner> GetNetworkTaskRunner() |
| 136 const override; | 136 const override; |
| 137 | 137 |
| 138 // Shuts down any pending requests using the getter, and sets |shut_down_| to | 138 // Shuts down any pending requests using the getter, and sets |shut_down_| to |
| 139 // true. | 139 // true. |
| 140 void ServiceShuttingDown(); | 140 void ServiceShuttingDown(); |
| 141 | 141 |
| 142 // Disables QUIC. This should not be necessary anymore when |
| 143 // http://crbug.com/678653 is implemented. |
| 144 void DisableQuicOnIOThread(); |
| 145 |
| 142 protected: | 146 protected: |
| 143 ~SafeBrowsingURLRequestContextGetter() override; | 147 ~SafeBrowsingURLRequestContextGetter() override; |
| 144 | 148 |
| 145 private: | 149 private: |
| 146 bool shut_down_; | 150 bool shut_down_; |
| 147 | 151 |
| 148 scoped_refptr<net::URLRequestContextGetter> system_context_getter_; | 152 scoped_refptr<net::URLRequestContextGetter> system_context_getter_; |
| 149 | 153 |
| 150 std::unique_ptr<net::CookieStore> safe_browsing_cookie_store_; | 154 std::unique_ptr<net::CookieStore> safe_browsing_cookie_store_; |
| 151 | 155 |
| (...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 232 } | 236 } |
| 233 | 237 |
| 234 void SafeBrowsingURLRequestContextGetter::ServiceShuttingDown() { | 238 void SafeBrowsingURLRequestContextGetter::ServiceShuttingDown() { |
| 235 DCHECK_CURRENTLY_ON(BrowserThread::IO); | 239 DCHECK_CURRENTLY_ON(BrowserThread::IO); |
| 236 | 240 |
| 237 shut_down_ = true; | 241 shut_down_ = true; |
| 238 URLRequestContextGetter::NotifyContextShuttingDown(); | 242 URLRequestContextGetter::NotifyContextShuttingDown(); |
| 239 safe_browsing_request_context_.reset(); | 243 safe_browsing_request_context_.reset(); |
| 240 } | 244 } |
| 241 | 245 |
| 246 void SafeBrowsingURLRequestContextGetter::DisableQuicOnIOThread() { |
| 247 DCHECK_CURRENTLY_ON(BrowserThread::IO); |
| 248 |
| 249 if (http_network_session_) |
| 250 http_network_session_->DisableQuic(); |
| 251 } |
| 252 |
| 242 SafeBrowsingURLRequestContextGetter::~SafeBrowsingURLRequestContextGetter() {} | 253 SafeBrowsingURLRequestContextGetter::~SafeBrowsingURLRequestContextGetter() {} |
| 243 | 254 |
| 244 // static | 255 // static |
| 245 SafeBrowsingServiceFactory* SafeBrowsingService::factory_ = NULL; | 256 SafeBrowsingServiceFactory* SafeBrowsingService::factory_ = NULL; |
| 246 | 257 |
| 247 // The default SafeBrowsingServiceFactory. Global, made a singleton so we | 258 // The default SafeBrowsingServiceFactory. Global, made a singleton so we |
| 248 // don't leak it. | 259 // don't leak it. |
| 249 class SafeBrowsingServiceFactoryImpl : public SafeBrowsingServiceFactory { | 260 class SafeBrowsingServiceFactoryImpl : public SafeBrowsingServiceFactory { |
| 250 public: | 261 public: |
| 251 SafeBrowsingService* CreateSafeBrowsingService() override { | 262 SafeBrowsingService* CreateSafeBrowsingService() override { |
| (...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 386 return false; | 397 return false; |
| 387 #endif | 398 #endif |
| 388 } | 399 } |
| 389 | 400 |
| 390 scoped_refptr<net::URLRequestContextGetter> | 401 scoped_refptr<net::URLRequestContextGetter> |
| 391 SafeBrowsingService::url_request_context() { | 402 SafeBrowsingService::url_request_context() { |
| 392 DCHECK_CURRENTLY_ON(BrowserThread::UI); | 403 DCHECK_CURRENTLY_ON(BrowserThread::UI); |
| 393 return url_request_context_getter_; | 404 return url_request_context_getter_; |
| 394 } | 405 } |
| 395 | 406 |
| 407 void SafeBrowsingService::DisableQuicOnIOThread() { |
| 408 DCHECK_CURRENTLY_ON(BrowserThread::IO); |
| 409 |
| 410 url_request_context_getter_->DisableQuicOnIOThread(); |
| 411 } |
| 412 |
| 396 const scoped_refptr<SafeBrowsingUIManager>& | 413 const scoped_refptr<SafeBrowsingUIManager>& |
| 397 SafeBrowsingService::ui_manager() const { | 414 SafeBrowsingService::ui_manager() const { |
| 398 return ui_manager_; | 415 return ui_manager_; |
| 399 } | 416 } |
| 400 | 417 |
| 401 const scoped_refptr<SafeBrowsingDatabaseManager>& | 418 const scoped_refptr<SafeBrowsingDatabaseManager>& |
| 402 SafeBrowsingService::database_manager() const { | 419 SafeBrowsingService::database_manager() const { |
| 403 return enabled_v4_only_ ? v4_local_database_manager() : database_manager_; | 420 return enabled_v4_only_ ? v4_local_database_manager() : database_manager_; |
| 404 } | 421 } |
| 405 | 422 |
| (...skipping 334 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 740 ping_manager()->ReportThreatDetails(report); | 757 ping_manager()->ReportThreatDetails(report); |
| 741 } | 758 } |
| 742 | 759 |
| 743 void SafeBrowsingService::ProcessResourceRequest( | 760 void SafeBrowsingService::ProcessResourceRequest( |
| 744 const ResourceRequestInfo& request) { | 761 const ResourceRequestInfo& request) { |
| 745 DCHECK_CURRENTLY_ON(BrowserThread::UI); | 762 DCHECK_CURRENTLY_ON(BrowserThread::UI); |
| 746 services_delegate_->ProcessResourceRequest(&request); | 763 services_delegate_->ProcessResourceRequest(&request); |
| 747 } | 764 } |
| 748 | 765 |
| 749 } // namespace safe_browsing | 766 } // namespace safe_browsing |
| OLD | NEW |