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 #include <cmath> | 8 #include <cmath> |
9 #include <utility> | 9 #include <utility> |
10 | 10 |
(...skipping 1505 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1516 | 1516 |
1517 void ProxyService::ForceReloadProxyConfig() { | 1517 void ProxyService::ForceReloadProxyConfig() { |
1518 DCHECK_CALLED_ON_VALID_THREAD(thread_checker_); | 1518 DCHECK_CALLED_ON_VALID_THREAD(thread_checker_); |
1519 ResetProxyConfig(false); | 1519 ResetProxyConfig(false); |
1520 ApplyProxyConfigIfAvailable(); | 1520 ApplyProxyConfigIfAvailable(); |
1521 } | 1521 } |
1522 | 1522 |
1523 // static | 1523 // static |
1524 std::unique_ptr<ProxyConfigService> | 1524 std::unique_ptr<ProxyConfigService> |
1525 ProxyService::CreateSystemProxyConfigService( | 1525 ProxyService::CreateSystemProxyConfigService( |
1526 const scoped_refptr<base::SingleThreadTaskRunner>& io_task_runner, | 1526 const scoped_refptr<base::SingleThreadTaskRunner>& io_task_runner) { |
1527 const scoped_refptr<base::SingleThreadTaskRunner>& file_task_runner) { | |
1528 #if defined(OS_WIN) | 1527 #if defined(OS_WIN) |
1529 return base::MakeUnique<ProxyConfigServiceWin>(); | 1528 return base::MakeUnique<ProxyConfigServiceWin>(); |
1530 #elif defined(OS_IOS) | 1529 #elif defined(OS_IOS) |
1531 return base::MakeUnique<ProxyConfigServiceIOS>(); | 1530 return base::MakeUnique<ProxyConfigServiceIOS>(); |
1532 #elif defined(OS_MACOSX) | 1531 #elif defined(OS_MACOSX) |
1533 return base::MakeUnique<ProxyConfigServiceMac>(io_task_runner); | 1532 return base::MakeUnique<ProxyConfigServiceMac>(io_task_runner); |
1534 #elif defined(OS_CHROMEOS) | 1533 #elif defined(OS_CHROMEOS) |
1535 LOG(ERROR) << "ProxyConfigService for ChromeOS should be created in " | 1534 LOG(ERROR) << "ProxyConfigService for ChromeOS should be created in " |
1536 << "profile_io_data.cc::CreateProxyConfigService and this should " | 1535 << "profile_io_data.cc::CreateProxyConfigService and this should " |
1537 << "be used only for examples."; | 1536 << "be used only for examples."; |
1538 return base::WrapUnique(new UnsetProxyConfigService); | 1537 return base::WrapUnique(new UnsetProxyConfigService); |
1539 #elif defined(OS_LINUX) | 1538 #elif defined(OS_LINUX) |
1540 std::unique_ptr<ProxyConfigServiceLinux> linux_config_service( | 1539 std::unique_ptr<ProxyConfigServiceLinux> linux_config_service( |
1541 new ProxyConfigServiceLinux()); | 1540 new ProxyConfigServiceLinux()); |
1542 | 1541 |
1543 // Assume we got called on the thread that runs the default glib | 1542 // Assume we got called on the thread that runs the default glib |
1544 // main loop, so the current thread is where we should be running | 1543 // main loop, so the current thread is where we should be running |
1545 // gconf calls from. | 1544 // gconf calls from. |
1546 scoped_refptr<base::SingleThreadTaskRunner> glib_thread_task_runner = | 1545 scoped_refptr<base::SingleThreadTaskRunner> glib_thread_task_runner = |
1547 base::ThreadTaskRunnerHandle::Get(); | 1546 base::ThreadTaskRunnerHandle::Get(); |
1548 | 1547 |
1549 // Synchronously fetch the current proxy config (since we are running on | 1548 // Synchronously fetch the current proxy config (since we are running on |
1550 // glib_default_loop). Additionally register for notifications (delivered in | 1549 // glib_default_loop). Additionally register for notifications (delivered in |
1551 // either |glib_default_loop| or |file_task_runner|) to keep us updated when | 1550 // either |glib_default_loop| or an internal sequenced task runner) to |
1552 // the proxy config changes. | 1551 // keep us updated when the proxy config changes. |
1553 linux_config_service->SetupAndFetchInitialConfig( | 1552 linux_config_service->SetupAndFetchInitialConfig(glib_thread_task_runner, |
1554 glib_thread_task_runner, io_task_runner, file_task_runner); | 1553 io_task_runner); |
1555 | 1554 |
1556 return std::move(linux_config_service); | 1555 return std::move(linux_config_service); |
1557 #elif defined(OS_ANDROID) | 1556 #elif defined(OS_ANDROID) |
1558 return base::MakeUnique<ProxyConfigServiceAndroid>( | 1557 return base::MakeUnique<ProxyConfigServiceAndroid>( |
1559 io_task_runner, base::ThreadTaskRunnerHandle::Get()); | 1558 io_task_runner, base::ThreadTaskRunnerHandle::Get()); |
1560 #else | 1559 #else |
1561 LOG(WARNING) << "Failed to choose a system proxy settings fetcher " | 1560 LOG(WARNING) << "Failed to choose a system proxy settings fetcher " |
1562 "for this platform."; | 1561 "for this platform."; |
1563 return base::MakeUnique<ProxyConfigServiceDirect>(); | 1562 return base::MakeUnique<ProxyConfigServiceDirect>(); |
1564 #endif | 1563 #endif |
(...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1672 State previous_state = ResetProxyConfig(false); | 1671 State previous_state = ResetProxyConfig(false); |
1673 if (previous_state != STATE_NONE) | 1672 if (previous_state != STATE_NONE) |
1674 ApplyProxyConfigIfAvailable(); | 1673 ApplyProxyConfigIfAvailable(); |
1675 } | 1674 } |
1676 | 1675 |
1677 void ProxyService::OnDNSChanged() { | 1676 void ProxyService::OnDNSChanged() { |
1678 OnIPAddressChanged(); | 1677 OnIPAddressChanged(); |
1679 } | 1678 } |
1680 | 1679 |
1681 } // namespace net | 1680 } // namespace net |
OLD | NEW |