| 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/ui/browser_view_controller.h" | 5 #import "ios/chrome/browser/ui/browser_view_controller.h" |
| 6 | 6 |
| 7 #import <AssetsLibrary/AssetsLibrary.h> | 7 #import <AssetsLibrary/AssetsLibrary.h> |
| 8 #import <MobileCoreServices/MobileCoreServices.h> | 8 #import <MobileCoreServices/MobileCoreServices.h> |
| 9 #import <PassKit/PassKit.h> | 9 #import <PassKit/PassKit.h> |
| 10 #import <Photos/Photos.h> | 10 #import <Photos/Photos.h> |
| (...skipping 2397 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2408 params.is_renderer_initiated = true; | 2408 params.is_renderer_initiated = true; |
| 2409 Tab* childTab = [[self tabModel] | 2409 Tab* childTab = [[self tabModel] |
| 2410 insertTabWithLoadParams:params | 2410 insertTabWithLoadParams:params |
| 2411 opener:currentTab | 2411 opener:currentTab |
| 2412 openedByDOM:YES | 2412 openedByDOM:YES |
| 2413 atIndex:TabModelConstants::kTabPositionAutomatically | 2413 atIndex:TabModelConstants::kTabPositionAutomatically |
| 2414 inBackground:NO]; | 2414 inBackground:NO]; |
| 2415 return childTab.webState; | 2415 return childTab.webState; |
| 2416 } | 2416 } |
| 2417 | 2417 |
| 2418 - (void)closeWebState:(web::WebState*)webState { |
| 2419 // Only allow a web page to close itself if it was opened by DOM, or if there |
| 2420 // are no navigation items. |
| 2421 Tab* tab = LegacyTabHelper::GetTabForWebState(webState); |
| 2422 DCHECK([[tab navigationManagerImpl]->GetSessionController() isOpenedByDOM] || |
| 2423 ![tab navigationManager]->GetItemCount()); |
| 2424 |
| 2425 if (![self tabModel]) |
| 2426 return; |
| 2427 |
| 2428 NSUInteger index = [[self tabModel] indexOfTab:tab]; |
| 2429 if (index != NSNotFound) |
| 2430 [[self tabModel] closeTabAtIndex:index]; |
| 2431 } |
| 2432 |
| 2418 - (web::WebState*)webState:(web::WebState*)webState | 2433 - (web::WebState*)webState:(web::WebState*)webState |
| 2419 openURLWithParams:(const web::WebState::OpenURLParams&)params { | 2434 openURLWithParams:(const web::WebState::OpenURLParams&)params { |
| 2420 switch (params.disposition) { | 2435 switch (params.disposition) { |
| 2421 case WindowOpenDisposition::NEW_FOREGROUND_TAB: | 2436 case WindowOpenDisposition::NEW_FOREGROUND_TAB: |
| 2422 case WindowOpenDisposition::NEW_BACKGROUND_TAB: { | 2437 case WindowOpenDisposition::NEW_BACKGROUND_TAB: { |
| 2423 Tab* tab = [[self tabModel] | 2438 Tab* tab = [[self tabModel] |
| 2424 insertTabWithURL:params.url | 2439 insertTabWithURL:params.url |
| 2425 referrer:params.referrer | 2440 referrer:params.referrer |
| 2426 transition:params.transition | 2441 transition:params.transition |
| 2427 opener:LegacyTabHelper::GetTabForWebState(webState) | 2442 opener:LegacyTabHelper::GetTabForWebState(webState) |
| (...skipping 2660 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5088 | 5103 |
| 5089 - (UIView*)voiceSearchButton { | 5104 - (UIView*)voiceSearchButton { |
| 5090 return _voiceSearchButton; | 5105 return _voiceSearchButton; |
| 5091 } | 5106 } |
| 5092 | 5107 |
| 5093 - (id<LogoAnimationControllerOwner>)logoAnimationControllerOwner { | 5108 - (id<LogoAnimationControllerOwner>)logoAnimationControllerOwner { |
| 5094 return [self currentLogoAnimationControllerOwner]; | 5109 return [self currentLogoAnimationControllerOwner]; |
| 5095 } | 5110 } |
| 5096 | 5111 |
| 5097 @end | 5112 @end |
| OLD | NEW |