Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(19)

Side by Side Diff: components/data_reduction_proxy/core/browser/data_reduction_proxy_data.h

Issue 2833523002: Adding opt out and previews type information to DRP pingback (Closed)
Patch Set: moved definition up Created 3 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 COMPONENTS_DATA_REDUCTION_PROXY_CORE_BROWSER_DATA_REDUCTION_PROXY_DATA_H _ 5 #ifndef COMPONENTS_DATA_REDUCTION_PROXY_CORE_BROWSER_DATA_REDUCTION_PROXY_DATA_H _
6 #define COMPONENTS_DATA_REDUCTION_PROXY_CORE_BROWSER_DATA_REDUCTION_PROXY_DATA_H _ 6 #define COMPONENTS_DATA_REDUCTION_PROXY_CORE_BROWSER_DATA_REDUCTION_PROXY_DATA_H _
7 7
8 #include <memory> 8 #include <memory>
9 #include <string> 9 #include <string>
10 10
(...skipping 23 matching lines...) Expand all
34 } 34 }
35 35
36 // Whether Lo-Fi was requested for this request or navigation. True if the 36 // Whether Lo-Fi was requested for this request or navigation. True if the
37 // session is in Lo-Fi control or enabled group, and the network quality is 37 // session is in Lo-Fi control or enabled group, and the network quality is
38 // slow. 38 // slow.
39 bool lofi_requested() const { return lofi_requested_; } 39 bool lofi_requested() const { return lofi_requested_; }
40 void set_lofi_requested(bool lofi_requested) { 40 void set_lofi_requested(bool lofi_requested) {
41 lofi_requested_ = lofi_requested; 41 lofi_requested_ = lofi_requested;
42 } 42 }
43 43
44 // Whether a lite page response was seen for the request or navigation.
45 bool lite_page_received() const { return lite_page_received_; }
46 void set_lite_page_received(bool lite_page_received) {
47 lite_page_received_ = lite_page_received;
48 }
49
50 // Whether a lite page response was seen for the request or navigation.
51 bool lofi_received() const { return lofi_received_; }
52 void set_lofi_received(bool lofi_received) { lofi_received_ = lofi_received; }
53
44 // The session key used for this request. 54 // The session key used for this request.
45 std::string session_key() const { return session_key_; } 55 std::string session_key() const { return session_key_; }
46 void set_session_key(const std::string& session_key) { 56 void set_session_key(const std::string& session_key) {
47 session_key_ = session_key; 57 session_key_ = session_key;
48 } 58 }
49 59
50 // The URL the frame is navigating to. This may change during the navigation 60 // The URL the frame is navigating to. This may change during the navigation
51 // when encountering a server redirect. 61 // when encountering a server redirect.
52 GURL request_url() const { return request_url_; } 62 GURL request_url() const { return request_url_; }
53 void set_request_url(const GURL& request_url) { request_url_ = request_url; } 63 void set_request_url(const GURL& request_url) { request_url_ = request_url; }
54 64
55 // The EffectiveConnectionType after the proxy is resolved. This is set for 65 // The EffectiveConnectionType after the proxy is resolved. This is set for
56 // main frame requests only. 66 // main frame requests only.
57 net::EffectiveConnectionType effective_connection_type() const { 67 net::EffectiveConnectionType effective_connection_type() const {
58 return effective_connection_type_; 68 return effective_connection_type_;
59 } 69 }
60 void set_effective_connection_type( 70 void set_effective_connection_type(
61 const net::EffectiveConnectionType& effective_connection_type) { 71 const net::EffectiveConnectionType& effective_connection_type) {
62 effective_connection_type_ = effective_connection_type; 72 effective_connection_type_ = effective_connection_type;
63 } 73 }
64 74
65 // An identifier that is guaranteed to be unique to each page load during a 75 // An identifier that is guaranteed to be unique to each page load during a
66 // data saver session. Only present on main frame requests. 76 // data saver session. Only present on main frame requests.
67 base::Optional<uint64_t> page_id() const { return page_id_; } 77 const base::Optional<uint64_t>& page_id() const { return page_id_; }
bengr 2017/04/20 17:36:18 #include <stdint.h>
RyanSturm 2017/04/20 20:25:44 Done.
68 void set_page_id(uint64_t page_id) { page_id_ = page_id; } 78 void set_page_id(uint64_t page_id) { page_id_ = page_id; }
69 79
70 // Removes |this| from |request|. 80 // Removes |this| from |request|.
71 static void ClearData(net::URLRequest* request); 81 static void ClearData(net::URLRequest* request);
72 82
73 // Returns the Data from the URLRequest's UserData. 83 // Returns the Data from the URLRequest's UserData.
74 static DataReductionProxyData* GetData(const net::URLRequest& request); 84 static DataReductionProxyData* GetData(const net::URLRequest& request);
75 // Returns the Data for a given URLRequest. If there is currently no 85 // Returns the Data for a given URLRequest. If there is currently no
76 // DataReductionProxyData on URLRequest, it creates one, and adds it to the 86 // DataReductionProxyData on URLRequest, it creates one, and adds it to the
77 // URLRequest's UserData, and returns a raw pointer to the new instance. 87 // URLRequest's UserData, and returns a raw pointer to the new instance.
78 static DataReductionProxyData* GetDataAndCreateIfNecessary( 88 static DataReductionProxyData* GetDataAndCreateIfNecessary(
79 net::URLRequest* request); 89 net::URLRequest* request);
80 90
81 // Create a brand new instance of DataReductionProxyData that could be used in 91 // Create a brand new instance of DataReductionProxyData that could be used in
82 // a different thread. Several of deep copies may occur per navigation, so 92 // a different thread. Several of deep copies may occur per navigation, so
83 // this is inexpensive. 93 // this is inexpensive.
84 std::unique_ptr<DataReductionProxyData> DeepCopy() const; 94 std::unique_ptr<DataReductionProxyData> DeepCopy() const;
85 95
86 private: 96 private:
87 // Whether the DataReductionProxy was used for this request or navigation. 97 // Whether the DataReductionProxy was used for this request or navigation.
88 bool used_data_reduction_proxy_; 98 bool used_data_reduction_proxy_;
89 99
90 // Whether Lo-Fi was requested for this request or navigation. True if the 100 // Whether Lo-Fi was requested for this request or navigation. True if the
91 // session is in Lo-Fi control or enabled group, and the network quality is 101 // session is in Lo-Fi control or enabled group, and the network quality is
92 // slow. 102 // slow.
93 bool lofi_requested_; 103 bool lofi_requested_;
94 104
105 // Whether a lite page response was seen for the request or navigation.
106 bool lite_page_received_;
107
108 // Whether a lite page response was seen for the request or navigation.
109 bool lofi_received_;
110
95 // The session key used for this request or navigation. 111 // The session key used for this request or navigation.
96 std::string session_key_; 112 std::string session_key_;
97 113
98 // The URL the frame is navigating to. This may change during the navigation 114 // The URL the frame is navigating to. This may change during the navigation
99 // when encountering a server redirect. 115 // when encountering a server redirect.
100 GURL request_url_; 116 GURL request_url_;
101 117
102 // The EffectiveConnectionType when the request or navigation starts. This is 118 // The EffectiveConnectionType when the request or navigation starts. This is
103 // set for main frame requests only. 119 // set for main frame requests only.
104 net::EffectiveConnectionType effective_connection_type_; 120 net::EffectiveConnectionType effective_connection_type_;
105 121
106 // An identifier that is guaranteed to be unique to each page load during a 122 // An identifier that is guaranteed to be unique to each page load during a
107 // data saver session. Only present on main frame requests. 123 // data saver session. Only present on main frame requests.
108 base::Optional<uint64_t> page_id_; 124 base::Optional<uint64_t> page_id_;
109 125
110 DISALLOW_COPY_AND_ASSIGN(DataReductionProxyData); 126 DISALLOW_COPY_AND_ASSIGN(DataReductionProxyData);
111 }; 127 };
112 128
113 } // namespace data_reduction_proxy 129 } // namespace data_reduction_proxy
114 130
115 #endif // COMPONENTS_DATA_REDUCTION_PROXY_CORE_BROWSER_DATA_REDUCTION_PROXY_DAT A_H_ 131 #endif // COMPONENTS_DATA_REDUCTION_PROXY_CORE_BROWSER_DATA_REDUCTION_PROXY_DAT A_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698