| 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 {
|
|
|