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 <algorithm> | 7 #include <algorithm> |
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 330 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
341 virtual Value* ToValue() const OVERRIDE { | 341 virtual Value* ToValue() const OVERRIDE { |
342 DictionaryValue* dict = new DictionaryValue(); | 342 DictionaryValue* dict = new DictionaryValue(); |
343 // The "old_config" is optional -- the first notification will not have | 343 // The "old_config" is optional -- the first notification will not have |
344 // any "previous" configuration. | 344 // any "previous" configuration. |
345 if (old_config_.is_valid()) | 345 if (old_config_.is_valid()) |
346 dict->Set("old_config", old_config_.ToValue()); | 346 dict->Set("old_config", old_config_.ToValue()); |
347 dict->Set("new_config", new_config_.ToValue()); | 347 dict->Set("new_config", new_config_.ToValue()); |
348 return dict; | 348 return dict; |
349 } | 349 } |
350 | 350 |
| 351 protected: |
| 352 virtual ~ProxyConfigChangedNetLogParam() {} |
| 353 |
351 private: | 354 private: |
352 const ProxyConfig old_config_; | 355 const ProxyConfig old_config_; |
353 const ProxyConfig new_config_; | 356 const ProxyConfig new_config_; |
354 DISALLOW_COPY_AND_ASSIGN(ProxyConfigChangedNetLogParam); | 357 DISALLOW_COPY_AND_ASSIGN(ProxyConfigChangedNetLogParam); |
355 }; | 358 }; |
356 | 359 |
357 class BadProxyListNetLogParam : public NetLog::EventParameters { | 360 class BadProxyListNetLogParam : public NetLog::EventParameters { |
358 public: | 361 public: |
359 BadProxyListNetLogParam(const ProxyRetryInfoMap& retry_info) { | 362 BadProxyListNetLogParam(const ProxyRetryInfoMap& retry_info) { |
360 proxy_list_.reserve(retry_info.size()); | 363 proxy_list_.reserve(retry_info.size()); |
361 for (ProxyRetryInfoMap::const_iterator iter = retry_info.begin(); | 364 for (ProxyRetryInfoMap::const_iterator iter = retry_info.begin(); |
362 iter != retry_info.end(); ++iter) { | 365 iter != retry_info.end(); ++iter) { |
363 proxy_list_.push_back(iter->first); | 366 proxy_list_.push_back(iter->first); |
364 } | 367 } |
365 } | 368 } |
366 | 369 |
367 virtual Value* ToValue() const OVERRIDE { | 370 virtual Value* ToValue() const OVERRIDE { |
368 DictionaryValue* dict = new DictionaryValue(); | 371 DictionaryValue* dict = new DictionaryValue(); |
369 ListValue* list = new ListValue(); | 372 ListValue* list = new ListValue(); |
370 for (std::vector<std::string>::const_iterator iter = proxy_list_.begin(); | 373 for (std::vector<std::string>::const_iterator iter = proxy_list_.begin(); |
371 iter != proxy_list_.end(); ++iter) | 374 iter != proxy_list_.end(); ++iter) |
372 list->Append(Value::CreateStringValue(*iter)); | 375 list->Append(Value::CreateStringValue(*iter)); |
373 dict->Set("bad_proxy_list", list); | 376 dict->Set("bad_proxy_list", list); |
374 return dict; | 377 return dict; |
375 } | 378 } |
376 | 379 |
| 380 protected: |
| 381 virtual ~BadProxyListNetLogParam() {} |
| 382 |
377 private: | 383 private: |
378 std::vector<std::string> proxy_list_; | 384 std::vector<std::string> proxy_list_; |
379 DISALLOW_COPY_AND_ASSIGN(BadProxyListNetLogParam); | 385 DISALLOW_COPY_AND_ASSIGN(BadProxyListNetLogParam); |
380 }; | 386 }; |
381 | 387 |
382 #if defined(OS_CHROMEOS) | 388 #if defined(OS_CHROMEOS) |
383 class UnsetProxyConfigService : public ProxyConfigService { | 389 class UnsetProxyConfigService : public ProxyConfigService { |
384 public: | 390 public: |
385 UnsetProxyConfigService() {} | 391 UnsetProxyConfigService() {} |
386 virtual ~UnsetProxyConfigService() {} | 392 virtual ~UnsetProxyConfigService() {} |
(...skipping 1247 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1634 OnCompletion(result_); | 1640 OnCompletion(result_); |
1635 } | 1641 } |
1636 } | 1642 } |
1637 | 1643 |
1638 void SyncProxyServiceHelper::OnCompletion(int rv) { | 1644 void SyncProxyServiceHelper::OnCompletion(int rv) { |
1639 result_ = rv; | 1645 result_ = rv; |
1640 event_.Signal(); | 1646 event_.Signal(); |
1641 } | 1647 } |
1642 | 1648 |
1643 } // namespace net | 1649 } // namespace net |
OLD | NEW |