Chromium Code Reviews| Index: content/public/common/data_reduction_proxy_lofi_user_data.h |
| diff --git a/content/public/common/data_reduction_proxy_lofi_user_data.h b/content/public/common/data_reduction_proxy_lofi_user_data.h |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..d9a5705747649f9851cab99654b9fe3973853f10 |
| --- /dev/null |
| +++ b/content/public/common/data_reduction_proxy_lofi_user_data.h |
| @@ -0,0 +1,42 @@ |
| +// Copyright 2015 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 CONTENT_PUBLIC_COMMON_DATA_REDUCTION_PROXY_LOFI_USER_DATA_H_ |
| +#define CONTENT_PUBLIC_COMMON_DATA_REDUCTION_PROXY_LOFI_USER_DATA_H_ |
| + |
| +#include "base/supports_user_data.h" |
| + |
| +namespace content { |
| + |
| +// The LoFi state which determines whether to add the LoFi header. Must stay in |
| +// sync with the enum in data_reduction_proxy_lofi_helper.h. |
| +enum LoFiState { |
| + // Request a LoFi version of the resource. |
| + LOFI_ON = 0, |
| + // Request a normal (non-LoFi) version of the resource. |
| + LOFI_OFF, |
| + // Let the browser process decide whether or not to request the LoFi version. |
| + LOFI_DEFAULT, |
|
mmenke
2015/09/21 18:03:48
This seems weird - seems to me like this should no
megjablon
2015/09/22 20:35:52
LOFI_DEFAULT is only used by navigation requests t
mmenke
2015/09/22 20:38:12
That sounds reasonable - in that case, I think we
megjablon
2015/09/22 20:53:40
Maybe I didn't explain this right. We need to be a
mmenke
2015/09/22 20:57:07
Right, but DataReductionProxyLoFiUserData is assoc
megjablon
2015/09/22 21:20:26
The navigation creates a URLRequest and when that
|
| +}; |
| + |
| +// Used to annotate URLRequests with the Data Reduction Proxy LoFiState. |
| +class DataReductionProxyLoFiUserData : public base::SupportsUserData::Data { |
| + public: |
| + DataReductionProxyLoFiUserData(LoFiState lofi_state); |
| + ~DataReductionProxyLoFiUserData() override; |
| + |
| + LoFiState lofi_state() const { return lofi_state_; } |
| + void set_lofi_state(LoFiState lofi_state) { lofi_state_ = lofi_state; } |
|
mmenke
2015/09/21 18:03:48
Should this just be a value in ResourceRequestInfo
megjablon
2015/09/22 20:35:52
This sounds like a good and simpler idea to me. da
davidben
2015/09/22 22:20:50
Yes, please do that. But exposing a mutator here s
mmenke
2015/09/22 22:36:28
As discussed offline, this makes me, at least, muc
megjablon
2015/09/23 23:15:24
Done! LTAL and let me know if you want to move any
|
| + |
| + static const void* kUserDataKey; |
| + |
| + private: |
| + // Whether or not to request a LoFi version of the resource or let the |
| + // browser decide. |
| + LoFiState lofi_state_; |
| +}; |
| + |
| +} // namespace content |
| + |
| +#endif // CONTENT_PUBLIC_COMMON_DATA_REDUCTION_PROXY_LOFI_USER_DATA_H_ |