| 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/dhcp_proxy_script_adapter_fetcher_win.h" | 5 #include "net/proxy/dhcp_proxy_script_adapter_fetcher_win.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/bind_helpers.h" | 8 #include "base/bind_helpers.h" |
| 9 #include "base/location.h" | 9 #include "base/location.h" |
| 10 #include "base/logging.h" | 10 #include "base/logging.h" |
| 11 #include "base/memory/free_deleter.h" | 11 #include "base/memory/free_deleter.h" |
| 12 #include "base/strings/string_util.h" | 12 #include "base/strings/string_util.h" |
| 13 #include "base/strings/sys_string_conversions.h" | 13 #include "base/strings/sys_string_conversions.h" |
| 14 #include "base/task_runner.h" | 14 #include "base/task_runner.h" |
| 15 #include "base/time/time.h" | 15 #include "base/time/time.h" |
| 16 #include "net/base/net_errors.h" | 16 #include "net/base/net_errors.h" |
| 17 #include "net/proxy/dhcpcsvc_init_win.h" | 17 #include "net/proxy/dhcpcsvc_init_win.h" |
| 18 #include "net/proxy/proxy_script_fetcher_impl.h" | 18 #include "net/proxy/proxy_script_fetcher_impl.h" |
| 19 #include "net/url_request/url_request_context.h" | 19 #include "net/url_request/url_request_context.h" |
| 20 | 20 |
| 21 #include <windows.h> | 21 #include <windows.h> |
| 22 #include <winsock2.h> | 22 #include <winsock2.h> |
| 23 #include <dhcpcsdk.h> | 23 #include <dhcpcsdk.h> |
| 24 #pragma comment(lib, "dhcpcsvc.lib") | |
| 25 | 24 |
| 26 namespace { | 25 namespace { |
| 27 | 26 |
| 28 // Maximum amount of time to wait for response from the Win32 DHCP API. | 27 // Maximum amount of time to wait for response from the Win32 DHCP API. |
| 29 const int kTimeoutMs = 2000; | 28 const int kTimeoutMs = 2000; |
| 30 | 29 |
| 31 } // namespace | 30 } // namespace |
| 32 | 31 |
| 33 namespace net { | 32 namespace net { |
| 34 | 33 |
| (...skipping 249 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 284 // first null in case of embedded NULLs; this is the outer | 283 // first null in case of embedded NULLs; this is the outer |
| 285 // constructor that takes the result of c_str() on the inner. If | 284 // constructor that takes the result of c_str() on the inner. If |
| 286 // the server is giving us back a buffer with embedded NULLs, | 285 // the server is giving us back a buffer with embedded NULLs, |
| 287 // something is broken anyway. Finally, trim trailing whitespace. | 286 // something is broken anyway. Finally, trim trailing whitespace. |
| 288 std::string result(std::string(data, count_bytes).c_str()); | 287 std::string result(std::string(data, count_bytes).c_str()); |
| 289 base::TrimWhitespaceASCII(result, base::TRIM_TRAILING, &result); | 288 base::TrimWhitespaceASCII(result, base::TRIM_TRAILING, &result); |
| 290 return result; | 289 return result; |
| 291 } | 290 } |
| 292 | 291 |
| 293 } // namespace net | 292 } // namespace net |
| OLD | NEW |