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

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

Issue 2956483003: [ios] TabIdTabHelper (Closed)
Patch Set: Refactor Tab to use TabIDTabHelper. Created 3 years, 6 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 90ddf437ecb4d217afc81fff327f9c681f5491d4..e03bf262949a69fcb56cb315bb8c9fba977a5fd4 100644
--- a/ios/chrome/browser/tabs/tab.mm
+++ b/ios/chrome/browser/tabs/tab.mm
@@ -100,6 +100,7 @@
#import "ios/chrome/browser/web/navigation_manager_util.h"
#import "ios/chrome/browser/web/passkit_dialog_provider.h"
#include "ios/chrome/browser/web/print_observer.h"
+#import "ios/chrome/browser/web/tab_id_tab_helper.h"
#import "ios/chrome/browser/xcallback_parameters.h"
#include "ios/chrome/grit/ios_strings.h"
#import "ios/web/navigation/navigation_item_impl.h"
@@ -155,10 +156,6 @@ class TabHistoryContext;
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[] =
@@ -426,7 +423,7 @@ void TabInfoBarObserver::OnInfoBarReplaced(infobars::InfoBar* old_infobar,
@implementation Tab
@synthesize browserState = _browserState;
-@synthesize tabId = tabId_;
+@dynamic tabId;
marq (ping after 24h) 2017/06/23 08:46:29 You only need @dynamic when no implementation of t
edchin 2017/06/23 16:24:21 Done.
@synthesize useGreyImageCache = useGreyImageCache_;
@synthesize isPrerenderTab = _isPrerenderTab;
@synthesize isLinkLoadingPrerenderTab = isLinkLoadingPrerenderTab_;
@@ -615,22 +612,8 @@ void TabInfoBarObserver::OnInfoBarReplaced(infobars::InfoBar* old_infobar,
// tabId should be nil.
return nil;
}
-
- if (tabId_)
- return tabId_;
-
- web::SerializableUserDataManager* userDataManager =
- web::SerializableUserDataManager::FromWebState(self.webState);
- NSString* tabId = base::mac::ObjCCast<NSString>(
- userDataManager->GetValueForSerializationKey(kTabIDKey));
-
- if (!tabId || ![tabId length]) {
- tabId = [[NSUUID UUID] UUIDString];
- userDataManager->AddSerializableData(tabId, kTabIDKey);
- }
-
- tabId_ = [tabId copy];
- return tabId_;
+ return base::SysUTF8ToNSString(
+ TabIDTabHelper::FromWebState(self.webState)->tab_id());
rohitrao (ping after 24h) 2017/06/23 11:10:27 Is the TabID always used as an NSString? If so, s
edchin 2017/06/23 16:24:21 My original intent is to be consistent with ios/we
}
- (web::WebState*)webState {

Powered by Google App Engine
This is Rietveld 408576698