| 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 "net/proxy/proxy_service.h" | 5 #include "net/proxy/proxy_service.h" |
| 6 | 6 |
| 7 #include <cstdarg> | 7 #include <cstdarg> |
| 8 #include <string> | 8 #include <string> |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| (...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 152 | 152 |
| 153 ConfigAvailability GetLatestProxyConfig(ProxyConfig* results) override { | 153 ConfigAvailability GetLatestProxyConfig(ProxyConfig* results) override { |
| 154 if (availability_ == CONFIG_VALID) | 154 if (availability_ == CONFIG_VALID) |
| 155 *results = config_; | 155 *results = config_; |
| 156 return availability_; | 156 return availability_; |
| 157 } | 157 } |
| 158 | 158 |
| 159 void SetConfig(const ProxyConfig& config) { | 159 void SetConfig(const ProxyConfig& config) { |
| 160 availability_ = CONFIG_VALID; | 160 availability_ = CONFIG_VALID; |
| 161 config_ = config; | 161 config_ = config; |
| 162 FOR_EACH_OBSERVER(Observer, observers_, | 162 for (auto& observer : observers_) |
| 163 OnProxyConfigChanged(config_, availability_)); | 163 observer.OnProxyConfigChanged(config_, availability_); |
| 164 } | 164 } |
| 165 | 165 |
| 166 private: | 166 private: |
| 167 ConfigAvailability availability_; | 167 ConfigAvailability availability_; |
| 168 ProxyConfig config_; | 168 ProxyConfig config_; |
| 169 base::ObserverList<Observer, true> observers_; | 169 base::ObserverList<Observer, true> observers_; |
| 170 }; | 170 }; |
| 171 | 171 |
| 172 // A test network delegate that exercises the OnResolveProxy callback. | 172 // A test network delegate that exercises the OnResolveProxy callback. |
| 173 class TestResolveProxyDelegate : public ProxyDelegate { | 173 class TestResolveProxyDelegate : public ProxyDelegate { |
| (...skipping 3488 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3662 GURL(test.sanitized_url_unstripped), | 3662 GURL(test.sanitized_url_unstripped), |
| 3663 helper.SanitizeUrl(raw_url, ProxyService::SanitizeUrlPolicy::UNSAFE)); | 3663 helper.SanitizeUrl(raw_url, ProxyService::SanitizeUrlPolicy::UNSAFE)); |
| 3664 | 3664 |
| 3665 EXPECT_EQ( | 3665 EXPECT_EQ( |
| 3666 GURL(test.sanitized_url), | 3666 GURL(test.sanitized_url), |
| 3667 helper.SanitizeUrl(raw_url, ProxyService::SanitizeUrlPolicy::SAFE)); | 3667 helper.SanitizeUrl(raw_url, ProxyService::SanitizeUrlPolicy::SAFE)); |
| 3668 } | 3668 } |
| 3669 } | 3669 } |
| 3670 | 3670 |
| 3671 } // namespace net | 3671 } // namespace net |
| OLD | NEW |