| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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 REMOTING_PROTOCOL_HTTP_ICE_CONFIG_REQUEST_H_ | 5 #ifndef REMOTING_PROTOCOL_HTTP_ICE_CONFIG_REQUEST_H_ |
| 6 #define REMOTING_PROTOCOL_HTTP_ICE_CONFIG_REQUEST_H_ | 6 #define REMOTING_PROTOCOL_HTTP_ICE_CONFIG_REQUEST_H_ |
| 7 | 7 |
| 8 #include <memory> |
| 9 |
| 8 #include "base/callback.h" | 10 #include "base/callback.h" |
| 9 #include "base/macros.h" | 11 #include "base/macros.h" |
| 10 #include "base/memory/scoped_ptr.h" | |
| 11 #include "remoting/base/url_request.h" | 12 #include "remoting/base/url_request.h" |
| 12 #include "remoting/protocol/ice_config_request.h" | 13 #include "remoting/protocol/ice_config_request.h" |
| 13 | 14 |
| 14 namespace remoting { | 15 namespace remoting { |
| 15 namespace protocol { | 16 namespace protocol { |
| 16 | 17 |
| 17 // IceConfigRequest that fetches IceConfig from using HTTP. If the config has | 18 // IceConfigRequest that fetches IceConfig from using HTTP. If the config has |
| 18 // been fetched succesfully but some parts couldn't be parsed then the returned | 19 // been fetched succesfully but some parts couldn't be parsed then the returned |
| 19 // config contains all entries that were parsed successfully and | 20 // config contains all entries that were parsed successfully and |
| 20 // |expiration_time| is set to Now, i.e. the config is considered expired. | 21 // |expiration_time| is set to Now, i.e. the config is considered expired. |
| 21 class HttpIceConfigRequest : public IceConfigRequest { | 22 class HttpIceConfigRequest : public IceConfigRequest { |
| 22 public: | 23 public: |
| 23 HttpIceConfigRequest(UrlRequestFactory* url_request_factory, | 24 HttpIceConfigRequest(UrlRequestFactory* url_request_factory, |
| 24 const std::string& url); | 25 const std::string& url); |
| 25 ~HttpIceConfigRequest() override; | 26 ~HttpIceConfigRequest() override; |
| 26 | 27 |
| 27 // IceConfigRequest interface. | 28 // IceConfigRequest interface. |
| 28 void Send(const OnIceConfigCallback& callback) override; | 29 void Send(const OnIceConfigCallback& callback) override; |
| 29 | 30 |
| 30 private: | 31 private: |
| 31 void OnResponse(const UrlRequest::Result& result); | 32 void OnResponse(const UrlRequest::Result& result); |
| 32 | 33 |
| 33 std::string url_; | 34 std::string url_; |
| 34 scoped_ptr<UrlRequest> url_request_; | 35 std::unique_ptr<UrlRequest> url_request_; |
| 35 OnIceConfigCallback on_ice_config_callback_; | 36 OnIceConfigCallback on_ice_config_callback_; |
| 36 | 37 |
| 37 DISALLOW_COPY_AND_ASSIGN(HttpIceConfigRequest); | 38 DISALLOW_COPY_AND_ASSIGN(HttpIceConfigRequest); |
| 38 }; | 39 }; |
| 39 | 40 |
| 40 } // namespace protocol | 41 } // namespace protocol |
| 41 } // namespace remoting | 42 } // namespace remoting |
| 42 | 43 |
| 43 #endif // REMOTING_PROTOCOL_HTTP_ICE_CONFIG_REQUEST_H_ | 44 #endif // REMOTING_PROTOCOL_HTTP_ICE_CONFIG_REQUEST_H_ |
| OLD | NEW |