OLD | NEW |
(Empty) | |
| 1 // Copyright 2017 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #ifndef CHROME_BROWSER_OFFLINE_PAGES_OFFLINER_USER_DATA_H_ |
| 6 #define CHROME_BROWSER_OFFLINE_PAGES_OFFLINER_USER_DATA_H_ |
| 7 |
| 8 #include "components/offline_pages/core/background/offliner.h" |
| 9 #include "content/public/browser/web_contents_user_data.h" |
| 10 |
| 11 namespace offline_pages { |
| 12 |
| 13 class OfflinerUserData : public content::WebContentsUserData<OfflinerUserData> { |
| 14 public: |
| 15 static void AddToWebContents(content::WebContents* webcontents, |
| 16 Offliner* offliner); |
| 17 |
| 18 static Offliner* OfflinerFromWebContents(content::WebContents* webcontents); |
| 19 |
| 20 explicit OfflinerUserData(Offliner* offliner) { offliner_ = offliner; } |
| 21 Offliner* offliner() { return offliner_; } |
| 22 |
| 23 private: |
| 24 // The offliner that the WebContents is attached to. The offliner owns the |
| 25 // Delegate which owns the WebContents that this data is attached to. |
| 26 // Therefore, its lifetime should exceed that of the WebContents, so this |
| 27 // should always be non-null. |
| 28 Offliner* offliner_; |
| 29 }; |
| 30 |
| 31 } // namespace offline_pages |
| 32 |
| 33 #endif // CHROME_BROWSER_OFFLINE_PAGES_OFFLINER_USER_DATA_H_ |
OLD | NEW |