Index: chrome/browser/offline_pages/offliner_user_data.cc |
diff --git a/chrome/browser/offline_pages/offliner_user_data.cc b/chrome/browser/offline_pages/offliner_user_data.cc |
new file mode 100644 |
index 0000000000000000000000000000000000000000..98313055973160086663b8123fd4c0d80ac33cb5 |
--- /dev/null |
+++ b/chrome/browser/offline_pages/offliner_user_data.cc |
@@ -0,0 +1,28 @@ |
+// 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. |
+ |
+#include "chrome/browser/offline_pages/offliner_user_data.h" |
+ |
+namespace offline_pages { |
+ |
+void OfflinerUserData::AddToWebContents(content::WebContents* webcontents, |
+ Offliner* offliner) { |
+ DCHECK(offliner); |
+ webcontents->SetUserData(UserDataKey(), std::unique_ptr<OfflinerUserData>( |
+ new OfflinerUserData(offliner))); |
Dmitry Titov
2017/05/24 23:09:34
formatting...
git cl format?
|
+} |
+ |
+// static |
+Offliner* OfflinerUserData::OfflinerFromWebContents( |
+ content::WebContents* webcontents) { |
+ OfflinerUserData* data = OfflinerUserData::FromWebContents(webcontents); |
+ if (data) |
+ return data->offliner(); |
+ |
+ return nullptr; |
+} |
+ |
+} // namespace offline_pages |
+ |
+DEFINE_WEB_CONTENTS_USER_DATA_KEY(offline_pages::OfflinerUserData); |