| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 #ifndef CHROME_BROWSER_CHROMEOS_LOGIN_TEST_HTTPS_FORWARDER_H_ | 5 #ifndef CHROME_BROWSER_CHROMEOS_LOGIN_TEST_HTTPS_FORWARDER_H_ |
| 6 #define CHROME_BROWSER_CHROMEOS_LOGIN_TEST_HTTPS_FORWARDER_H_ | 6 #define CHROME_BROWSER_CHROMEOS_LOGIN_TEST_HTTPS_FORWARDER_H_ |
| 7 | 7 |
| 8 #include <memory> |
| 8 #include <string> | 9 #include <string> |
| 9 | 10 |
| 10 #include "base/compiler_specific.h" | 11 #include "base/compiler_specific.h" |
| 11 #include "base/macros.h" | 12 #include "base/macros.h" |
| 12 #include "base/memory/scoped_ptr.h" | |
| 13 #include "url/gurl.h" | 13 #include "url/gurl.h" |
| 14 | 14 |
| 15 namespace chromeos { | 15 namespace chromeos { |
| 16 | 16 |
| 17 class ForwardingServer; | 17 class ForwardingServer; |
| 18 | 18 |
| 19 // An https test server that forwards all requests to another server. This | 19 // An https test server that forwards all requests to another server. This |
| 20 // allows a server that supports http only to be accessed over https. | 20 // allows a server that supports http only to be accessed over https. |
| 21 // | 21 // |
| 22 // The server will bind to |127.0.0.1| but will present a certificate issued to | 22 // The server will bind to |127.0.0.1| but will present a certificate issued to |
| 23 // |ssl_host|. | 23 // |ssl_host|. |
| 24 class HTTPSForwarder { | 24 class HTTPSForwarder { |
| 25 public: | 25 public: |
| 26 HTTPSForwarder(); | 26 HTTPSForwarder(); |
| 27 ~HTTPSForwarder(); | 27 ~HTTPSForwarder(); |
| 28 | 28 |
| 29 // Returns a URL that uses |ssl_host_| as the host. | 29 // Returns a URL that uses |ssl_host_| as the host. |
| 30 GURL GetURLForSSLHost(const std::string& path) const; | 30 GURL GetURLForSSLHost(const std::string& path) const; |
| 31 | 31 |
| 32 bool Initialize(const std::string& ssl_host, | 32 bool Initialize(const std::string& ssl_host, |
| 33 const GURL& forward_target) WARN_UNUSED_RESULT; | 33 const GURL& forward_target) WARN_UNUSED_RESULT; |
| 34 | 34 |
| 35 private: | 35 private: |
| 36 std::string ssl_host_; | 36 std::string ssl_host_; |
| 37 | 37 |
| 38 scoped_ptr<ForwardingServer> forwarding_server_; | 38 std::unique_ptr<ForwardingServer> forwarding_server_; |
| 39 | 39 |
| 40 DISALLOW_COPY_AND_ASSIGN(HTTPSForwarder); | 40 DISALLOW_COPY_AND_ASSIGN(HTTPSForwarder); |
| 41 }; | 41 }; |
| 42 | 42 |
| 43 } // namespace chromeos | 43 } // namespace chromeos |
| 44 | 44 |
| 45 #endif // CHROME_BROWSER_CHROMEOS_LOGIN_TEST_HTTPS_FORWARDER_H_ | 45 #endif // CHROME_BROWSER_CHROMEOS_LOGIN_TEST_HTTPS_FORWARDER_H_ |
| OLD | NEW |