| 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 463 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 474 @synthesize isLinkLoadingPrerenderTab = isLinkLoadingPrerenderTab_; | 474 @synthesize isLinkLoadingPrerenderTab = isLinkLoadingPrerenderTab_; |
| 475 @synthesize isVoiceSearchResultsTab = isVoiceSearchResultsTab_; | 475 @synthesize isVoiceSearchResultsTab = isVoiceSearchResultsTab_; |
| 476 @synthesize delegate = delegate_; | 476 @synthesize delegate = delegate_; |
| 477 @synthesize tabSnapshottingDelegate = tabSnapshottingDelegate_; | 477 @synthesize tabSnapshottingDelegate = tabSnapshottingDelegate_; |
| 478 @synthesize tabHeadersDelegate = tabHeadersDelegate_; | 478 @synthesize tabHeadersDelegate = tabHeadersDelegate_; |
| 479 | 479 |
| 480 - (instancetype)initWithBrowserState:(ios::ChromeBrowserState*)browserState | 480 - (instancetype)initWithBrowserState:(ios::ChromeBrowserState*)browserState |
| 481 opener:(Tab*)opener | 481 opener:(Tab*)opener |
| 482 openedByDOM:(BOOL)openedByDOM | 482 openedByDOM:(BOOL)openedByDOM |
| 483 model:(TabModel*)parentModel { | 483 model:(TabModel*)parentModel { |
| 484 std::unique_ptr<web::WebStateImpl> webState( | 484 web::WebState::CreateParams params(browserState); |
| 485 new web::WebStateImpl(browserState)); | 485 params.created_with_opener = openedByDOM; |
| 486 webState->GetNavigationManagerImpl().InitializeSession(openedByDOM); | 486 std::unique_ptr<web::WebState> webState = web::WebState::Create(params); |
| 487 if ([opener navigationManager]) { | 487 if ([opener navigationManager]) { |
| 488 web::SerializableUserDataManager* userDataManager = | 488 web::SerializableUserDataManager* userDataManager = |
| 489 web::SerializableUserDataManager::FromWebState(webState.get()); | 489 web::SerializableUserDataManager::FromWebState(webState.get()); |
| 490 userDataManager->AddSerializableData(opener.tabId, kOpenerIDKey); | 490 userDataManager->AddSerializableData(opener.tabId, kOpenerIDKey); |
| 491 userDataManager->AddSerializableData( | 491 userDataManager->AddSerializableData( |
| 492 @([opener navigationManager]->GetLastCommittedItemIndex()), | 492 @([opener navigationManager]->GetLastCommittedItemIndex()), |
| 493 kOpenerNavigationIndexKey); | 493 kOpenerNavigationIndexKey); |
| 494 } | 494 } |
| 495 | 495 |
| 496 return [self initWithWebState:std::move(webState) model:parentModel]; | 496 return [self initWithWebState:std::move(webState) model:parentModel]; |
| (...skipping 1004 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1501 DCHECK([self navigationManager]); | 1501 DCHECK([self navigationManager]); |
| 1502 CRWSessionController* sessionController = | 1502 CRWSessionController* sessionController = |
| 1503 [self navigationManagerImpl]->GetSessionController(); | 1503 [self navigationManagerImpl]->GetSessionController(); |
| 1504 web::NavigationItem* lastUserItem = [sessionController lastUserItem]; | 1504 web::NavigationItem* lastUserItem = [sessionController lastUserItem]; |
| 1505 if (!lastUserItem) | 1505 if (!lastUserItem) |
| 1506 return; | 1506 return; |
| 1507 | 1507 |
| 1508 // |originalUrl| will be empty if a page was open by DOM. | 1508 // |originalUrl| will be empty if a page was open by DOM. |
| 1509 GURL reloadURL(lastUserItem->GetOriginalRequestURL()); | 1509 GURL reloadURL(lastUserItem->GetOriginalRequestURL()); |
| 1510 if (reloadURL.is_empty()) { | 1510 if (reloadURL.is_empty()) { |
| 1511 DCHECK(sessionController.openedByDOM); | 1511 DCHECK(self.webState && self.webState->HasOpener()); |
| 1512 reloadURL = lastUserItem->GetVirtualURL(); | 1512 reloadURL = lastUserItem->GetVirtualURL(); |
| 1513 } | 1513 } |
| 1514 | 1514 |
| 1515 web::NavigationManager::WebLoadParams params(reloadURL); | 1515 web::NavigationManager::WebLoadParams params(reloadURL); |
| 1516 params.referrer = lastUserItem->GetReferrer(); | 1516 params.referrer = lastUserItem->GetReferrer(); |
| 1517 params.transition_type = transition; | 1517 params.transition_type = transition; |
| 1518 if (self.navigationManager) | 1518 if (self.navigationManager) |
| 1519 self.navigationManager->LoadURLWithParams(params); | 1519 self.navigationManager->LoadURLWithParams(params); |
| 1520 } | 1520 } |
| 1521 | 1521 |
| (...skipping 577 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2099 | 2099 |
| 2100 - (TabModel*)parentTabModel { | 2100 - (TabModel*)parentTabModel { |
| 2101 return parentTabModel_; | 2101 return parentTabModel_; |
| 2102 } | 2102 } |
| 2103 | 2103 |
| 2104 - (FormInputAccessoryViewController*)inputAccessoryViewController { | 2104 - (FormInputAccessoryViewController*)inputAccessoryViewController { |
| 2105 return inputAccessoryViewController_.get(); | 2105 return inputAccessoryViewController_.get(); |
| 2106 } | 2106 } |
| 2107 | 2107 |
| 2108 @end | 2108 @end |
| OLD | NEW |