Add 'did_proceed' and 'repeat_visit' to ClientMalwareReportRequest to track CTR.
[chromium-blink-merge.git] / components / web_view / url_request_cloneable.h
blobf9f65307f3befde10a3f97179ba45b285e754587
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.
5 #ifndef COMPONENTS_WEB_VIEW_URL_REQUEST_CLONEABLE_H_
6 #define COMPONENTS_WEB_VIEW_URL_REQUEST_CLONEABLE_H_
8 #include <string>
9 #include <vector>
11 #include "base/basictypes.h"
12 #include "mojo/services/network/public/interfaces/url_loader.mojom.h"
14 namespace web_view {
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();
26 // Creates a new URLRequest.
27 mojo::URLRequestPtr Clone() const;
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_;
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_;
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_;
48 DISALLOW_COPY_AND_ASSIGN(URLRequestCloneable);
51 } // namespace web_view
53 #endif // COMPONENTS_WEB_VIEW_URL_REQUEST_CLONEABLE_H_