OLD | NEW |
---|---|
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 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
93 #import "ios/chrome/browser/ui/overscroll_actions/overscroll_actions_controller. h" | 93 #import "ios/chrome/browser/ui/overscroll_actions/overscroll_actions_controller. h" |
94 #import "ios/chrome/browser/ui/prerender_delegate.h" | 94 #import "ios/chrome/browser/ui/prerender_delegate.h" |
95 #import "ios/chrome/browser/ui/reader_mode/reader_mode_checker.h" | 95 #import "ios/chrome/browser/ui/reader_mode/reader_mode_checker.h" |
96 #import "ios/chrome/browser/ui/reader_mode/reader_mode_controller.h" | 96 #import "ios/chrome/browser/ui/reader_mode/reader_mode_controller.h" |
97 #include "ios/chrome/browser/ui/ui_util.h" | 97 #include "ios/chrome/browser/ui/ui_util.h" |
98 #import "ios/chrome/browser/web/auto_reload_bridge.h" | 98 #import "ios/chrome/browser/web/auto_reload_bridge.h" |
99 #import "ios/chrome/browser/web/external_app_launcher.h" | 99 #import "ios/chrome/browser/web/external_app_launcher.h" |
100 #import "ios/chrome/browser/web/navigation_manager_util.h" | 100 #import "ios/chrome/browser/web/navigation_manager_util.h" |
101 #import "ios/chrome/browser/web/passkit_dialog_provider.h" | 101 #import "ios/chrome/browser/web/passkit_dialog_provider.h" |
102 #include "ios/chrome/browser/web/print_observer.h" | 102 #include "ios/chrome/browser/web/print_observer.h" |
103 #import "ios/chrome/browser/web/tab_id_tab_helper.h" | |
103 #import "ios/chrome/browser/xcallback_parameters.h" | 104 #import "ios/chrome/browser/xcallback_parameters.h" |
104 #include "ios/chrome/grit/ios_strings.h" | 105 #include "ios/chrome/grit/ios_strings.h" |
105 #import "ios/web/navigation/navigation_item_impl.h" | 106 #import "ios/web/navigation/navigation_item_impl.h" |
106 #import "ios/web/navigation/navigation_manager_impl.h" | 107 #import "ios/web/navigation/navigation_manager_impl.h" |
107 #include "ios/web/public/favicon_status.h" | 108 #include "ios/web/public/favicon_status.h" |
108 #include "ios/web/public/favicon_url.h" | 109 #include "ios/web/public/favicon_url.h" |
109 #include "ios/web/public/interstitials/web_interstitial.h" | 110 #include "ios/web/public/interstitials/web_interstitial.h" |
110 #include "ios/web/public/load_committed_details.h" | 111 #include "ios/web/public/load_committed_details.h" |
111 #import "ios/web/public/navigation_manager.h" | 112 #import "ios/web/public/navigation_manager.h" |
112 #include "ios/web/public/referrer.h" | 113 #include "ios/web/public/referrer.h" |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
148 NSString* const kTabClosingCurrentDocumentNotificationForCrashReporting = | 149 NSString* const kTabClosingCurrentDocumentNotificationForCrashReporting = |
149 @"kTabClosingCurrentDocumentNotificationForCrashReporting"; | 150 @"kTabClosingCurrentDocumentNotificationForCrashReporting"; |
150 | 151 |
151 NSString* const kTabUrlKey = @"url"; | 152 NSString* const kTabUrlKey = @"url"; |
152 | 153 |
153 namespace { | 154 namespace { |
154 class TabHistoryContext; | 155 class TabHistoryContext; |
155 class FaviconDriverObserverBridge; | 156 class FaviconDriverObserverBridge; |
156 class TabInfoBarObserver; | 157 class TabInfoBarObserver; |
157 | 158 |
158 // The key under which the Tab ID is stored in the WebState's serializable user | |
159 // data. | |
160 NSString* const kTabIDKey = @"TabID"; | |
161 | |
162 // Name of histogram for recording the state of the tab when the renderer is | 159 // Name of histogram for recording the state of the tab when the renderer is |
163 // terminated. | 160 // terminated. |
164 const char kRendererTerminationStateHistogram[] = | 161 const char kRendererTerminationStateHistogram[] = |
165 "Tab.StateAtRendererTermination"; | 162 "Tab.StateAtRendererTermination"; |
166 | 163 |
167 // Referrer used for clicks on article suggestions on the NTP. | 164 // Referrer used for clicks on article suggestions on the NTP. |
168 const char kChromeContentSuggestionsReferrer[] = | 165 const char kChromeContentSuggestionsReferrer[] = |
169 "https://www.googleapis.com/auth/chrome-content-suggestions"; | 166 "https://www.googleapis.com/auth/chrome-content-suggestions"; |
170 | 167 |
171 // Enum corresponding to UMA's TabForegroundState, for | 168 // Enum corresponding to UMA's TabForegroundState, for |
(...skipping 247 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
419 infobars::InfoBar* new_infobar) { | 416 infobars::InfoBar* new_infobar) { |
420 // Update snapshots after the infobar has been replaced. | 417 // Update snapshots after the infobar has been replaced. |
421 [owner_ updateSnapshotWithOverlay:YES visibleFrameOnly:YES]; | 418 [owner_ updateSnapshotWithOverlay:YES visibleFrameOnly:YES]; |
422 } | 419 } |
423 | 420 |
424 } // anonymous namespace | 421 } // anonymous namespace |
425 | 422 |
426 @implementation Tab | 423 @implementation Tab |
427 | 424 |
428 @synthesize browserState = _browserState; | 425 @synthesize browserState = _browserState; |
429 @synthesize tabId = tabId_; | 426 @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.
| |
430 @synthesize useGreyImageCache = useGreyImageCache_; | 427 @synthesize useGreyImageCache = useGreyImageCache_; |
431 @synthesize isPrerenderTab = _isPrerenderTab; | 428 @synthesize isPrerenderTab = _isPrerenderTab; |
432 @synthesize isLinkLoadingPrerenderTab = isLinkLoadingPrerenderTab_; | 429 @synthesize isLinkLoadingPrerenderTab = isLinkLoadingPrerenderTab_; |
433 @synthesize isVoiceSearchResultsTab = _isVoiceSearchResultsTab; | 430 @synthesize isVoiceSearchResultsTab = _isVoiceSearchResultsTab; |
434 @synthesize passwordController = passwordController_; | 431 @synthesize passwordController = passwordController_; |
435 @synthesize overscrollActionsController = _overscrollActionsController; | 432 @synthesize overscrollActionsController = _overscrollActionsController; |
436 @synthesize readerModeController = readerModeController_; | 433 @synthesize readerModeController = readerModeController_; |
437 @synthesize overscrollActionsControllerDelegate = | 434 @synthesize overscrollActionsControllerDelegate = |
438 overscrollActionsControllerDelegate_; | 435 overscrollActionsControllerDelegate_; |
439 @synthesize passKitDialogProvider = passKitDialogProvider_; | 436 @synthesize passKitDialogProvider = passKitDialogProvider_; |
(...skipping 168 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
608 net::UnescapeRule::SPACES, nullptr, nullptr, nullptr); | 605 net::UnescapeRule::SPACES, nullptr, nullptr, nullptr); |
609 return base::SysUTF16ToNSString(urlText); | 606 return base::SysUTF16ToNSString(urlText); |
610 } | 607 } |
611 | 608 |
612 - (NSString*)tabId { | 609 - (NSString*)tabId { |
613 if (!self.webState) { | 610 if (!self.webState) { |
614 // Tab can outlive WebState, in which case Tab is not valid anymore and | 611 // Tab can outlive WebState, in which case Tab is not valid anymore and |
615 // tabId should be nil. | 612 // tabId should be nil. |
616 return nil; | 613 return nil; |
617 } | 614 } |
618 | 615 return base::SysUTF8ToNSString( |
619 if (tabId_) | 616 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
| |
620 return tabId_; | |
621 | |
622 web::SerializableUserDataManager* userDataManager = | |
623 web::SerializableUserDataManager::FromWebState(self.webState); | |
624 NSString* tabId = base::mac::ObjCCast<NSString>( | |
625 userDataManager->GetValueForSerializationKey(kTabIDKey)); | |
626 | |
627 if (!tabId || ![tabId length]) { | |
628 tabId = [[NSUUID UUID] UUIDString]; | |
629 userDataManager->AddSerializableData(tabId, kTabIDKey); | |
630 } | |
631 | |
632 tabId_ = [tabId copy]; | |
633 return tabId_; | |
634 } | 617 } |
635 | 618 |
636 - (web::WebState*)webState { | 619 - (web::WebState*)webState { |
637 return _webStateImpl; | 620 return _webStateImpl; |
638 } | 621 } |
639 | 622 |
640 - (void)fetchFavicon { | 623 - (void)fetchFavicon { |
641 const GURL& url = self.visibleURL; | 624 const GURL& url = self.visibleURL; |
642 if (!url.is_valid()) | 625 if (!url.is_valid()) |
643 return; | 626 return; |
(...skipping 1186 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1830 | 1813 |
1831 - (TabModel*)parentTabModel { | 1814 - (TabModel*)parentTabModel { |
1832 return _parentTabModel; | 1815 return _parentTabModel; |
1833 } | 1816 } |
1834 | 1817 |
1835 - (FormInputAccessoryViewController*)inputAccessoryViewController { | 1818 - (FormInputAccessoryViewController*)inputAccessoryViewController { |
1836 return _inputAccessoryViewController; | 1819 return _inputAccessoryViewController; |
1837 } | 1820 } |
1838 | 1821 |
1839 @end | 1822 @end |
OLD | NEW |