| 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 1385 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1396 | 1396 |
| 1397 - (void)webState:(web::WebState*)webState | 1397 - (void)webState:(web::WebState*)webState |
| 1398 didFinishNavigation:(web::NavigationContext*)navigation { | 1398 didFinishNavigation:(web::NavigationContext*)navigation { |
| 1399 if (navigation->IsSamePage()) { | 1399 if (navigation->IsSamePage()) { |
| 1400 auto* faviconDriver = favicon::WebFaviconDriver::FromWebState(webState); | 1400 auto* faviconDriver = favicon::WebFaviconDriver::FromWebState(webState); |
| 1401 if (faviconDriver) { | 1401 if (faviconDriver) { |
| 1402 // Fetch the favicon for the new URL. | 1402 // Fetch the favicon for the new URL. |
| 1403 faviconDriver->FetchFavicon(navigation->GetUrl()); | 1403 faviconDriver->FetchFavicon(navigation->GetUrl()); |
| 1404 } | 1404 } |
| 1405 } | 1405 } |
| 1406 |
| 1407 if (!navigation->IsErrorPage()) { |
| 1408 [self addCurrentEntryToHistoryDB]; |
| 1409 [self countMainFrameLoad]; |
| 1410 } |
| 1411 |
| 1406 [parentTabModel_ notifyTabChanged:self]; | 1412 [parentTabModel_ notifyTabChanged:self]; |
| 1407 } | 1413 } |
| 1408 | 1414 |
| 1409 // Records the state (scroll position, form values, whatever can be | 1415 // Records the state (scroll position, form values, whatever can be |
| 1410 // harvested) from the current page into the current session entry. | 1416 // harvested) from the current page into the current session entry. |
| 1411 - (void)recordStateInHistory { | 1417 - (void)recordStateInHistory { |
| 1412 // Link-loading prerender tab may not have correct zoom value during the load. | 1418 // Link-loading prerender tab may not have correct zoom value during the load. |
| 1413 if (!self.isLinkLoadingPrerenderTab) | 1419 if (!self.isLinkLoadingPrerenderTab) |
| 1414 [self.webController recordStateInHistory]; | 1420 [self.webController recordStateInHistory]; |
| 1415 } | 1421 } |
| (...skipping 309 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1725 // notification now that it's in the right place. | 1731 // notification now that it's in the right place. |
| 1726 NSString* URLSpec = base::SysUTF8ToNSString(lastCommittedURL.spec()); | 1732 NSString* URLSpec = base::SysUTF8ToNSString(lastCommittedURL.spec()); |
| 1727 if (URLSpec.length) { | 1733 if (URLSpec.length) { |
| 1728 [[NSNotificationCenter defaultCenter] | 1734 [[NSNotificationCenter defaultCenter] |
| 1729 postNotificationName:kTabUrlStartedLoadingNotificationForCrashReporting | 1735 postNotificationName:kTabUrlStartedLoadingNotificationForCrashReporting |
| 1730 object:self | 1736 object:self |
| 1731 userInfo:@{kTabUrlKey : URLSpec}]; | 1737 userInfo:@{kTabUrlKey : URLSpec}]; |
| 1732 } | 1738 } |
| 1733 } | 1739 } |
| 1734 | 1740 |
| 1735 // Called when the page URL has changed. | |
| 1736 - (void)webDidStartLoadingURL:(const GURL&)currentUrl | |
| 1737 shouldUpdateHistory:(BOOL)updateHistory { | |
| 1738 if (updateHistory) { | |
| 1739 [self addCurrentEntryToHistoryDB]; | |
| 1740 [self countMainFrameLoad]; | |
| 1741 } | |
| 1742 } | |
| 1743 | |
| 1744 - (void)webState:(web::WebState*)webState | 1741 - (void)webState:(web::WebState*)webState |
| 1745 didLoadPageWithSuccess:(BOOL)loadSuccess { | 1742 didLoadPageWithSuccess:(BOOL)loadSuccess { |
| 1746 DCHECK(self.webController.loadPhase == web::PAGE_LOADED); | 1743 DCHECK(self.webController.loadPhase == web::PAGE_LOADED); |
| 1747 | 1744 |
| 1748 // Cancel prerendering if response is "application/octet-stream". It can be a | 1745 // Cancel prerendering if response is "application/octet-stream". It can be a |
| 1749 // video file which should not be played from preload tab (crbug.com/436813). | 1746 // video file which should not be played from preload tab (crbug.com/436813). |
| 1750 if (isPrerenderTab_ && | 1747 if (isPrerenderTab_ && |
| 1751 self.webState->GetContentsMimeType() == "application/octet-stream") { | 1748 self.webState->GetContentsMimeType() == "application/octet-stream") { |
| 1752 [delegate_ discardPrerender]; | 1749 [delegate_ discardPrerender]; |
| 1753 } | 1750 } |
| (...skipping 483 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2237 | 2234 |
| 2238 - (TabModel*)parentTabModel { | 2235 - (TabModel*)parentTabModel { |
| 2239 return parentTabModel_; | 2236 return parentTabModel_; |
| 2240 } | 2237 } |
| 2241 | 2238 |
| 2242 - (FormInputAccessoryViewController*)inputAccessoryViewController { | 2239 - (FormInputAccessoryViewController*)inputAccessoryViewController { |
| 2243 return inputAccessoryViewController_.get(); | 2240 return inputAccessoryViewController_.get(); |
| 2244 } | 2241 } |
| 2245 | 2242 |
| 2246 @end | 2243 @end |
| OLD | NEW |