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 "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/bind_helpers.h" | 8 #include "base/bind_helpers.h" |
9 #include "base/callback.h" | 9 #include "base/callback.h" |
10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
100 // associated with a particular profile. We need to use a subclass of | 100 // associated with a particular profile. We need to use a subclass of |
101 // URLRequestContext in order to provide the correct User-Agent. | 101 // URLRequestContext in order to provide the correct User-Agent. |
102 class SafeBrowsingURLRequestContext : public net::URLRequestContext { | 102 class SafeBrowsingURLRequestContext : public net::URLRequestContext { |
103 public: | 103 public: |
104 virtual const std::string& GetUserAgent( | 104 virtual const std::string& GetUserAgent( |
105 const GURL& url) const OVERRIDE { | 105 const GURL& url) const OVERRIDE { |
106 return content::GetUserAgent(url); | 106 return content::GetUserAgent(url); |
107 } | 107 } |
108 | 108 |
109 private: | 109 private: |
| 110 virtual ~SafeBrowsingURLRequestContext() {} |
| 111 |
110 base::debug::LeakTracker<SafeBrowsingURLRequestContext> leak_tracker_; | 112 base::debug::LeakTracker<SafeBrowsingURLRequestContext> leak_tracker_; |
111 }; | 113 }; |
112 | 114 |
113 class SafeBrowsingURLRequestContextGetter | 115 class SafeBrowsingURLRequestContextGetter |
114 : public net::URLRequestContextGetter { | 116 : public net::URLRequestContextGetter { |
115 public: | 117 public: |
116 explicit SafeBrowsingURLRequestContextGetter( | 118 explicit SafeBrowsingURLRequestContextGetter( |
117 SafeBrowsingService* sb_service_); | 119 SafeBrowsingService* sb_service_); |
118 | 120 |
119 // Implementation for net::UrlRequestContextGetter. | 121 // Implementation for net::UrlRequestContextGetter. |
(...skipping 1301 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1421 Stop(); | 1423 Stop(); |
1422 | 1424 |
1423 if (csd_service_.get()) | 1425 if (csd_service_.get()) |
1424 csd_service_->SetEnabledAndRefreshState(enable); | 1426 csd_service_->SetEnabledAndRefreshState(enable); |
1425 if (download_service_.get()) { | 1427 if (download_service_.get()) { |
1426 download_service_->SetEnabled( | 1428 download_service_->SetEnabled( |
1427 enable && !CommandLine::ForCurrentProcess()->HasSwitch( | 1429 enable && !CommandLine::ForCurrentProcess()->HasSwitch( |
1428 switches::kDisableImprovedDownloadProtection)); | 1430 switches::kDisableImprovedDownloadProtection)); |
1429 } | 1431 } |
1430 } | 1432 } |
OLD | NEW |