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

Side by Side 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 unified diff | Download patch
OLDNEW
1 // Copyright 2012 The Chromium Authors. All rights reserved. 1 // Copyright 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #import "ios/chrome/browser/tabs/tab.h" 5 #import "ios/chrome/browser/tabs/tab.h"
6 6
7 #import <CoreLocation/CoreLocation.h> 7 #import <CoreLocation/CoreLocation.h>
8 #import <UIKit/UIKit.h> 8 #import <UIKit/UIKit.h>
9 9
10 #include <utility> 10 #include <utility>
(...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after
126 #import "ios/public/provider/chrome/browser/native_app_launcher/native_app_white list_manager.h" 126 #import "ios/public/provider/chrome/browser/native_app_launcher/native_app_white list_manager.h"
127 #import "ios/web/navigation/crw_session_controller.h" 127 #import "ios/web/navigation/crw_session_controller.h"
128 #import "ios/web/navigation/crw_session_entry.h" 128 #import "ios/web/navigation/crw_session_entry.h"
129 #import "ios/web/navigation/navigation_item_impl.h" 129 #import "ios/web/navigation/navigation_item_impl.h"
130 #import "ios/web/navigation/navigation_manager_impl.h" 130 #import "ios/web/navigation/navigation_manager_impl.h"
131 #include "ios/web/public/favicon_status.h" 131 #include "ios/web/public/favicon_status.h"
132 #include "ios/web/public/favicon_url.h" 132 #include "ios/web/public/favicon_url.h"
133 #include "ios/web/public/interstitials/web_interstitial.h" 133 #include "ios/web/public/interstitials/web_interstitial.h"
134 #import "ios/web/public/navigation_manager.h" 134 #import "ios/web/public/navigation_manager.h"
135 #include "ios/web/public/referrer.h" 135 #include "ios/web/public/referrer.h"
136 #import "ios/web/public/serializable_user_data_manager.h"
136 #include "ios/web/public/ssl_status.h" 137 #include "ios/web/public/ssl_status.h"
137 #include "ios/web/public/url_scheme_util.h" 138 #include "ios/web/public/url_scheme_util.h"
138 #include "ios/web/public/url_util.h" 139 #include "ios/web/public/url_util.h"
139 #include "ios/web/public/web_client.h" 140 #include "ios/web/public/web_client.h"
140 #import "ios/web/public/web_state/js/crw_js_injection_receiver.h" 141 #import "ios/web/public/web_state/js/crw_js_injection_receiver.h"
141 #import "ios/web/public/web_state/ui/crw_generic_content_view.h" 142 #import "ios/web/public/web_state/ui/crw_generic_content_view.h"
142 #include "ios/web/public/web_state/web_state.h" 143 #include "ios/web/public/web_state/web_state.h"
143 #import "ios/web/public/web_state/web_state_observer_bridge.h" 144 #import "ios/web/public/web_state/web_state_observer_bridge.h"
144 #include "ios/web/public/web_thread.h" 145 #include "ios/web/public/web_thread.h"
145 #import "ios/web/web_state/ui/crw_web_controller.h" 146 #import "ios/web/web_state/ui/crw_web_controller.h"
(...skipping 23 matching lines...) Expand all
169 NSString* const kTabClosingCurrentDocumentNotificationForCrashReporting = 170 NSString* const kTabClosingCurrentDocumentNotificationForCrashReporting =
170 @"kTabClosingCurrentDocumentNotificationForCrashReporting"; 171 @"kTabClosingCurrentDocumentNotificationForCrashReporting";
171 172
172 NSString* const kTabUrlKey = @"url"; 173 NSString* const kTabUrlKey = @"url";
173 174
174 namespace { 175 namespace {
175 class TabHistoryContext; 176 class TabHistoryContext;
176 class FaviconDriverObserverBridge; 177 class FaviconDriverObserverBridge;
177 class TabInfoBarObserver; 178 class TabInfoBarObserver;
178 179
180 // The key under which the Tab ID is stored in the WebState's serializable user
181 // data.
182 NSString* const kTabIDKey = @"TabID";
183
179 // Name of histogram for recording the state of the tab when the renderer is 184 // Name of histogram for recording the state of the tab when the renderer is
180 // terminated. 185 // terminated.
181 const char kRendererTerminationStateHistogram[] = 186 const char kRendererTerminationStateHistogram[] =
182 "Tab.StateAtRendererTermination"; 187 "Tab.StateAtRendererTermination";
183 188
184 // Referrer used for clicks on article suggestions on the NTP. 189 // Referrer used for clicks on article suggestions on the NTP.
185 const char kChromeContentSuggestionsReferrer[] = 190 const char kChromeContentSuggestionsReferrer[] =
186 "https://www.googleapis.com/auth/chrome-content-suggestions"; 191 "https://www.googleapis.com/auth/chrome-content-suggestions";
187 192
188 // Enum corresponding to UMA's TabForegroundState, for 193 // Enum corresponding to UMA's TabForegroundState, for
(...skipping 593 matching lines...) Expand 10 before | Expand all | Expand 10 after
782 nullptr, nullptr, nullptr); 787 nullptr, nullptr, nullptr);
783 return base::SysUTF16ToNSString(urlText); 788 return base::SysUTF16ToNSString(urlText);
784 } 789 }
785 790
786 - (NSString*)windowName { 791 - (NSString*)windowName {
787 DCHECK([self navigationManager]); 792 DCHECK([self navigationManager]);
788 return [self navigationManager]->GetSessionController().windowName; 793 return [self navigationManager]->GetSessionController().windowName;
789 } 794 }
790 795
791 - (NSString*)tabId { 796 - (NSString*)tabId {
792 DCHECK([self navigationManager]); 797 DCHECK(self.webState);
793 return [[self navigationManager]->GetSessionController() tabId]; 798 web::SerializableUserDataManager* userDataManager =
799 web::SerializableUserDataManager::FromWebState(self.webState);
800 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.
801 if (!tabId) {
802 tabId = [[NSUUID UUID] UUIDString];
803 userDataManager->AddSerializableData(tabId, kTabIDKey);
804 }
805 return base::mac::ObjCCastStrict<NSString>(tabId);
794 } 806 }
795 807
796 - (web::WebState*)webState { 808 - (web::WebState*)webState {
797 return webStateImpl_.get(); 809 return webStateImpl_.get();
798 } 810 }
799 811
800 - (void)fetchFavicon { 812 - (void)fetchFavicon {
801 const GURL& url = self.url; 813 const GURL& url = self.url;
802 if (!url.is_valid()) 814 if (!url.is_valid())
803 return; 815 return;
(...skipping 1429 matching lines...) Expand 10 before | Expand all | Expand 10 after
2233 2245
2234 - (TabModel*)parentTabModel { 2246 - (TabModel*)parentTabModel {
2235 return parentTabModel_; 2247 return parentTabModel_;
2236 } 2248 }
2237 2249
2238 - (FormInputAccessoryViewController*)inputAccessoryViewController { 2250 - (FormInputAccessoryViewController*)inputAccessoryViewController {
2239 return inputAccessoryViewController_.get(); 2251 return inputAccessoryViewController_.get();
2240 } 2252 }
2241 2253
2242 @end 2254 @end
OLDNEW
« 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