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_BASE_URL_REQUEST_H_ | 5 #ifndef REMOTING_BASE_URL_REQUEST_H_ |
6 #define REMOTING_BASE_URL_REQUEST_H_ | 6 #define REMOTING_BASE_URL_REQUEST_H_ |
7 | 7 |
| 8 #include <memory> |
8 #include <string> | 9 #include <string> |
9 | 10 |
10 #include "base/callback_forward.h" | 11 #include "base/callback_forward.h" |
11 #include "base/memory/scoped_ptr.h" | |
12 | 12 |
13 namespace remoting { | 13 namespace remoting { |
14 | 14 |
15 // Abstract interface for URL requests. | 15 // Abstract interface for URL requests. |
16 class UrlRequest { | 16 class UrlRequest { |
17 public: | 17 public: |
18 enum class Type { | 18 enum class Type { |
19 GET, | 19 GET, |
20 POST, | 20 POST, |
21 }; | 21 }; |
(...skipping 30 matching lines...) Expand all Loading... |
52 | 52 |
53 // Sends a request to the server. |on_response_callback| will be called to | 53 // Sends a request to the server. |on_response_callback| will be called to |
54 // return result of the request. | 54 // return result of the request. |
55 virtual void Start(const OnResultCallback& on_result_callback) = 0; | 55 virtual void Start(const OnResultCallback& on_result_callback) = 0; |
56 }; | 56 }; |
57 | 57 |
58 // Factory for UrlRequest instances. | 58 // Factory for UrlRequest instances. |
59 class UrlRequestFactory { | 59 class UrlRequestFactory { |
60 public: | 60 public: |
61 virtual ~UrlRequestFactory() {} | 61 virtual ~UrlRequestFactory() {} |
62 virtual scoped_ptr<UrlRequest> CreateUrlRequest(UrlRequest::Type type, | 62 virtual std::unique_ptr<UrlRequest> CreateUrlRequest( |
63 const std::string& url) = 0; | 63 UrlRequest::Type type, |
| 64 const std::string& url) = 0; |
64 }; | 65 }; |
65 | 66 |
66 } // namespace remoting | 67 } // namespace remoting |
67 | 68 |
68 #endif // REMOTING_BASE_URL_REQUEST_H_ | 69 #endif // REMOTING_BASE_URL_REQUEST_H_ |
OLD | NEW |