OLD | NEW |
| (Empty) |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | |
2 // Use of this source code is governed by a BSD-style license that can be | |
3 // found in the LICENSE file. | |
4 | |
5 #ifndef COMPONENTS_WEB_VIEW_URL_REQUEST_CLONEABLE_H_ | |
6 #define COMPONENTS_WEB_VIEW_URL_REQUEST_CLONEABLE_H_ | |
7 | |
8 #include <string> | |
9 #include <vector> | |
10 | |
11 #include "base/basictypes.h" | |
12 #include "mojo/services/network/public/interfaces/url_loader.mojom.h" | |
13 | |
14 namespace web_view { | |
15 | |
16 // This class caches data associated with a mojo::URLRequest and vends copies | |
17 // of the request for the WebView system. Copies are used for repeated | |
18 // navigations, but URLRequest structs are not copyable, as they contain | |
19 // handles to transfer large amounts of data between processes, so we | |
20 // immediately read the data from pipes and keep a copy here. | |
21 class URLRequestCloneable { | |
22 public: | |
23 explicit URLRequestCloneable(mojo::URLRequestPtr original_request); | |
24 ~URLRequestCloneable(); | |
25 | |
26 // Creates a new URLRequest. | |
27 mojo::URLRequestPtr Clone() const; | |
28 | |
29 private: | |
30 // All of these are straight from mojo::URLRequest. | |
31 mojo::String url_; | |
32 mojo::String method_; | |
33 mojo::Array<mojo::HttpHeaderPtr> headers_; | |
34 uint32_t response_body_buffer_size_; | |
35 bool auto_follow_redirects_; | |
36 bool bypass_cache_; | |
37 | |
38 // Whether the body mojo array in the |original_request| was null. We keep | |
39 // track of this so we can differentiate between null arrays and empty | |
40 // arrays. | |
41 bool original_body_null_; | |
42 | |
43 // This is a serialized version of the data from mojo::URLRequest. We copy | |
44 // this data straight out of the data pipes, and then serve it any time that | |
45 // AsURLRequest() is called. | |
46 std::vector<std::string> body_; | |
47 | |
48 DISALLOW_COPY_AND_ASSIGN(URLRequestCloneable); | |
49 }; | |
50 | |
51 } // namespace web_view | |
52 | |
53 #endif // COMPONENTS_WEB_VIEW_URL_REQUEST_CLONEABLE_H_ | |
OLD | NEW |