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

Unified Diff: chrome/browser/page_load_metrics/observers/offliner_user_data.h

Issue 2857063002: Add a way to send the resource percentage signal to the RC. (Closed)
Patch Set: Make sure we don't send notifications unless we are offlining Created 3 years, 7 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: chrome/browser/page_load_metrics/observers/offliner_user_data.h
diff --git a/chrome/browser/page_load_metrics/observers/offliner_user_data.h b/chrome/browser/page_load_metrics/observers/offliner_user_data.h
new file mode 100644
index 0000000000000000000000000000000000000000..03fbdaffa40f81af625b7005f1cdb7ab264ce43c
--- /dev/null
+++ b/chrome/browser/page_load_metrics/observers/offliner_user_data.h
@@ -0,0 +1,33 @@
+// Copyright 2017 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 CHROME_BROWSER_PAGE_LOAD_METRICS_OBSERVERS_OFFLINER_USER_DATA_H_
+#define CHROME_BROWSER_PAGE_LOAD_METRICS_OBSERVERS_OFFLINER_USER_DATA_H_
+
+#include "components/offline_pages/core/background/offliner.h"
+#include "content/public/browser/web_contents_user_data.h"
+
+namespace offline_pages {
+
+class OfflinerUserData : public content::WebContentsUserData<OfflinerUserData> {
Pete Williamson 2017/05/16 17:51:19 Reviewers: This is a kind of odd place for the Us
RyanSturm 2017/05/16 17:56:30 If this is just because it wasn't building resourc
Pete Williamson 2017/05/17 16:53:42 And the file is now moved to its new home, chrome/
+ public:
+ static void AddToWebContents(content::WebContents* webcontents,
+ Offliner* offliner);
+
+ static Offliner* OfflinerFromWebContents(content::WebContents* webcontents);
+
+ explicit OfflinerUserData(Offliner* offliner) { offliner_ = offliner; }
+ Offliner* offliner() { return offliner_; }
+
+ private:
+ // The offliner that the WebContents is attached to. The offliner owns the
+ // Delegate which owns the WebContents that this data is attached to.
+ // Therefore, its lifetime should exceed that of the WebContents, so this
+ // should always be non-null.
+ Offliner* offliner_;
+};
+
+} // namespace offline_pages
+
+#endif // CHROME_BROWSER_PAGE_LOAD_METRICS_OBSERVERS_OFFLINER_USER_DATA_H_

Powered by Google App Engine
This is Rietveld 408576698