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.opened_by_dom = 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 1013 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1510 DCHECK([self navigationManager]); | 1510 DCHECK([self navigationManager]); |
1511 CRWSessionController* sessionController = | 1511 CRWSessionController* sessionController = |
1512 [self navigationManagerImpl]->GetSessionController(); | 1512 [self navigationManagerImpl]->GetSessionController(); |
1513 web::NavigationItem* lastUserItem = [sessionController lastUserItem]; | 1513 web::NavigationItem* lastUserItem = [sessionController lastUserItem]; |
1514 if (!lastUserItem) | 1514 if (!lastUserItem) |
1515 return; | 1515 return; |
1516 | 1516 |
1517 // |originalUrl| will be empty if a page was open by DOM. | 1517 // |originalUrl| will be empty if a page was open by DOM. |
1518 GURL reloadURL(lastUserItem->GetOriginalRequestURL()); | 1518 GURL reloadURL(lastUserItem->GetOriginalRequestURL()); |
1519 if (reloadURL.is_empty()) { | 1519 if (reloadURL.is_empty()) { |
1520 DCHECK(sessionController.openedByDOM); | 1520 DCHECK(self.webState && self.webState->IsOpenedByDOM()); |
1521 reloadURL = lastUserItem->GetVirtualURL(); | 1521 reloadURL = lastUserItem->GetVirtualURL(); |
1522 } | 1522 } |
1523 | 1523 |
1524 web::NavigationManager::WebLoadParams params(reloadURL); | 1524 web::NavigationManager::WebLoadParams params(reloadURL); |
1525 params.referrer = lastUserItem->GetReferrer(); | 1525 params.referrer = lastUserItem->GetReferrer(); |
1526 params.transition_type = transition; | 1526 params.transition_type = transition; |
1527 if (self.navigationManager) | 1527 if (self.navigationManager) |
1528 self.navigationManager->LoadURLWithParams(params); | 1528 self.navigationManager->LoadURLWithParams(params); |
1529 } | 1529 } |
1530 | 1530 |
(...skipping 573 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2104 | 2104 |
2105 - (TabModel*)parentTabModel { | 2105 - (TabModel*)parentTabModel { |
2106 return parentTabModel_; | 2106 return parentTabModel_; |
2107 } | 2107 } |
2108 | 2108 |
2109 - (FormInputAccessoryViewController*)inputAccessoryViewController { | 2109 - (FormInputAccessoryViewController*)inputAccessoryViewController { |
2110 return inputAccessoryViewController_.get(); | 2110 return inputAccessoryViewController_.get(); |
2111 } | 2111 } |
2112 | 2112 |
2113 @end | 2113 @end |
OLD | NEW |