| 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 335 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 346 | 346 |
| 347 // Adds the current session entry to this history database. | 347 // Adds the current session entry to this history database. |
| 348 - (void)addCurrentEntryToHistoryDB; | 348 - (void)addCurrentEntryToHistoryDB; |
| 349 | 349 |
| 350 // Adds any cached entries from |addPageVector_| to the history DB. | 350 // Adds any cached entries from |addPageVector_| to the history DB. |
| 351 - (void)commitCachedEntriesToHistoryDB; | 351 - (void)commitCachedEntriesToHistoryDB; |
| 352 | 352 |
| 353 // Returns the OpenInController for this tab. | 353 // Returns the OpenInController for this tab. |
| 354 - (OpenInController*)openInController; | 354 - (OpenInController*)openInController; |
| 355 | 355 |
| 356 // Calls the model and ask to close this tab. | |
| 357 - (void)closeThisTab; | |
| 358 | |
| 359 // Initialize the Native App Launcher controller. | 356 // Initialize the Native App Launcher controller. |
| 360 - (void)initNativeAppNavigationController; | 357 - (void)initNativeAppNavigationController; |
| 361 | 358 |
| 362 // Opens a link in an external app. Returns YES iff |url| is launched in an | 359 // Opens a link in an external app. Returns YES iff |url| is launched in an |
| 363 // external app. | 360 // external app. |
| 364 - (BOOL)openExternalURL:(const GURL&)url linkClicked:(BOOL)linkClicked; | 361 - (BOOL)openExternalURL:(const GURL&)url linkClicked:(BOOL)linkClicked; |
| 365 | 362 |
| 366 // Handles exportable files if possible. | 363 // Handles exportable files if possible. |
| 367 - (void)handleExportableFile:(net::HttpResponseHeaders*)headers; | 364 - (void)handleExportableFile:(net::HttpResponseHeaders*)headers; |
| 368 | 365 |
| (...skipping 1053 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1422 | 1419 |
| 1423 - (OpenInController*)openInController { | 1420 - (OpenInController*)openInController { |
| 1424 if (!openInController_) { | 1421 if (!openInController_) { |
| 1425 openInController_.reset([[OpenInController alloc] | 1422 openInController_.reset([[OpenInController alloc] |
| 1426 initWithRequestContext:browserState_->GetRequestContext() | 1423 initWithRequestContext:browserState_->GetRequestContext() |
| 1427 webController:self.webController]); | 1424 webController:self.webController]); |
| 1428 } | 1425 } |
| 1429 return openInController_.get(); | 1426 return openInController_.get(); |
| 1430 } | 1427 } |
| 1431 | 1428 |
| 1432 - (void)closeThisTab { | |
| 1433 if (!parentTabModel_) | |
| 1434 return; | |
| 1435 | |
| 1436 NSUInteger index = [parentTabModel_ indexOfTab:self]; | |
| 1437 if (index != NSNotFound) | |
| 1438 [parentTabModel_ closeTabAtIndex:index]; | |
| 1439 } | |
| 1440 | |
| 1441 - (id<CRWNativeContent>)controllerForUnhandledContentAtURL:(const GURL&)url { | 1429 - (id<CRWNativeContent>)controllerForUnhandledContentAtURL:(const GURL&)url { |
| 1442 // Shows download manager UI for unhandled content. | 1430 // Shows download manager UI for unhandled content. |
| 1443 DownloadManagerController* downloadController = | 1431 DownloadManagerController* downloadController = |
| 1444 [[[DownloadManagerController alloc] initWithWebState:self.webState | 1432 [[[DownloadManagerController alloc] initWithWebState:self.webState |
| 1445 downloadURL:url] autorelease]; | 1433 downloadURL:url] autorelease]; |
| 1446 [downloadController start]; | 1434 [downloadController start]; |
| 1447 return downloadController; | 1435 return downloadController; |
| 1448 } | 1436 } |
| 1449 | 1437 |
| 1450 - (void)handleExportableFile:(net::HttpResponseHeaders*)headers { | 1438 - (void)handleExportableFile:(net::HttpResponseHeaders*)headers { |
| (...skipping 148 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1599 snapshotOverlayProvider_.reset(snapshotOverlayProvider); | 1587 snapshotOverlayProvider_.reset(snapshotOverlayProvider); |
| 1600 } | 1588 } |
| 1601 | 1589 |
| 1602 - (void)evaluateU2FResultFromURL:(const GURL&)URL { | 1590 - (void)evaluateU2FResultFromURL:(const GURL&)URL { |
| 1603 DCHECK(U2FController_); | 1591 DCHECK(U2FController_); |
| 1604 [U2FController_ evaluateU2FResultFromU2FURL:URL webState:self.webState]; | 1592 [U2FController_ evaluateU2FResultFromU2FURL:URL webState:self.webState]; |
| 1605 } | 1593 } |
| 1606 | 1594 |
| 1607 #pragma mark - CRWWebDelegate and CRWWebStateObserver protocol methods. | 1595 #pragma mark - CRWWebDelegate and CRWWebStateObserver protocol methods. |
| 1608 | 1596 |
| 1609 // The web page wants to close its own window. | |
| 1610 - (void)webPageOrderedClose { | |
| 1611 // Only allow a web page to close itself if it was opened by DOM, or if there | |
| 1612 // are no navigation items. | |
| 1613 DCHECK([[self navigationManagerImpl]->GetSessionController() isOpenedByDOM] || | |
| 1614 ![self navigationManager]->GetItemCount()); | |
| 1615 [self closeThisTab]; | |
| 1616 } | |
| 1617 | |
| 1618 // This method is invoked whenever the system believes the URL is about to | 1597 // This method is invoked whenever the system believes the URL is about to |
| 1619 // change, or immediately after any unexpected change of the URL. The apparent | 1598 // change, or immediately after any unexpected change of the URL. The apparent |
| 1620 // destination URL is included in the |url| parameter. | 1599 // destination URL is included in the |url| parameter. |
| 1621 // Warning: because of the present design it is possible for malicious websites | 1600 // Warning: because of the present design it is possible for malicious websites |
| 1622 // to invoke superflous instances of this delegate with artibrary URLs. | 1601 // to invoke superflous instances of this delegate with artibrary URLs. |
| 1623 // Ensure there is nothing here that could be a risk to the user beyond mild | 1602 // Ensure there is nothing here that could be a risk to the user beyond mild |
| 1624 // confusion in that event (e.g. progress bar starting unexpectedly). | 1603 // confusion in that event (e.g. progress bar starting unexpectedly). |
| 1625 - (void)webWillAddPendingURL:(const GURL&)url | 1604 - (void)webWillAddPendingURL:(const GURL&)url |
| 1626 transition:(ui::PageTransition)transition { | 1605 transition:(ui::PageTransition)transition { |
| 1627 DCHECK(self.webController.loadPhase == web::LOAD_REQUESTED); | 1606 DCHECK(self.webController.loadPhase == web::LOAD_REQUESTED); |
| (...skipping 551 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2179 | 2158 |
| 2180 - (TabModel*)parentTabModel { | 2159 - (TabModel*)parentTabModel { |
| 2181 return parentTabModel_; | 2160 return parentTabModel_; |
| 2182 } | 2161 } |
| 2183 | 2162 |
| 2184 - (FormInputAccessoryViewController*)inputAccessoryViewController { | 2163 - (FormInputAccessoryViewController*)inputAccessoryViewController { |
| 2185 return inputAccessoryViewController_.get(); | 2164 return inputAccessoryViewController_.get(); |
| 2186 } | 2165 } |
| 2187 | 2166 |
| 2188 @end | 2167 @end |
| OLD | NEW |