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 <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 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
101 | 101 |
102 } // namespace | 102 } // namespace |
103 | 103 |
104 class SafeBrowsingURLRequestContextGetter | 104 class SafeBrowsingURLRequestContextGetter |
105 : public net::URLRequestContextGetter { | 105 : public net::URLRequestContextGetter { |
106 public: | 106 public: |
107 explicit SafeBrowsingURLRequestContextGetter( | 107 explicit SafeBrowsingURLRequestContextGetter( |
108 SafeBrowsingService* sb_service_); | 108 SafeBrowsingService* sb_service_); |
109 | 109 |
110 // Implementation for net::UrlRequestContextGetter. | 110 // Implementation for net::UrlRequestContextGetter. |
111 virtual net::URLRequestContext* GetURLRequestContext() OVERRIDE; | 111 virtual net::URLRequestContext* GetURLRequestContext() override; |
112 virtual scoped_refptr<base::SingleThreadTaskRunner> | 112 virtual scoped_refptr<base::SingleThreadTaskRunner> |
113 GetNetworkTaskRunner() const OVERRIDE; | 113 GetNetworkTaskRunner() const override; |
114 | 114 |
115 protected: | 115 protected: |
116 virtual ~SafeBrowsingURLRequestContextGetter(); | 116 virtual ~SafeBrowsingURLRequestContextGetter(); |
117 | 117 |
118 private: | 118 private: |
119 SafeBrowsingService* const sb_service_; // Owned by BrowserProcess. | 119 SafeBrowsingService* const sb_service_; // Owned by BrowserProcess. |
120 scoped_refptr<base::SingleThreadTaskRunner> network_task_runner_; | 120 scoped_refptr<base::SingleThreadTaskRunner> network_task_runner_; |
121 | 121 |
122 base::debug::LeakTracker<SafeBrowsingURLRequestContextGetter> leak_tracker_; | 122 base::debug::LeakTracker<SafeBrowsingURLRequestContextGetter> leak_tracker_; |
123 }; | 123 }; |
(...skipping 20 matching lines...) Expand all Loading... |
144 return network_task_runner_; | 144 return network_task_runner_; |
145 } | 145 } |
146 | 146 |
147 // static | 147 // static |
148 SafeBrowsingServiceFactory* SafeBrowsingService::factory_ = NULL; | 148 SafeBrowsingServiceFactory* SafeBrowsingService::factory_ = NULL; |
149 | 149 |
150 // The default SafeBrowsingServiceFactory. Global, made a singleton so we | 150 // The default SafeBrowsingServiceFactory. Global, made a singleton so we |
151 // don't leak it. | 151 // don't leak it. |
152 class SafeBrowsingServiceFactoryImpl : public SafeBrowsingServiceFactory { | 152 class SafeBrowsingServiceFactoryImpl : public SafeBrowsingServiceFactory { |
153 public: | 153 public: |
154 virtual SafeBrowsingService* CreateSafeBrowsingService() OVERRIDE { | 154 virtual SafeBrowsingService* CreateSafeBrowsingService() override { |
155 return new SafeBrowsingService(); | 155 return new SafeBrowsingService(); |
156 } | 156 } |
157 | 157 |
158 private: | 158 private: |
159 friend struct base::DefaultLazyInstanceTraits<SafeBrowsingServiceFactoryImpl>; | 159 friend struct base::DefaultLazyInstanceTraits<SafeBrowsingServiceFactoryImpl>; |
160 | 160 |
161 SafeBrowsingServiceFactoryImpl() { } | 161 SafeBrowsingServiceFactoryImpl() { } |
162 | 162 |
163 DISALLOW_COPY_AND_ASSIGN(SafeBrowsingServiceFactoryImpl); | 163 DISALLOW_COPY_AND_ASSIGN(SafeBrowsingServiceFactoryImpl); |
164 }; | 164 }; |
(...skipping 392 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
557 else | 557 else |
558 Stop(false); | 558 Stop(false); |
559 | 559 |
560 #if defined(FULL_SAFE_BROWSING) | 560 #if defined(FULL_SAFE_BROWSING) |
561 if (csd_service_) | 561 if (csd_service_) |
562 csd_service_->SetEnabledAndRefreshState(enable); | 562 csd_service_->SetEnabledAndRefreshState(enable); |
563 if (download_service_) | 563 if (download_service_) |
564 download_service_->SetEnabled(enable); | 564 download_service_->SetEnabled(enable); |
565 #endif | 565 #endif |
566 } | 566 } |
OLD | NEW |