| 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 1766 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1777 postNotificationName: | 1777 postNotificationName: |
| 1778 kTabClosingCurrentDocumentNotificationForCrashReporting | 1778 kTabClosingCurrentDocumentNotificationForCrashReporting |
| 1779 object:self]; | 1779 object:self]; |
| 1780 } | 1780 } |
| 1781 | 1781 |
| 1782 - (void)webCancelStartLoadingRequest { | 1782 - (void)webCancelStartLoadingRequest { |
| 1783 DCHECK(self.webController.loadPhase == web::PAGE_LOADED); | 1783 DCHECK(self.webController.loadPhase == web::PAGE_LOADED); |
| 1784 [parentTabModel_ notifyTabChanged:self]; | 1784 [parentTabModel_ notifyTabChanged:self]; |
| 1785 } | 1785 } |
| 1786 | 1786 |
| 1787 // Called when the page URL has changed. | 1787 - (void)webState:(web::WebState*)webState |
| 1788 - (void)webDidStartLoadingURL:(const GURL&)currentUrl | 1788 didCommitNavigationWithDetails:(const web::LoadCommittedDetails&)details { |
| 1789 shouldUpdateHistory:(BOOL)updateHistory { | |
| 1790 DCHECK(self.webController.loadPhase == web::PAGE_LOADING); | |
| 1791 DCHECK([self navigationManager]); | 1789 DCHECK([self navigationManager]); |
| 1792 // |webWillStartLoading:| is not called for native page loads. | 1790 // |webWillAddPendingURL:transition:| is not called for native page loads. |
| 1793 // TODO(crbug.com/381201): Move this call there once that bug is fixed so that | 1791 // TODO(crbug.com/381201): Move this call there once that bug is fixed so that |
| 1794 // |disableFullScreen| is called only from one place. | 1792 // |disableFullScreen| is called only from one place. |
| 1795 [fullScreenController_ disableFullScreen]; | 1793 [fullScreenController_ disableFullScreen]; |
| 1796 [findInPageController_ disableFindInPageWithCompletionHandler:nil]; | 1794 [findInPageController_ disableFindInPageWithCompletionHandler:nil]; |
| 1797 [autoReloadBridge_ loadStartedForURL:currentUrl]; | 1795 [autoReloadBridge_ loadStartedForURL:webState->GetLastCommittedURL()]; |
| 1798 | 1796 |
| 1799 if (isUserNavigationEvent_) { | 1797 if (isUserNavigationEvent_) { |
| 1800 [[NSNotificationCenter defaultCenter] | 1798 [[NSNotificationCenter defaultCenter] |
| 1801 postNotificationName:kTabModelUserNavigatedNotification | 1799 postNotificationName:kTabModelUserNavigatedNotification |
| 1802 object:self]; | 1800 object:self]; |
| 1803 } | 1801 } |
| 1804 if (parentTabModel_) { | 1802 if (parentTabModel_) { |
| 1805 [[NSNotificationCenter defaultCenter] | 1803 [[NSNotificationCenter defaultCenter] |
| 1806 postNotificationName:kTabModelTabWillStartLoadingNotification | 1804 postNotificationName:kTabModelTabWillStartLoadingNotification |
| 1807 object:parentTabModel_ | 1805 object:parentTabModel_ |
| 1808 userInfo:[NSDictionary | 1806 userInfo:@{kTabModelTabKey : self}]; |
| 1809 dictionaryWithObject:self | |
| 1810 forKey:kTabModelTabKey]]; | |
| 1811 } | 1807 } |
| 1812 favicon::FaviconDriver* faviconDriver = | 1808 favicon::FaviconDriver* faviconDriver = |
| 1813 favicon::WebFaviconDriver::FromWebState(self.webState); | 1809 favicon::WebFaviconDriver::FromWebState(webState); |
| 1814 if (faviconDriver) { | 1810 if (faviconDriver) { |
| 1815 faviconDriver->FetchFavicon(currentUrl); | 1811 faviconDriver->FetchFavicon(webState->GetLastCommittedURL()); |
| 1816 } | 1812 } |
| 1817 [parentTabModel_ notifyTabChanged:self]; | 1813 [parentTabModel_ notifyTabChanged:self]; |
| 1818 if (parentTabModel_) { | 1814 if (parentTabModel_) { |
| 1819 [[NSNotificationCenter defaultCenter] | 1815 [[NSNotificationCenter defaultCenter] |
| 1820 postNotificationName:kTabModelTabDidStartLoadingNotification | 1816 postNotificationName:kTabModelTabDidStartLoadingNotification |
| 1821 object:parentTabModel_ | 1817 object:parentTabModel_ |
| 1822 userInfo:[NSDictionary | 1818 userInfo:@{kTabModelTabKey : self}]; |
| 1823 dictionaryWithObject:self | |
| 1824 forKey:kTabModelTabKey]]; | |
| 1825 } | 1819 } |
| 1820 [parentTabModel_ navigationCommittedInTab:self]; |
| 1821 } |
| 1826 | 1822 |
| 1827 [parentTabModel_ navigationCommittedInTab:self]; | 1823 // Called when the page URL has changed. |
| 1824 - (void)webDidStartLoadingURL:(const GURL&)currentUrl |
| 1825 shouldUpdateHistory:(BOOL)updateHistory { |
| 1828 if (updateHistory) { | 1826 if (updateHistory) { |
| 1829 [self addCurrentEntryToHistoryDB]; | 1827 [self addCurrentEntryToHistoryDB]; |
| 1830 [self countMainFrameLoad]; | 1828 [self countMainFrameLoad]; |
| 1831 } | 1829 } |
| 1832 | 1830 |
| 1833 // Sending a notification about the url change for crash reporting. | 1831 // Sending a notification about the url change for crash reporting. |
| 1834 // TODO(crbug.com/661675): Consider using the navigation entry committed | 1832 // TODO(crbug.com/661675): Consider using the navigation entry committed |
| 1835 // notification now that it's in the right place. | 1833 // notification now that it's in the right place. |
| 1836 NSString* urlString = base::SysUTF8ToNSString(currentUrl.spec()); | 1834 NSString* urlString = base::SysUTF8ToNSString(currentUrl.spec()); |
| 1837 if ([urlString length]) { | 1835 if ([urlString length]) { |
| (...skipping 537 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2375 | 2373 |
| 2376 - (TabModel*)parentTabModel { | 2374 - (TabModel*)parentTabModel { |
| 2377 return parentTabModel_; | 2375 return parentTabModel_; |
| 2378 } | 2376 } |
| 2379 | 2377 |
| 2380 - (FormInputAccessoryViewController*)inputAccessoryViewController { | 2378 - (FormInputAccessoryViewController*)inputAccessoryViewController { |
| 2381 return inputAccessoryViewController_.get(); | 2379 return inputAccessoryViewController_.get(); |
| 2382 } | 2380 } |
| 2383 | 2381 |
| 2384 @end | 2382 @end |
| OLD | NEW |