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

Side by Side Diff: ios/chrome/browser/ui/browser_view_controller.mm

Issue 2740233002: Remove CRWSessionController usage from BrowserViewController. (Closed)
Patch Set: Eugene's comments Created 3 years, 9 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/ui/DEPS ('k') | ios/chrome/browser/ui/browser_view_controller_unittest.mm » ('j') | 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/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 154 matching lines...) Expand 10 before | Expand all | Expand 10 after
165 #include "ios/chrome/grit/ios_strings.h" 165 #include "ios/chrome/grit/ios_strings.h"
166 #import "ios/net/request_tracker.h" 166 #import "ios/net/request_tracker.h"
167 #include "ios/public/provider/chrome/browser/chrome_browser_provider.h" 167 #include "ios/public/provider/chrome/browser/chrome_browser_provider.h"
168 #include "ios/public/provider/chrome/browser/ui/app_rating_prompt.h" 168 #include "ios/public/provider/chrome/browser/ui/app_rating_prompt.h"
169 #include "ios/public/provider/chrome/browser/ui/default_ios_web_view_factory.h" 169 #include "ios/public/provider/chrome/browser/ui/default_ios_web_view_factory.h"
170 #import "ios/public/provider/chrome/browser/voice/voice_search_bar.h" 170 #import "ios/public/provider/chrome/browser/voice/voice_search_bar.h"
171 #import "ios/public/provider/chrome/browser/voice/voice_search_bar_owner.h" 171 #import "ios/public/provider/chrome/browser/voice/voice_search_bar_owner.h"
172 #include "ios/public/provider/chrome/browser/voice/voice_search_controller.h" 172 #include "ios/public/provider/chrome/browser/voice/voice_search_controller.h"
173 #include "ios/public/provider/chrome/browser/voice/voice_search_controller_deleg ate.h" 173 #include "ios/public/provider/chrome/browser/voice/voice_search_controller_deleg ate.h"
174 #include "ios/public/provider/chrome/browser/voice/voice_search_provider.h" 174 #include "ios/public/provider/chrome/browser/voice/voice_search_provider.h"
175 #import "ios/web/navigation/crw_session_controller.h"
176 #include "ios/web/navigation/navigation_manager_impl.h" 175 #include "ios/web/navigation/navigation_manager_impl.h"
177 #include "ios/web/public/active_state_manager.h" 176 #include "ios/web/public/active_state_manager.h"
178 #include "ios/web/public/navigation_item.h" 177 #include "ios/web/public/navigation_item.h"
179 #import "ios/web/public/navigation_manager.h" 178 #import "ios/web/public/navigation_manager.h"
180 #include "ios/web/public/referrer_util.h" 179 #include "ios/web/public/referrer_util.h"
181 #include "ios/web/public/ssl_status.h" 180 #include "ios/web/public/ssl_status.h"
182 #include "ios/web/public/url_scheme_util.h" 181 #include "ios/web/public/url_scheme_util.h"
183 #include "ios/web/public/user_agent.h" 182 #include "ios/web/public/user_agent.h"
184 #include "ios/web/public/web_client.h" 183 #include "ios/web/public/web_client.h"
185 #import "ios/web/public/web_state/context_menu_params.h" 184 #import "ios/web/public/web_state/context_menu_params.h"
(...skipping 3241 matching lines...) Expand 10 before | Expand all | Expand 10 after
3427 3426
3428 - (void)showTabHistoryPopupForBackwardHistory { 3427 - (void)showTabHistoryPopupForBackwardHistory {
3429 DCHECK(self.visible || self.dismissingModal); 3428 DCHECK(self.visible || self.dismissingModal);
3430 3429
3431 // Dismiss the omnibox (if open). 3430 // Dismiss the omnibox (if open).
3432 [_toolbarController cancelOmniboxEdit]; 3431 [_toolbarController cancelOmniboxEdit];
3433 // Dismiss the soft keyboard (if open). 3432 // Dismiss the soft keyboard (if open).
3434 Tab* tab = [_model currentTab]; 3433 Tab* tab = [_model currentTab];
3435 [tab.webController dismissKeyboard]; 3434 [tab.webController dismissKeyboard];
3436 3435
3437 DCHECK([tab navigationManager]); 3436 web::NavigationManager* navigationManager = [tab navigationManager];
3438 CRWSessionController* sc = 3437 [_toolbarController
3439 [tab navigationManagerImpl]->GetSessionController(); 3438 showTabHistoryPopupInView:[self view]
3440 [_toolbarController showTabHistoryPopupInView:[self view] 3439 withItems:navigationManager->GetBackwardItems()
3441 withItems:[sc backwardItems] 3440 forBackHistory:YES];
3442 forBackHistory:YES];
3443 } 3441 }
3444 3442
3445 - (void)showTabHistoryPopupForForwardHistory { 3443 - (void)showTabHistoryPopupForForwardHistory {
3446 DCHECK(self.visible || self.dismissingModal); 3444 DCHECK(self.visible || self.dismissingModal);
3447 3445
3448 // Dismiss the omnibox (if open). 3446 // Dismiss the omnibox (if open).
3449 [_toolbarController cancelOmniboxEdit]; 3447 [_toolbarController cancelOmniboxEdit];
3450 // Dismiss the soft keyboard (if open). 3448 // Dismiss the soft keyboard (if open).
3451 Tab* tab = [_model currentTab]; 3449 Tab* tab = [_model currentTab];
3452 [tab.webController dismissKeyboard]; 3450 [tab.webController dismissKeyboard];
3453 3451
3454 DCHECK([tab navigationManager]); 3452 web::NavigationManager* navigationManager = [tab navigationManager];
3455 CRWSessionController* sc = 3453 DCHECK(navigationManager);
3456 [tab navigationManagerImpl]->GetSessionController(); 3454 [_toolbarController
3457 [_toolbarController showTabHistoryPopupInView:[self view] 3455 showTabHistoryPopupInView:[self view]
3458 withItems:[sc forwardItems] 3456 withItems:navigationManager->GetForwardItems()
3459 forBackHistory:NO]; 3457 forBackHistory:NO];
3460 } 3458 }
3461 3459
3462 - (void)navigateToSelectedEntry:(id)sender { 3460 - (void)navigateToSelectedEntry:(id)sender {
3463 DCHECK([sender isKindOfClass:[TabHistoryCell class]]); 3461 DCHECK([sender isKindOfClass:[TabHistoryCell class]]);
3464 TabHistoryCell* selectedCell = (TabHistoryCell*)sender; 3462 TabHistoryCell* selectedCell = (TabHistoryCell*)sender;
3465 [[_model currentTab] goToItem:selectedCell.item]; 3463 [[_model currentTab] goToItem:selectedCell.item];
3466 [_toolbarController dismissTabHistoryPopup]; 3464 [_toolbarController dismissTabHistoryPopup];
3467 } 3465 }
3468 3466
3469 - (void)print { 3467 - (void)print {
(...skipping 173 matching lines...) Expand 10 before | Expand all | Expand 10 after
3643 return; 3641 return;
3644 } 3642 }
3645 3643
3646 if (url == [_preloadController prerenderedURL]) { 3644 if (url == [_preloadController prerenderedURL]) {
3647 Tab* oldTab = [_model currentTab]; 3645 Tab* oldTab = [_model currentTab];
3648 Tab* newTab = [_preloadController releasePrerenderContents]; 3646 Tab* newTab = [_preloadController releasePrerenderContents];
3649 DCHECK(oldTab); 3647 DCHECK(oldTab);
3650 DCHECK(newTab); 3648 DCHECK(newTab);
3651 if (oldTab && newTab) { 3649 if (oldTab && newTab) {
3652 [oldTab recordStateInHistory]; 3650 [oldTab recordStateInHistory];
3653 DCHECK([newTab navigationManager]); 3651 web::NavigationManager* newNavigationManager = [newTab navigationManager];
3654 CRWSessionController* newHistory = 3652 web::NavigationManager* oldNavigationManager = [oldTab navigationManager];
3655 [newTab navigationManagerImpl]->GetSessionController(); 3653 newNavigationManager->InsertStateFromManager(oldNavigationManager);
3656 DCHECK([oldTab navigationManager]);
3657 CRWSessionController* oldHistory =
3658 [oldTab navigationManagerImpl]->GetSessionController();
3659 [newHistory insertStateFromSessionController:oldHistory];
3660 [[newTab nativeAppNavigationController] 3654 [[newTab nativeAppNavigationController]
3661 copyStateFrom:[oldTab nativeAppNavigationController]]; 3655 copyStateFrom:[oldTab nativeAppNavigationController]];
3662 [_model replaceTab:oldTab withTab:newTab]; 3656 [_model replaceTab:oldTab withTab:newTab];
3663 3657
3664 // Set isPrerenderTab to NO after replacing the tab. This will allow the 3658 // Set isPrerenderTab to NO after replacing the tab. This will allow the
3665 // BrowserViewController to detect that a pre-rendered tab is switched in, 3659 // BrowserViewController to detect that a pre-rendered tab is switched in,
3666 // and show the prerendering animation. 3660 // and show the prerendering animation.
3667 newTab.isPrerenderTab = NO; 3661 newTab.isPrerenderTab = NO;
3668 3662
3669 [self tabLoadComplete:newTab withSuccess:newTab.loadFinished]; 3663 [self tabLoadComplete:newTab withSuccess:newTab.loadFinished];
(...skipping 1418 matching lines...) Expand 10 before | Expand all | Expand 10 after
5088 5082
5089 - (UIView*)voiceSearchButton { 5083 - (UIView*)voiceSearchButton {
5090 return _voiceSearchButton; 5084 return _voiceSearchButton;
5091 } 5085 }
5092 5086
5093 - (id<LogoAnimationControllerOwner>)logoAnimationControllerOwner { 5087 - (id<LogoAnimationControllerOwner>)logoAnimationControllerOwner {
5094 return [self currentLogoAnimationControllerOwner]; 5088 return [self currentLogoAnimationControllerOwner];
5095 } 5089 }
5096 5090
5097 @end 5091 @end
OLDNEW
« no previous file with comments | « ios/chrome/browser/ui/DEPS ('k') | ios/chrome/browser/ui/browser_view_controller_unittest.mm » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698