| 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 210 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 221 | 221 |
| 222 base::scoped_nsobject<OpenInController> openInController_; | 222 base::scoped_nsobject<OpenInController> openInController_; |
| 223 base::WeakNSProtocol<id<PassKitDialogProvider>> passKitDialogProvider_; | 223 base::WeakNSProtocol<id<PassKitDialogProvider>> passKitDialogProvider_; |
| 224 // TODO(crbug.com/546213): Move this out of Tab, probably to native app | 224 // TODO(crbug.com/546213): Move this out of Tab, probably to native app |
| 225 // launcher since that's the only thing that uses it. | 225 // launcher since that's the only thing that uses it. |
| 226 base::WeakNSProtocol<id<StoreKitLauncher>> storeKitLauncher_; | 226 base::WeakNSProtocol<id<StoreKitLauncher>> storeKitLauncher_; |
| 227 | 227 |
| 228 // Whether or not this tab is currently being displayed. | 228 // Whether or not this tab is currently being displayed. |
| 229 BOOL visible_; | 229 BOOL visible_; |
| 230 | 230 |
| 231 // Used between -webWillStartLoadingURL: and -webDidStartLoadingURL:. | |
| 232 BOOL isUserNavigationEvent_; | |
| 233 | |
| 234 // Holds entries that need to be added to the history DB. Prerender tabs do | 231 // Holds entries that need to be added to the history DB. Prerender tabs do |
| 235 // not write navigation data to the history DB. Instead, they cache history | 232 // not write navigation data to the history DB. Instead, they cache history |
| 236 // data in this vector and add it to the DB when the prerender status is | 233 // data in this vector and add it to the DB when the prerender status is |
| 237 // removed (when the Tab is swapped in as a real Tab). | 234 // removed (when the Tab is swapped in as a real Tab). |
| 238 std::vector<history::HistoryAddPageArgs> addPageVector_; | 235 std::vector<history::HistoryAddPageArgs> addPageVector_; |
| 239 | 236 |
| 240 // YES if this Tab is being prerendered. | 237 // YES if this Tab is being prerendered. |
| 241 BOOL isPrerenderTab_; | 238 BOOL isPrerenderTab_; |
| 242 | 239 |
| 243 // YES if this Tab was initiated from a voice search. | 240 // YES if this Tab was initiated from a voice search. |
| (...skipping 1423 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1667 // Ensure there is nothing here that could be a risk to the user beyond mild | 1664 // Ensure there is nothing here that could be a risk to the user beyond mild |
| 1668 // confusion in that event (e.g. progress bar starting unexpectedly). | 1665 // confusion in that event (e.g. progress bar starting unexpectedly). |
| 1669 - (void)webWillAddPendingURL:(const GURL&)url | 1666 - (void)webWillAddPendingURL:(const GURL&)url |
| 1670 transition:(ui::PageTransition)transition { | 1667 transition:(ui::PageTransition)transition { |
| 1671 DCHECK(self.webController.loadPhase == web::LOAD_REQUESTED); | 1668 DCHECK(self.webController.loadPhase == web::LOAD_REQUESTED); |
| 1672 DCHECK([self navigationManager]); | 1669 DCHECK([self navigationManager]); |
| 1673 | 1670 |
| 1674 // Move the toolbar to visible during page load. | 1671 // Move the toolbar to visible during page load. |
| 1675 [fullScreenController_ disableFullScreen]; | 1672 [fullScreenController_ disableFullScreen]; |
| 1676 | 1673 |
| 1677 isUserNavigationEvent_ = | 1674 BOOL isUserNavigationEvent = |
| 1678 (transition & ui::PAGE_TRANSITION_IS_REDIRECT_MASK) == 0; | 1675 (transition & ui::PAGE_TRANSITION_IS_REDIRECT_MASK) == 0; |
| 1679 // Check for link-follow clobbers. These are changes where there is no | 1676 // Check for link-follow clobbers. These are changes where there is no |
| 1680 // pending entry (since that means the change wasn't caused by this class), | 1677 // pending entry (since that means the change wasn't caused by this class), |
| 1681 // and where the URL changes (to avoid counting page resurrection). | 1678 // and where the URL changes (to avoid counting page resurrection). |
| 1682 // TODO(crbug.com/546401): Consider moving this into NavigationManager, or | 1679 // TODO(crbug.com/546401): Consider moving this into NavigationManager, or |
| 1683 // into a NavigationManager observer callback, so it doesn't need to be | 1680 // into a NavigationManager observer callback, so it doesn't need to be |
| 1684 // checked in several places. | 1681 // checked in several places. |
| 1685 if (isUserNavigationEvent_ && !isPrerenderTab_ && | 1682 if (isUserNavigationEvent && !isPrerenderTab_ && |
| 1686 ![self navigationManager]->GetPendingItem() && url != self.url) { | 1683 ![self navigationManager]->GetPendingItem() && url != self.url) { |
| 1687 base::RecordAction(UserMetricsAction("MobileTabClobbered")); | 1684 base::RecordAction(UserMetricsAction("MobileTabClobbered")); |
| 1688 if ([parentTabModel_ tabUsageRecorder]) | 1685 if ([parentTabModel_ tabUsageRecorder]) |
| 1689 [parentTabModel_ tabUsageRecorder]->RecordPageLoadStart(self); | 1686 [parentTabModel_ tabUsageRecorder]->RecordPageLoadStart(self); |
| 1690 } | 1687 } |
| 1691 if (![self navigationManager]->GetPendingItem()) { | 1688 if (![self navigationManager]->GetPendingItem()) { |
| 1692 // Reset |isVoiceSearchResultsTab| since a new page is being navigated to. | 1689 // Reset |isVoiceSearchResultsTab| since a new page is being navigated to. |
| 1693 self.isVoiceSearchResultsTab = NO; | 1690 self.isVoiceSearchResultsTab = NO; |
| 1694 } | 1691 } |
| 1695 } | 1692 } |
| (...skipping 17 matching lines...) Expand all Loading... |
| 1713 - (void)webState:(web::WebState*)webState | 1710 - (void)webState:(web::WebState*)webState |
| 1714 didCommitNavigationWithDetails:(const web::LoadCommittedDetails&)details { | 1711 didCommitNavigationWithDetails:(const web::LoadCommittedDetails&)details { |
| 1715 DCHECK([self navigationManager]); | 1712 DCHECK([self navigationManager]); |
| 1716 // |webWillAddPendingURL:transition:| is not called for native page loads. | 1713 // |webWillAddPendingURL:transition:| is not called for native page loads. |
| 1717 // TODO(crbug.com/381201): Move this call there once that bug is fixed so that | 1714 // TODO(crbug.com/381201): Move this call there once that bug is fixed so that |
| 1718 // |disableFullScreen| is called only from one place. | 1715 // |disableFullScreen| is called only from one place. |
| 1719 [fullScreenController_ disableFullScreen]; | 1716 [fullScreenController_ disableFullScreen]; |
| 1720 GURL lastCommittedURL = webState->GetLastCommittedURL(); | 1717 GURL lastCommittedURL = webState->GetLastCommittedURL(); |
| 1721 [autoReloadBridge_ loadStartedForURL:lastCommittedURL]; | 1718 [autoReloadBridge_ loadStartedForURL:lastCommittedURL]; |
| 1722 | 1719 |
| 1723 if (isUserNavigationEvent_) { | |
| 1724 [[NSNotificationCenter defaultCenter] | |
| 1725 postNotificationName:kTabModelUserNavigatedNotification | |
| 1726 object:self]; | |
| 1727 } | |
| 1728 if (parentTabModel_) { | 1720 if (parentTabModel_) { |
| 1729 [[NSNotificationCenter defaultCenter] | 1721 [[NSNotificationCenter defaultCenter] |
| 1730 postNotificationName:kTabModelTabWillStartLoadingNotification | 1722 postNotificationName:kTabModelTabWillStartLoadingNotification |
| 1731 object:parentTabModel_ | 1723 object:parentTabModel_ |
| 1732 userInfo:@{kTabModelTabKey : self}]; | 1724 userInfo:@{kTabModelTabKey : self}]; |
| 1733 } | 1725 } |
| 1734 favicon::FaviconDriver* faviconDriver = | 1726 favicon::FaviconDriver* faviconDriver = |
| 1735 favicon::WebFaviconDriver::FromWebState(webState); | 1727 favicon::WebFaviconDriver::FromWebState(webState); |
| 1736 if (faviconDriver) { | 1728 if (faviconDriver) { |
| 1737 faviconDriver->FetchFavicon(lastCommittedURL); | 1729 faviconDriver->FetchFavicon(lastCommittedURL); |
| (...skipping 513 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2251 | 2243 |
| 2252 - (TabModel*)parentTabModel { | 2244 - (TabModel*)parentTabModel { |
| 2253 return parentTabModel_; | 2245 return parentTabModel_; |
| 2254 } | 2246 } |
| 2255 | 2247 |
| 2256 - (FormInputAccessoryViewController*)inputAccessoryViewController { | 2248 - (FormInputAccessoryViewController*)inputAccessoryViewController { |
| 2257 return inputAccessoryViewController_.get(); | 2249 return inputAccessoryViewController_.get(); |
| 2258 } | 2250 } |
| 2259 | 2251 |
| 2260 @end | 2252 @end |
| OLD | NEW |