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

Side by Side Diff: ios/chrome/browser/tabs/tab.mm

Issue 2693523003: Moved TabID implementation to SerializableUserData. (Closed)
Patch Set: fix compile 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
« no previous file with comments | « no previous file | ios/web/navigation/crw_session_controller.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 589 matching lines...) Expand 10 before | Expand all | Expand 10 after
778 nullptr, nullptr, nullptr); 783 nullptr, nullptr, nullptr);
779 return base::SysUTF16ToNSString(urlText); 784 return base::SysUTF16ToNSString(urlText);
780 } 785 }
781 786
782 - (NSString*)windowName { 787 - (NSString*)windowName {
783 DCHECK([self navigationManager]); 788 DCHECK([self navigationManager]);
784 return [self navigationManager]->GetSessionController().windowName; 789 return [self navigationManager]->GetSessionController().windowName;
785 } 790 }
786 791
787 - (NSString*)tabId { 792 - (NSString*)tabId {
788 DCHECK([self navigationManager]); 793 DCHECK(self.webState);
789 return [[self navigationManager]->GetSessionController() tabId]; 794 web::SerializableUserDataManager* userDataManager =
795 web::SerializableUserDataManager::FromWebState(self.webState);
796 id<NSCoding> tabID = userDataManager->GetValueForSerializationKey(kTabIDKey);
797 if (!tabID) {
798 tabID = [[NSUUID UUID] UUIDString];
799 userDataManager->AddSerializableData(tabID, kTabIDKey);
800 }
801 return base::mac::ObjCCastStrict<NSString>(tabID);
790 } 802 }
791 803
792 - (web::WebState*)webState { 804 - (web::WebState*)webState {
793 return webStateImpl_.get(); 805 return webStateImpl_.get();
794 } 806 }
795 807
796 - (void)fetchFavicon { 808 - (void)fetchFavicon {
797 const GURL& url = self.url; 809 const GURL& url = self.url;
798 if (!url.is_valid()) 810 if (!url.is_valid())
799 return; 811 return;
(...skipping 1410 matching lines...) Expand 10 before | Expand all | Expand 10 after
2210 2222
2211 - (TabModel*)parentTabModel { 2223 - (TabModel*)parentTabModel {
2212 return parentTabModel_; 2224 return parentTabModel_;
2213 } 2225 }
2214 2226
2215 - (FormInputAccessoryViewController*)inputAccessoryViewController { 2227 - (FormInputAccessoryViewController*)inputAccessoryViewController {
2216 return inputAccessoryViewController_.get(); 2228 return inputAccessoryViewController_.get();
2217 } 2229 }
2218 2230
2219 @end 2231 @end
OLDNEW
« no previous file with comments | « no previous file | ios/web/navigation/crw_session_controller.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698