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

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

Issue 2693523003: Moved TabID implementation to SerializableUserData. (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/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 {
« no previous file with comments | « no previous file | ios/web/navigation/crw_session_controller.h » ('j') | ios/web/navigation/serializable_user_data_manager_impl.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698