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

Unified Diff: components/data_reduction_proxy/core/browser/data_reduction_proxy_data.h

Issue 1721813002: Adding DRP specfic UMA for FirstContentfulPaint (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: NavigationData final draft before adding tests Created 4 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 side-by-side diff with in-line comments
Download patch
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
+// storage vehicles to communicate information in one object.
+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_; }
+ 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.
+ bool get_is_using_lofi() { return is_using_lofi_; }
+ 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,
+ bool add_if_not_exist);
+ // Create a brand new instance of DataReductionProxyData that could be used in
+ // a different thread.
+ 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_

Powered by Google App Engine
This is Rietveld 408576698