| 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 22 matching lines...) Expand all Loading... |
| 33 #include "net/url_request/url_request_context.h" | 33 #include "net/url_request/url_request_context.h" |
| 34 | 34 |
| 35 #if defined(OS_WIN) | 35 #if defined(OS_WIN) |
| 36 #include "net/proxy/proxy_config_service_win.h" | 36 #include "net/proxy/proxy_config_service_win.h" |
| 37 #include "net/proxy/proxy_resolver_winhttp.h" | 37 #include "net/proxy/proxy_resolver_winhttp.h" |
| 38 #elif defined(OS_MACOSX) | 38 #elif defined(OS_MACOSX) |
| 39 #include "net/proxy/proxy_config_service_mac.h" | 39 #include "net/proxy/proxy_config_service_mac.h" |
| 40 #include "net/proxy/proxy_resolver_mac.h" | 40 #include "net/proxy/proxy_resolver_mac.h" |
| 41 #elif defined(OS_LINUX) && !defined(OS_CHROMEOS) | 41 #elif defined(OS_LINUX) && !defined(OS_CHROMEOS) |
| 42 #include "net/proxy/proxy_config_service_linux.h" | 42 #include "net/proxy/proxy_config_service_linux.h" |
| 43 #elif defined(OS_ANDROID) |
| 44 #include "net/proxy/proxy_config_service_android.h" |
| 43 #endif | 45 #endif |
| 44 | 46 |
| 45 using base::TimeDelta; | 47 using base::TimeDelta; |
| 46 using base::TimeTicks; | 48 using base::TimeTicks; |
| 47 | 49 |
| 48 namespace net { | 50 namespace net { |
| 49 | 51 |
| 50 namespace { | 52 namespace { |
| 51 | 53 |
| 52 const size_t kMaxNumNetLogEntries = 100; | 54 const size_t kMaxNumNetLogEntries = 100; |
| (...skipping 1368 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1421 DCHECK_EQ(MessageLoop::TYPE_IO, file_loop->type()); | 1423 DCHECK_EQ(MessageLoop::TYPE_IO, file_loop->type()); |
| 1422 | 1424 |
| 1423 // Synchronously fetch the current proxy config (since we are | 1425 // Synchronously fetch the current proxy config (since we are |
| 1424 // running on glib_default_loop). Additionally register for | 1426 // running on glib_default_loop). Additionally register for |
| 1425 // notifications (delivered in either |glib_default_loop| or | 1427 // notifications (delivered in either |glib_default_loop| or |
| 1426 // |file_loop|) to keep us updated when the proxy config changes. | 1428 // |file_loop|) to keep us updated when the proxy config changes. |
| 1427 linux_config_service->SetupAndFetchInitialConfig(glib_default_loop, io_loop, | 1429 linux_config_service->SetupAndFetchInitialConfig(glib_default_loop, io_loop, |
| 1428 static_cast<MessageLoopForIO*>(file_loop)); | 1430 static_cast<MessageLoopForIO*>(file_loop)); |
| 1429 | 1431 |
| 1430 return linux_config_service; | 1432 return linux_config_service; |
| 1433 #elif defined(OS_ANDROID) |
| 1434 return new ProxyConfigServiceAndroid(); |
| 1431 #else | 1435 #else |
| 1432 LOG(WARNING) << "Failed to choose a system proxy settings fetcher " | 1436 LOG(WARNING) << "Failed to choose a system proxy settings fetcher " |
| 1433 "for this platform."; | 1437 "for this platform."; |
| 1434 return new ProxyConfigServiceDirect(); | 1438 return new ProxyConfigServiceDirect(); |
| 1435 #endif | 1439 #endif |
| 1436 } | 1440 } |
| 1437 | 1441 |
| 1438 // static | 1442 // static |
| 1439 const ProxyService::PacPollPolicy* ProxyService::set_pac_script_poll_policy( | 1443 const ProxyService::PacPollPolicy* ProxyService::set_pac_script_poll_policy( |
| 1440 const PacPollPolicy* policy) { | 1444 const PacPollPolicy* policy) { |
| (...skipping 176 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 |