Chromium Code Reviews| 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..e2c882825f3350e82530b9bc59ddedc450f43f6d |
| --- /dev/null |
| +++ b/chrome/browser/offline_pages/offliner_user_data.h |
| @@ -0,0 +1,38 @@ |
| +// 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/resource_loading_observer.h" |
| +#include "components/offline_pages/core/background/offliner.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, |
| + Offliner* offliner); |
| + |
| + static Offliner* OfflinerFromWebContents(content::WebContents* webcontents); |
| + |
| + static ResourceLoadingObserver* ResourceTrackerObserverFromWebContents( |
|
RyanSturm
2017/06/16 17:04:45
s/ResourceTrackerObserverFromWebContents/ResourceL
Pete Williamson
2017/06/16 21:16:15
Done.
|
| + content::WebContents* webcontents); |
| + |
| + explicit OfflinerUserData(Offliner* offliner) { offliner_ = offliner; } |
| + Offliner* offliner() { return offliner_; } |
|
RyanSturm
2017/06/16 17:04:45
Why the switch from BackgroundOffliner to Offliner
Pete Williamson
2017/06/16 21:16:15
Done (or rather undone, in this case ^_^)
The ori
|
| + |
| + 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_OFFLINE_PAGES_OFFLINER_USER_DATA_H_ |