Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(354)

Side by Side Diff: ios/chrome/browser/tabs/tab.mm

Issue 2737353006: Replaced webPageOrderedClose with WebStateDelegate API. (Closed)
Patch Set: Created 3 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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
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 1058 matching lines...) Expand 10 before | Expand all | Expand 10 after
1427 1424
1428 - (OpenInController*)openInController { 1425 - (OpenInController*)openInController {
1429 if (!openInController_) { 1426 if (!openInController_) {
1430 openInController_.reset([[OpenInController alloc] 1427 openInController_.reset([[OpenInController alloc]
1431 initWithRequestContext:browserState_->GetRequestContext() 1428 initWithRequestContext:browserState_->GetRequestContext()
1432 webController:self.webController]); 1429 webController:self.webController]);
1433 } 1430 }
1434 return openInController_.get(); 1431 return openInController_.get();
1435 } 1432 }
1436 1433
1437 - (void)closeThisTab {
1438 if (!parentTabModel_)
1439 return;
1440
1441 NSUInteger index = [parentTabModel_ indexOfTab:self];
1442 if (index != NSNotFound)
1443 [parentTabModel_ closeTabAtIndex:index];
1444 }
1445
1446 - (id<CRWNativeContent>)controllerForUnhandledContentAtURL:(const GURL&)url { 1434 - (id<CRWNativeContent>)controllerForUnhandledContentAtURL:(const GURL&)url {
1447 // Shows download manager UI for unhandled content. 1435 // Shows download manager UI for unhandled content.
1448 DownloadManagerController* downloadController = 1436 DownloadManagerController* downloadController =
1449 [[[DownloadManagerController alloc] initWithWebState:self.webState 1437 [[[DownloadManagerController alloc] initWithWebState:self.webState
1450 downloadURL:url] autorelease]; 1438 downloadURL:url] autorelease];
1451 [downloadController start]; 1439 [downloadController start];
1452 return downloadController; 1440 return downloadController;
1453 } 1441 }
1454 1442
1455 - (void)handleExportableFile:(net::HttpResponseHeaders*)headers { 1443 - (void)handleExportableFile:(net::HttpResponseHeaders*)headers {
(...skipping 148 matching lines...) Expand 10 before | Expand all | Expand 10 after
1604 snapshotOverlayProvider_.reset(snapshotOverlayProvider); 1592 snapshotOverlayProvider_.reset(snapshotOverlayProvider);
1605 } 1593 }
1606 1594
1607 - (void)evaluateU2FResultFromURL:(const GURL&)URL { 1595 - (void)evaluateU2FResultFromURL:(const GURL&)URL {
1608 DCHECK(U2FController_); 1596 DCHECK(U2FController_);
1609 [U2FController_ evaluateU2FResultFromU2FURL:URL webState:self.webState]; 1597 [U2FController_ evaluateU2FResultFromU2FURL:URL webState:self.webState];
1610 } 1598 }
1611 1599
1612 #pragma mark - CRWWebDelegate and CRWWebStateObserver protocol methods. 1600 #pragma mark - CRWWebDelegate and CRWWebStateObserver protocol methods.
1613 1601
1614 // The web page wants to close its own window.
1615 - (void)webPageOrderedClose {
1616 // Only allow a web page to close itself if it was opened by DOM, or if there
1617 // are no navigation items.
1618 DCHECK([[self navigationManagerImpl]->GetSessionController() isOpenedByDOM] ||
1619 ![self navigationManager]->GetItemCount());
1620 [self closeThisTab];
1621 }
1622
1623 // This method is invoked whenever the system believes the URL is about to 1602 // This method is invoked whenever the system believes the URL is about to
1624 // change, or immediately after any unexpected change of the URL. The apparent 1603 // change, or immediately after any unexpected change of the URL. The apparent
1625 // destination URL is included in the |url| parameter. 1604 // destination URL is included in the |url| parameter.
1626 // Warning: because of the present design it is possible for malicious websites 1605 // Warning: because of the present design it is possible for malicious websites
1627 // to invoke superflous instances of this delegate with artibrary URLs. 1606 // to invoke superflous instances of this delegate with artibrary URLs.
1628 // Ensure there is nothing here that could be a risk to the user beyond mild 1607 // Ensure there is nothing here that could be a risk to the user beyond mild
1629 // confusion in that event (e.g. progress bar starting unexpectedly). 1608 // confusion in that event (e.g. progress bar starting unexpectedly).
1630 - (void)webWillAddPendingURL:(const GURL&)url 1609 - (void)webWillAddPendingURL:(const GURL&)url
1631 transition:(ui::PageTransition)transition { 1610 transition:(ui::PageTransition)transition {
1632 DCHECK(self.webController.loadPhase == web::LOAD_REQUESTED); 1611 DCHECK(self.webController.loadPhase == web::LOAD_REQUESTED);
(...skipping 551 matching lines...) Expand 10 before | Expand all | Expand 10 after
2184 2163
2185 - (TabModel*)parentTabModel { 2164 - (TabModel*)parentTabModel {
2186 return parentTabModel_; 2165 return parentTabModel_;
2187 } 2166 }
2188 2167
2189 - (FormInputAccessoryViewController*)inputAccessoryViewController { 2168 - (FormInputAccessoryViewController*)inputAccessoryViewController {
2190 return inputAccessoryViewController_.get(); 2169 return inputAccessoryViewController_.get();
2191 } 2170 }
2192 2171
2193 @end 2172 @end
OLDNEW
« no previous file with comments | « no previous file | ios/chrome/browser/tabs/tab_private.h » ('j') | ios/web/public/test/fakes/test_web_state_delegate.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698