Chromium Code Reviews| Index: components/data_reduction_proxy/core/browser/data_reduction_proxy_data.h |
| diff --git a/components/data_reduction_proxy/core/browser/data_reduction_proxy_data.h b/components/data_reduction_proxy/core/browser/data_reduction_proxy_data.h |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..4fcc650e95f625f0e1518d63ef733c9cb6144a1a |
| --- /dev/null |
| +++ b/components/data_reduction_proxy/core/browser/data_reduction_proxy_data.h |
| @@ -0,0 +1,53 @@ |
| +// Copyright 2016 The Chromium Authors. All rights reserved. |
| +// Use of this source code is governed by a BSD-style license that can be |
| +// found in the LICENSE file. |
| + |
| +#ifndef COMPONENTS_DATA_REDUCTION_PROXY_CORE_BROWSER_DATA_REDUCTION_PROXY_DATA_H_ |
| +#define COMPONENTS_DATA_REDUCTION_PROXY_CORE_BROWSER_DATA_REDUCTION_PROXY_DATA_H_ |
| + |
| +#include <memory> |
| + |
| +#include "base/macros.h" |
| +#include "base/supports_user_data.h" |
| + |
| +namespace net { |
| +class URLRequest; |
| +} |
| + |
| +namespace data_reduction_proxy { |
| + |
| +// DataReductionProxy related data that can be put into UserData or other |
|
bengr
2016/04/29 21:14:22
DataReductionProxy-related
RyanSturm
2016/05/02 19:52:20
Done.
|
| +// storage vehicles to communicate information in one object. |
|
bengr
2016/04/29 21:14:21
"to communicated information in one object" -> "to
RyanSturm
2016/05/02 19:52:20
Done.
|
| +class DataReductionProxyData : public base::SupportsUserData::Data { |
| + public: |
| + DataReductionProxyData(); |
| + // Whether the DataReductionProxy was used for this request or navigation. |
| + bool get_used_data_reduction_proxy() { return used_data_reduction_proxy_; } |
|
bengr
2016/04/29 21:14:21
remove "get_"
RyanSturm
2016/05/02 19:52:20
Done.
|
| + void set_used_data_reduction_proxy(bool used_data_reduction_proxy) { |
| + used_data_reduction_proxy_ = used_data_reduction_proxy; |
| + } |
| + // Whether Lo-Fi was turned on for this request or navigation. |
|
bengr
2016/04/29 21:14:21
If this really means that Lo-Fi was requested for
RyanSturm
2016/05/02 19:52:20
I shortened to lofi_requested.
|
| + bool get_is_using_lofi() { return is_using_lofi_; } |
|
bengr
2016/04/29 21:14:21
remove "get_"
RyanSturm
2016/05/02 19:52:20
Done.
|
| + void set_is_using_lofi(bool is_using_lofi) { is_using_lofi_ = is_using_lofi; } |
| + // Returns the Data for a a given URLRequest. If |add_if_not_exist| is true |
| + // and there is currently no DataReductionProxyData on URLRequest, creates |
| + // one, adds it to the URLRequest's UserData, and returns a raw pointer to the |
| + // new instance. |
| + static DataReductionProxyData* DataForRequest(net::URLRequest* request, |
|
bengr
2016/04/29 21:14:22
GetData, or GetDataForRequest
RyanSturm
2016/05/02 19:52:20
Done.
|
| + bool add_if_not_exist); |
| + // Create a brand new instance of DataReductionProxyData that could be used in |
| + // a different thread. |
|
bengr
2016/04/29 21:14:22
Note that we expect several of deep copies per nav
RyanSturm
2016/05/02 19:52:20
Done.
|
| + std::unique_ptr<DataReductionProxyData> DeepCopy() const; |
| + |
| + private: |
| + // Whether the DataReductionProxy was used for this request or navigation. |
| + bool used_data_reduction_proxy_; |
| + // Whether Lo-Fi was turned on for this request or navigation. |
| + bool is_using_lofi_; |
| + |
| + DISALLOW_COPY_AND_ASSIGN(DataReductionProxyData); |
| +}; |
| + |
| +} // namespace data_reduction_proxy |
| + |
| +#endif // COMPONENTS_DATA_REDUCTION_PROXY_CORE_BROWSER_DATA_REDUCTION_PROXY_DATA_H_ |