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 331 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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 private: | 351 private: |
| 352 virtual ~ProxyConfigChangedNetLogParam() {} |
| 353 |
352 const ProxyConfig old_config_; | 354 const ProxyConfig old_config_; |
353 const ProxyConfig new_config_; | 355 const ProxyConfig new_config_; |
354 DISALLOW_COPY_AND_ASSIGN(ProxyConfigChangedNetLogParam); | 356 DISALLOW_COPY_AND_ASSIGN(ProxyConfigChangedNetLogParam); |
355 }; | 357 }; |
356 | 358 |
357 class BadProxyListNetLogParam : public NetLog::EventParameters { | 359 class BadProxyListNetLogParam : public NetLog::EventParameters { |
358 public: | 360 public: |
359 BadProxyListNetLogParam(const ProxyRetryInfoMap& retry_info) { | 361 BadProxyListNetLogParam(const ProxyRetryInfoMap& retry_info) { |
360 proxy_list_.reserve(retry_info.size()); | 362 proxy_list_.reserve(retry_info.size()); |
361 for (ProxyRetryInfoMap::const_iterator iter = retry_info.begin(); | 363 for (ProxyRetryInfoMap::const_iterator iter = retry_info.begin(); |
362 iter != retry_info.end(); ++iter) { | 364 iter != retry_info.end(); ++iter) { |
363 proxy_list_.push_back(iter->first); | 365 proxy_list_.push_back(iter->first); |
364 } | 366 } |
365 } | 367 } |
366 | 368 |
367 virtual Value* ToValue() const OVERRIDE { | 369 virtual Value* ToValue() const OVERRIDE { |
368 DictionaryValue* dict = new DictionaryValue(); | 370 DictionaryValue* dict = new DictionaryValue(); |
369 ListValue* list = new ListValue(); | 371 ListValue* list = new ListValue(); |
370 for (std::vector<std::string>::const_iterator iter = proxy_list_.begin(); | 372 for (std::vector<std::string>::const_iterator iter = proxy_list_.begin(); |
371 iter != proxy_list_.end(); ++iter) | 373 iter != proxy_list_.end(); ++iter) |
372 list->Append(Value::CreateStringValue(*iter)); | 374 list->Append(Value::CreateStringValue(*iter)); |
373 dict->Set("bad_proxy_list", list); | 375 dict->Set("bad_proxy_list", list); |
374 return dict; | 376 return dict; |
375 } | 377 } |
376 | 378 |
377 private: | 379 private: |
| 380 virtual ~BadProxyListNetLogParam() {} |
| 381 |
378 std::vector<std::string> proxy_list_; | 382 std::vector<std::string> proxy_list_; |
379 DISALLOW_COPY_AND_ASSIGN(BadProxyListNetLogParam); | 383 DISALLOW_COPY_AND_ASSIGN(BadProxyListNetLogParam); |
380 }; | 384 }; |
381 | 385 |
382 } // namespace | 386 } // namespace |
383 | 387 |
384 // ProxyService::InitProxyResolver -------------------------------------------- | 388 // ProxyService::InitProxyResolver -------------------------------------------- |
385 | 389 |
386 // This glues together two asynchronous steps: | 390 // This glues together two asynchronous steps: |
387 // (1) ProxyScriptDecider -- try to fetch/validate a sequence of PAC scripts | 391 // (1) ProxyScriptDecider -- try to fetch/validate a sequence of PAC scripts |
(...skipping 1229 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1617 OnCompletion(result_); | 1621 OnCompletion(result_); |
1618 } | 1622 } |
1619 } | 1623 } |
1620 | 1624 |
1621 void SyncProxyServiceHelper::OnCompletion(int rv) { | 1625 void SyncProxyServiceHelper::OnCompletion(int rv) { |
1622 result_ = rv; | 1626 result_ = rv; |
1623 event_.Signal(); | 1627 event_.Signal(); |
1624 } | 1628 } |
1625 | 1629 |
1626 } // namespace net | 1630 } // namespace net |
OLD | NEW |