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

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

Issue 2681843002: Add mechanism to get the Tab from the associated WebState. (Closed)
Patch Set: Address comments. Created 3 years, 10 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
« no previous file with comments | « ios/chrome/browser/tabs/legacy_tab_helper.mm ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 70 matching lines...) Expand 10 before | Expand all | Expand 10 after
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
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
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());
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 978 matching lines...) Expand 10 before | Expand all | Expand 10 after
2239 2246
2240 - (TabModel*)parentTabModel { 2247 - (TabModel*)parentTabModel {
2241 return parentTabModel_; 2248 return parentTabModel_;
2242 } 2249 }
2243 2250
2244 - (FormInputAccessoryViewController*)inputAccessoryViewController { 2251 - (FormInputAccessoryViewController*)inputAccessoryViewController {
2245 return inputAccessoryViewController_.get(); 2252 return inputAccessoryViewController_.get();
2246 } 2253 }
2247 2254
2248 @end 2255 @end
OLDNEW
« no previous file with comments | « ios/chrome/browser/tabs/legacy_tab_helper.mm ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698