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_CLIENT_PLUGIN_PEPPER_URL_LOADER_H_ | 5 #ifndef REMOTING_CLIENT_PLUGIN_PEPPER_URL_LOADER_H_ |
6 #define REMOTING_CLIENT_PLUGIN_PEPPER_URL_LOADER_H_ | 6 #define REMOTING_CLIENT_PLUGIN_PEPPER_URL_LOADER_H_ |
7 | 7 |
8 #include "base/callback.h" | 8 #include "base/callback.h" |
| 9 #include "net/traffic_annotation/network_traffic_annotation.h" |
9 #include "ppapi/cpp/instance_handle.h" | 10 #include "ppapi/cpp/instance_handle.h" |
10 #include "ppapi/cpp/url_loader.h" | 11 #include "ppapi/cpp/url_loader.h" |
11 #include "ppapi/cpp/url_request_info.h" | 12 #include "ppapi/cpp/url_request_info.h" |
12 #include "ppapi/utility/completion_callback_factory.h" | 13 #include "ppapi/utility/completion_callback_factory.h" |
13 #include "remoting/base/url_request.h" | 14 #include "remoting/base/url_request.h" |
14 | 15 |
15 namespace remoting { | 16 namespace remoting { |
16 | 17 |
17 // UrlRequest implementation that uses URLLoader provided by Pepper. | 18 // UrlRequest implementation that uses URLLoader provided by Pepper. |
18 class PepperUrlRequest : public UrlRequest { | 19 class PepperUrlRequest : public UrlRequest { |
19 public: | 20 public: |
20 PepperUrlRequest(pp::InstanceHandle pp_instance, | 21 PepperUrlRequest(pp::InstanceHandle pp_instance, |
21 UrlRequest::Type type, | 22 UrlRequest::Type type, |
22 const std::string& url); | 23 const std::string& url, |
| 24 const net::NetworkTrafficAnnotationTag& traffic_annotation); |
23 ~PepperUrlRequest() override; | 25 ~PepperUrlRequest() override; |
24 | 26 |
25 // UrlRequest interface. | 27 // UrlRequest interface. |
26 void AddHeader(const std::string& value) override; | 28 void AddHeader(const std::string& value) override; |
27 void SetPostData(const std::string& content_type, | 29 void SetPostData(const std::string& content_type, |
28 const std::string& data) override; | 30 const std::string& data) override; |
29 void Start(const OnResultCallback& on_result_callback) override; | 31 void Start(const OnResultCallback& on_result_callback) override; |
30 | 32 |
31 private: | 33 private: |
32 void OnUrlOpened(int32_t result); | 34 void OnUrlOpened(int32_t result); |
(...skipping 14 matching lines...) Expand all Loading... |
47 | 49 |
48 DISALLOW_COPY_AND_ASSIGN(PepperUrlRequest); | 50 DISALLOW_COPY_AND_ASSIGN(PepperUrlRequest); |
49 }; | 51 }; |
50 | 52 |
51 class PepperUrlRequestFactory : public UrlRequestFactory { | 53 class PepperUrlRequestFactory : public UrlRequestFactory { |
52 public: | 54 public: |
53 PepperUrlRequestFactory(pp::InstanceHandle pp_instance); | 55 PepperUrlRequestFactory(pp::InstanceHandle pp_instance); |
54 ~PepperUrlRequestFactory() override; | 56 ~PepperUrlRequestFactory() override; |
55 | 57 |
56 // UrlRequestFactory interface. | 58 // UrlRequestFactory interface. |
57 std::unique_ptr<UrlRequest> CreateUrlRequest(UrlRequest::Type type, | 59 std::unique_ptr<UrlRequest> CreateUrlRequest( |
58 const std::string& url) override; | 60 UrlRequest::Type type, |
| 61 const std::string& url, |
| 62 const net::NetworkTrafficAnnotationTag& traffic_annotation) override; |
59 | 63 |
60 private: | 64 private: |
61 pp::InstanceHandle pp_instance_; | 65 pp::InstanceHandle pp_instance_; |
62 | 66 |
63 DISALLOW_COPY_AND_ASSIGN(PepperUrlRequestFactory); | 67 DISALLOW_COPY_AND_ASSIGN(PepperUrlRequestFactory); |
64 }; | 68 }; |
65 | 69 |
66 } // namespace remoting | 70 } // namespace remoting |
67 | 71 |
68 #endif // REMOTING_CLIENT_PLUGIN_PEPPER_URL_LOADER_H_ | 72 #endif // REMOTING_CLIENT_PLUGIN_PEPPER_URL_LOADER_H_ |
OLD | NEW |