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

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

Issue 2693523003: Moved TabID implementation to SerializableUserData. (Closed)
Patch Set: fix compile 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
« no previous file with comments | « no previous file | ios/web/navigation/crw_session_controller.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ios/chrome/browser/tabs/tab.mm
diff --git a/ios/chrome/browser/tabs/tab.mm b/ios/chrome/browser/tabs/tab.mm
index 7dd1d6e65ed22f3cb52906c3083549605fd230e9..3e4b837fdef4b5fbf03cac9e4c04ec90da9d3715 100644
--- a/ios/chrome/browser/tabs/tab.mm
+++ b/ios/chrome/browser/tabs/tab.mm
@@ -133,6 +133,7 @@
#include "ios/web/public/interstitials/web_interstitial.h"
#import "ios/web/public/navigation_manager.h"
#include "ios/web/public/referrer.h"
+#import "ios/web/public/serializable_user_data_manager.h"
#include "ios/web/public/ssl_status.h"
#include "ios/web/public/url_scheme_util.h"
#include "ios/web/public/url_util.h"
@@ -176,6 +177,10 @@
class FaviconDriverObserverBridge;
class TabInfoBarObserver;
+// The key under which the Tab ID is stored in the WebState's serializable user
+// data.
+NSString* const kTabIDKey = @"TabID";
+
// Name of histogram for recording the state of the tab when the renderer is
// terminated.
const char kRendererTerminationStateHistogram[] =
@@ -785,8 +790,15 @@ - (NSString*)windowName {
}
- (NSString*)tabId {
- DCHECK([self navigationManager]);
- return [[self navigationManager]->GetSessionController() tabId];
+ DCHECK(self.webState);
+ web::SerializableUserDataManager* userDataManager =
+ web::SerializableUserDataManager::FromWebState(self.webState);
+ id<NSCoding> tabID = userDataManager->GetValueForSerializationKey(kTabIDKey);
+ if (!tabID) {
+ tabID = [[NSUUID UUID] UUIDString];
+ userDataManager->AddSerializableData(tabID, kTabIDKey);
+ }
+ return base::mac::ObjCCastStrict<NSString>(tabID);
}
- (web::WebState*)webState {
« no previous file with comments | « no previous file | ios/web/navigation/crw_session_controller.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698