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

Unified Diff: chrome/browser/offline_pages/offliner_user_data.h

Issue 2933193003: Headers for resource tracking. (Closed)
Patch Set: CR feedback from RyanSturm Created 3 years, 6 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/offline_pages/offliner_user_data.h
diff --git a/chrome/browser/offline_pages/offliner_user_data.h b/chrome/browser/offline_pages/offliner_user_data.h
new file mode 100644
index 0000000000000000000000000000000000000000..9ed7c6a137b15e32f0b2a668ee2dcfc8507a0fde
--- /dev/null
+++ b/chrome/browser/offline_pages/offliner_user_data.h
@@ -0,0 +1,41 @@
+// 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_OFFLINE_PAGES_OFFLINER_USER_DATA_H_
+#define CHROME_BROWSER_OFFLINE_PAGES_OFFLINER_USER_DATA_H_
+
+#include "chrome/browser/offline_pages/background_loader_offliner.h"
+#include "chrome/browser/offline_pages/resource_loading_observer.h"
+#include "components/offline_pages/features/features.h"
+#include "content/public/browser/web_contents_user_data.h"
+
+namespace offline_pages {
+
+class OfflinerUserData : public content::WebContentsUserData<OfflinerUserData> {
+ public:
+ static void AddToWebContents(content::WebContents* webcontents,
+ BackgroundLoaderOffliner* offliner);
+
+ static BackgroundLoaderOffliner* OfflinerFromWebContents(
+ content::WebContents* webcontents);
+
+ static ResourceLoadingObserver* ResourceLoadingObserverFromWebContents(
+ content::WebContents* webcontents);
+
+ explicit OfflinerUserData(BackgroundLoaderOffliner* offliner) {
+ offliner_ = offliner;
+ }
+ BackgroundLoaderOffliner* 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.
+ BackgroundLoaderOffliner* offliner_;
+};
+
+} // namespace offline_pages
+
+#endif // CHROME_BROWSER_OFFLINE_PAGES_OFFLINER_USER_DATA_H_
« no previous file with comments | « chrome/browser/offline_pages/background_loader_offliner.cc ('k') | chrome/browser/offline_pages/offliner_user_data.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698