Chromium Code Reviews| 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 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 81 #include "ios/chrome/browser/signin/account_reconcilor_factory.h" | 81 #include "ios/chrome/browser/signin/account_reconcilor_factory.h" |
| 82 #include "ios/chrome/browser/signin/authentication_service.h" | 82 #include "ios/chrome/browser/signin/authentication_service.h" |
| 83 #include "ios/chrome/browser/signin/authentication_service_factory.h" | 83 #include "ios/chrome/browser/signin/authentication_service_factory.h" |
| 84 #include "ios/chrome/browser/signin/signin_capability.h" | 84 #include "ios/chrome/browser/signin/signin_capability.h" |
| 85 #import "ios/chrome/browser/snapshots/snapshot_manager.h" | 85 #import "ios/chrome/browser/snapshots/snapshot_manager.h" |
| 86 #import "ios/chrome/browser/snapshots/snapshot_overlay_provider.h" | 86 #import "ios/chrome/browser/snapshots/snapshot_overlay_provider.h" |
| 87 #import "ios/chrome/browser/snapshots/web_controller_snapshot_helper.h" | 87 #import "ios/chrome/browser/snapshots/web_controller_snapshot_helper.h" |
| 88 #include "ios/chrome/browser/ssl/ios_security_state_tab_helper.h" | 88 #include "ios/chrome/browser/ssl/ios_security_state_tab_helper.h" |
| 89 #import "ios/chrome/browser/storekit_launcher.h" | 89 #import "ios/chrome/browser/storekit_launcher.h" |
| 90 #include "ios/chrome/browser/sync/ios_chrome_synced_tab_delegate.h" | 90 #include "ios/chrome/browser/sync/ios_chrome_synced_tab_delegate.h" |
| 91 #import "ios/chrome/browser/tabs/legacy_tab_helper.h" | |
| 91 #import "ios/chrome/browser/tabs/tab_delegate.h" | 92 #import "ios/chrome/browser/tabs/tab_delegate.h" |
| 92 #import "ios/chrome/browser/tabs/tab_dialog_delegate.h" | 93 #import "ios/chrome/browser/tabs/tab_dialog_delegate.h" |
| 93 #import "ios/chrome/browser/tabs/tab_headers_delegate.h" | 94 #import "ios/chrome/browser/tabs/tab_headers_delegate.h" |
| 94 #import "ios/chrome/browser/tabs/tab_model.h" | 95 #import "ios/chrome/browser/tabs/tab_model.h" |
| 95 #import "ios/chrome/browser/tabs/tab_private.h" | 96 #import "ios/chrome/browser/tabs/tab_private.h" |
| 96 #import "ios/chrome/browser/tabs/tab_snapshotting_delegate.h" | 97 #import "ios/chrome/browser/tabs/tab_snapshotting_delegate.h" |
| 97 #include "ios/chrome/browser/translate/chrome_ios_translate_client.h" | 98 #include "ios/chrome/browser/translate/chrome_ios_translate_client.h" |
| 98 #import "ios/chrome/browser/u2f/u2f_controller.h" | 99 #import "ios/chrome/browser/u2f/u2f_controller.h" |
| 99 #import "ios/chrome/browser/ui/commands/UIKit+ChromeExecuteCommand.h" | 100 #import "ios/chrome/browser/ui/commands/UIKit+ChromeExecuteCommand.h" |
| 100 #import "ios/chrome/browser/ui/commands/generic_chrome_command.h" | 101 #import "ios/chrome/browser/ui/commands/generic_chrome_command.h" |
| (...skipping 427 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 528 propertyReleaser_Tab_.Init(self, [Tab class]); | 529 propertyReleaser_Tab_.Init(self, [Tab class]); |
| 529 tabHistoryContext_.reset(new TabHistoryContext()); | 530 tabHistoryContext_.reset(new TabHistoryContext()); |
| 530 parentTabModel_ = parentModel; | 531 parentTabModel_ = parentModel; |
| 531 browserState_ = | 532 browserState_ = |
| 532 ios::ChromeBrowserState::FromBrowserState(webState->GetBrowserState()); | 533 ios::ChromeBrowserState::FromBrowserState(webState->GetBrowserState()); |
| 533 | 534 |
| 534 webStateImpl_.reset(static_cast<web::WebStateImpl*>(webState.release())); | 535 webStateImpl_.reset(static_cast<web::WebStateImpl*>(webState.release())); |
| 535 webStateObserver_.reset( | 536 webStateObserver_.reset( |
| 536 new web::WebStateObserverBridge(webStateImpl_.get(), self)); | 537 new web::WebStateObserverBridge(webStateImpl_.get(), self)); |
| 537 | 538 |
| 539 // Do not respect |attachTabHelpers| as this tab helper is required for | |
| 540 // proper conversion from WebState to Tab. | |
| 541 LegacyTabHelper::CreateForWebState(webStateImpl_.get(), self); | |
| 542 | |
| 538 [self.webController setDelegate:self]; | 543 [self.webController setDelegate:self]; |
| 539 | 544 |
| 540 NSString* sessionID = self.tabId; | 545 NSString* sessionID = self.tabId; |
| 541 DCHECK(sessionID); | 546 DCHECK(sessionID); |
| 542 snapshotManager_.reset([[SnapshotManager alloc] init]); | 547 snapshotManager_.reset([[SnapshotManager alloc] init]); |
| 543 | 548 |
| 544 webControllerSnapshotHelper_.reset([[WebControllerSnapshotHelper alloc] | 549 webControllerSnapshotHelper_.reset([[WebControllerSnapshotHelper alloc] |
| 545 initWithSnapshotManager:snapshotManager_ | 550 initWithSnapshotManager:snapshotManager_ |
| 546 tab:self]); | 551 tab:self]); |
| 547 | 552 |
| (...skipping 693 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1241 // CRWWebController to be deallocated before its close is called. The facade | 1246 // CRWWebController to be deallocated before its close is called. The facade |
| 1242 // delegate should be torn down after |-didCloseTab:| so components triggered | 1247 // delegate should be torn down after |-didCloseTab:| so components triggered |
| 1243 // by tab closure can use the content facade, and it should be deleted before | 1248 // by tab closure can use the content facade, and it should be deleted before |
| 1244 // the web controller since the web controller owns the facade's backing | 1249 // the web controller since the web controller owns the facade's backing |
| 1245 // objects. | 1250 // objects. |
| 1246 // TODO(crbug.com/546222): Fix the need for this; TabModel should be | 1251 // TODO(crbug.com/546222): Fix the need for this; TabModel should be |
| 1247 // responsible for making the lifetime of Tab sane, rather than allowing Tab | 1252 // responsible for making the lifetime of Tab sane, rather than allowing Tab |
| 1248 // to drive its own destruction. | 1253 // to drive its own destruction. |
| 1249 base::scoped_nsobject<Tab> kungFuDeathGrip([self retain]); | 1254 base::scoped_nsobject<Tab> kungFuDeathGrip([self retain]); |
| 1250 [parentTabModel_ didCloseTab:self]; // Inform parent of tab closure. | 1255 [parentTabModel_ didCloseTab:self]; // Inform parent of tab closure. |
| 1256 | |
| 1257 LegacyTabHelper::RemoveFromWebState(webStateImpl_.get()); | |
|
rohitrao (ping after 24h)
2017/02/08 14:07:17
Is there any way for code to call LegacyTabHelper:
sdefresne
2017/02/08 14:45:34
I've addressed this by introducing a static method
| |
| 1251 webStateImpl_.reset(); | 1258 webStateImpl_.reset(); |
| 1252 } | 1259 } |
| 1253 | 1260 |
| 1254 - (void)dismissModals { | 1261 - (void)dismissModals { |
| 1255 [openInController_ disable]; | 1262 [openInController_ disable]; |
| 1256 [self.webController dismissModals]; | 1263 [self.webController dismissModals]; |
| 1257 } | 1264 } |
| 1258 | 1265 |
| 1259 - (CRWSessionEntry*)currentSessionEntry { | 1266 - (CRWSessionEntry*)currentSessionEntry { |
| 1260 if (![self navigationManager]) | 1267 if (![self navigationManager]) |
| (...skipping 987 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2248 | 2255 |
| 2249 - (TabModel*)parentTabModel { | 2256 - (TabModel*)parentTabModel { |
| 2250 return parentTabModel_; | 2257 return parentTabModel_; |
| 2251 } | 2258 } |
| 2252 | 2259 |
| 2253 - (FormInputAccessoryViewController*)inputAccessoryViewController { | 2260 - (FormInputAccessoryViewController*)inputAccessoryViewController { |
| 2254 return inputAccessoryViewController_.get(); | 2261 return inputAccessoryViewController_.get(); |
| 2255 } | 2262 } |
| 2256 | 2263 |
| 2257 @end | 2264 @end |
| OLD | NEW |