| 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 1750 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1761 } | 1761 } |
| 1762 | 1762 |
| 1763 - (void)webState:(web::WebState*)webState | 1763 - (void)webState:(web::WebState*)webState |
| 1764 didCommitNavigationWithDetails:(const web::LoadCommittedDetails&)details { | 1764 didCommitNavigationWithDetails:(const web::LoadCommittedDetails&)details { |
| 1765 DCHECK([self navigationManager]); | 1765 DCHECK([self navigationManager]); |
| 1766 // |webWillAddPendingURL:transition:| is not called for native page loads. | 1766 // |webWillAddPendingURL:transition:| is not called for native page loads. |
| 1767 // TODO(crbug.com/381201): Move this call there once that bug is fixed so that | 1767 // TODO(crbug.com/381201): Move this call there once that bug is fixed so that |
| 1768 // |disableFullScreen| is called only from one place. | 1768 // |disableFullScreen| is called only from one place. |
| 1769 [fullScreenController_ disableFullScreen]; | 1769 [fullScreenController_ disableFullScreen]; |
| 1770 [findInPageController_ disableFindInPageWithCompletionHandler:nil]; | 1770 [findInPageController_ disableFindInPageWithCompletionHandler:nil]; |
| 1771 [autoReloadBridge_ loadStartedForURL:webState->GetLastCommittedURL()]; | 1771 GURL lastCommittedURL = webState->GetLastCommittedURL(); |
| 1772 [autoReloadBridge_ loadStartedForURL:lastCommittedURL]; |
| 1772 | 1773 |
| 1773 if (isUserNavigationEvent_) { | 1774 if (isUserNavigationEvent_) { |
| 1774 [[NSNotificationCenter defaultCenter] | 1775 [[NSNotificationCenter defaultCenter] |
| 1775 postNotificationName:kTabModelUserNavigatedNotification | 1776 postNotificationName:kTabModelUserNavigatedNotification |
| 1776 object:self]; | 1777 object:self]; |
| 1777 } | 1778 } |
| 1778 if (parentTabModel_) { | 1779 if (parentTabModel_) { |
| 1779 [[NSNotificationCenter defaultCenter] | 1780 [[NSNotificationCenter defaultCenter] |
| 1780 postNotificationName:kTabModelTabWillStartLoadingNotification | 1781 postNotificationName:kTabModelTabWillStartLoadingNotification |
| 1781 object:parentTabModel_ | 1782 object:parentTabModel_ |
| 1782 userInfo:@{kTabModelTabKey : self}]; | 1783 userInfo:@{kTabModelTabKey : self}]; |
| 1783 } | 1784 } |
| 1784 favicon::FaviconDriver* faviconDriver = | 1785 favicon::FaviconDriver* faviconDriver = |
| 1785 favicon::WebFaviconDriver::FromWebState(webState); | 1786 favicon::WebFaviconDriver::FromWebState(webState); |
| 1786 if (faviconDriver) { | 1787 if (faviconDriver) { |
| 1787 faviconDriver->FetchFavicon(webState->GetLastCommittedURL()); | 1788 faviconDriver->FetchFavicon(lastCommittedURL); |
| 1788 } | 1789 } |
| 1789 [parentTabModel_ notifyTabChanged:self]; | 1790 [parentTabModel_ notifyTabChanged:self]; |
| 1790 if (parentTabModel_) { | 1791 if (parentTabModel_) { |
| 1791 [[NSNotificationCenter defaultCenter] | 1792 [[NSNotificationCenter defaultCenter] |
| 1792 postNotificationName:kTabModelTabDidStartLoadingNotification | 1793 postNotificationName:kTabModelTabDidStartLoadingNotification |
| 1793 object:parentTabModel_ | 1794 object:parentTabModel_ |
| 1794 userInfo:@{kTabModelTabKey : self}]; | 1795 userInfo:@{kTabModelTabKey : self}]; |
| 1795 } | 1796 } |
| 1796 [parentTabModel_ navigationCommittedInTab:self]; | 1797 [parentTabModel_ navigationCommittedInTab:self]; |
| 1798 |
| 1799 // Sending a notification about the url change for crash reporting. |
| 1800 // TODO(crbug.com/661675): Consider using the navigation entry committed |
| 1801 // notification now that it's in the right place. |
| 1802 NSString* URLSpec = base::SysUTF8ToNSString(lastCommittedURL.spec()); |
| 1803 if (URLSpec.length) { |
| 1804 [[NSNotificationCenter defaultCenter] |
| 1805 postNotificationName:kTabUrlStartedLoadingNotificationForCrashReporting |
| 1806 object:self |
| 1807 userInfo:@{kTabUrlKey : URLSpec}]; |
| 1808 } |
| 1797 } | 1809 } |
| 1798 | 1810 |
| 1799 // Called when the page URL has changed. | 1811 // Called when the page URL has changed. |
| 1800 - (void)webDidStartLoadingURL:(const GURL&)currentUrl | 1812 - (void)webDidStartLoadingURL:(const GURL&)currentUrl |
| 1801 shouldUpdateHistory:(BOOL)updateHistory { | 1813 shouldUpdateHistory:(BOOL)updateHistory { |
| 1802 if (updateHistory) { | 1814 if (updateHistory) { |
| 1803 [self addCurrentEntryToHistoryDB]; | 1815 [self addCurrentEntryToHistoryDB]; |
| 1804 [self countMainFrameLoad]; | 1816 [self countMainFrameLoad]; |
| 1805 } | 1817 } |
| 1806 | |
| 1807 // Sending a notification about the url change for crash reporting. | |
| 1808 // TODO(crbug.com/661675): Consider using the navigation entry committed | |
| 1809 // notification now that it's in the right place. | |
| 1810 NSString* urlString = base::SysUTF8ToNSString(currentUrl.spec()); | |
| 1811 if ([urlString length]) { | |
| 1812 [[NSNotificationCenter defaultCenter] | |
| 1813 postNotificationName:kTabUrlStartedLoadingNotificationForCrashReporting | |
| 1814 object:self | |
| 1815 userInfo:[NSDictionary dictionaryWithObject:urlString | |
| 1816 forKey:kTabUrlKey]]; | |
| 1817 } | |
| 1818 } | 1818 } |
| 1819 | 1819 |
| 1820 - (void)webState:(web::WebState*)webState | 1820 - (void)webState:(web::WebState*)webState |
| 1821 didLoadPageWithSuccess:(BOOL)loadSuccess { | 1821 didLoadPageWithSuccess:(BOOL)loadSuccess { |
| 1822 DCHECK(self.webController.loadPhase == web::PAGE_LOADED); | 1822 DCHECK(self.webController.loadPhase == web::PAGE_LOADED); |
| 1823 | 1823 |
| 1824 // Cancel prerendering if response is "application/octet-stream". It can be a | 1824 // Cancel prerendering if response is "application/octet-stream". It can be a |
| 1825 // video file which should not be played from preload tab (crbug.com/436813). | 1825 // video file which should not be played from preload tab (crbug.com/436813). |
| 1826 if (isPrerenderTab_ && | 1826 if (isPrerenderTab_ && |
| 1827 self.webState->GetContentsMimeType() == "application/octet-stream") { | 1827 self.webState->GetContentsMimeType() == "application/octet-stream") { |
| (...skipping 521 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2349 | 2349 |
| 2350 - (TabModel*)parentTabModel { | 2350 - (TabModel*)parentTabModel { |
| 2351 return parentTabModel_; | 2351 return parentTabModel_; |
| 2352 } | 2352 } |
| 2353 | 2353 |
| 2354 - (FormInputAccessoryViewController*)inputAccessoryViewController { | 2354 - (FormInputAccessoryViewController*)inputAccessoryViewController { |
| 2355 return inputAccessoryViewController_.get(); | 2355 return inputAccessoryViewController_.get(); |
| 2356 } | 2356 } |
| 2357 | 2357 |
| 2358 @end | 2358 @end |
| OLD | NEW |