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

Unified Diff: ios/chrome/browser/tabs/legacy_tab_helper.mm

Issue 2681843002: Add mechanism to get the Tab from the associated WebState. (Closed)
Patch Set: Created 3 years, 10 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: ios/chrome/browser/tabs/legacy_tab_helper.mm
diff --git a/ios/chrome/browser/tabs/legacy_tab_helper.mm b/ios/chrome/browser/tabs/legacy_tab_helper.mm
new file mode 100644
index 0000000000000000000000000000000000000000..68544df220a2f16f21efdfa48ad9425bdb641656
--- /dev/null
+++ b/ios/chrome/browser/tabs/legacy_tab_helper.mm
@@ -0,0 +1,23 @@
+// 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.
+
+#import "ios/chrome/browser/tabs/legacy_tab_helper.h"
+
+#import "ios/chrome/browser/tabs/tab.h"
+
+DEFINE_WEB_STATE_USER_DATA_KEY(LegacyTabHelper);
+
+// static
+void LegacyTabHelper::CreateForWebState(web::WebState* web_state, Tab* tab) {
+ DCHECK(web_state);
+ DCHECK(!FromWebState(web_state));
+ web_state->SetUserData(UserDataKey(), new LegacyTabHelper(web_state, tab));
+}
+
+LegacyTabHelper::~LegacyTabHelper() = default;
+
+LegacyTabHelper::LegacyTabHelper(web::WebState* web_state, Tab* tab)
+ : tab_(tab) {
+ DCHECK_EQ(web_state, tab.webState);
+}

Powered by Google App Engine
This is Rietveld 408576698