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

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

Issue 2857063002: Add a way to send the resource percentage signal to the RC. (Closed)
Patch Set: CR Feedback per Dimich, BMcQuade, and CSHarrison 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/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);

Powered by Google App Engine
This is Rietveld 408576698