Chromium Code Reviews| Index: ios/chrome/browser/tabs/tab.mm |
| diff --git a/ios/chrome/browser/tabs/tab.mm b/ios/chrome/browser/tabs/tab.mm |
| index 9c5817c93f2cc87c952e47199a85086a156df635..5ec26ba270e1b77e5e9c14077800a3a04326c7c6 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[] = |
| @@ -789,8 +794,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); |
|
Eugene But (OOO till 7-30)
2017/02/13 17:37:57
s/tabId/tabID
kkhorimoto
2017/02/13 23:41:18
Done.
|
| + if (!tabId) { |
| + tabId = [[NSUUID UUID] UUIDString]; |
| + userDataManager->AddSerializableData(tabId, kTabIDKey); |
| + } |
| + return base::mac::ObjCCastStrict<NSString>(tabId); |
| } |
| - (web::WebState*)webState { |