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

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

Issue 2722983003: Reland Tab History and BrowserViewController CRWSessionEntry removal. (Closed)
Patch Set: TODO, early return 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/history/BUILD.gn » ('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 #import "ios/net/request_tracker.h" 165 #import "ios/net/request_tracker.h"
166 #include "ios/public/provider/chrome/browser/chrome_browser_provider.h" 166 #include "ios/public/provider/chrome/browser/chrome_browser_provider.h"
167 #include "ios/public/provider/chrome/browser/ui/app_rating_prompt.h" 167 #include "ios/public/provider/chrome/browser/ui/app_rating_prompt.h"
168 #include "ios/public/provider/chrome/browser/ui/default_ios_web_view_factory.h" 168 #include "ios/public/provider/chrome/browser/ui/default_ios_web_view_factory.h"
169 #import "ios/public/provider/chrome/browser/voice/voice_search_bar.h" 169 #import "ios/public/provider/chrome/browser/voice/voice_search_bar.h"
170 #import "ios/public/provider/chrome/browser/voice/voice_search_bar_owner.h" 170 #import "ios/public/provider/chrome/browser/voice/voice_search_bar_owner.h"
171 #include "ios/public/provider/chrome/browser/voice/voice_search_controller.h" 171 #include "ios/public/provider/chrome/browser/voice/voice_search_controller.h"
172 #include "ios/public/provider/chrome/browser/voice/voice_search_controller_deleg ate.h" 172 #include "ios/public/provider/chrome/browser/voice/voice_search_controller_deleg ate.h"
173 #include "ios/public/provider/chrome/browser/voice/voice_search_provider.h" 173 #include "ios/public/provider/chrome/browser/voice/voice_search_provider.h"
174 #import "ios/web/navigation/crw_session_controller.h" 174 #import "ios/web/navigation/crw_session_controller.h"
175 #import "ios/web/navigation/crw_session_entry.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/web_client.h" 182 #include "ios/web/public/web_client.h"
184 #import "ios/web/public/web_state/context_menu_params.h" 183 #import "ios/web/public/web_state/context_menu_params.h"
185 #import "ios/web/public/web_state/crw_web_view_proxy.h" 184 #import "ios/web/public/web_state/crw_web_view_proxy.h"
(...skipping 1725 matching lines...) Expand 10 before | Expand all | Expand 10 after
1911 1910
1912 FindInPageController* controller = GetFindInPageController(tab); 1911 FindInPageController* controller = GetFindInPageController(tab);
1913 if (controller.findInPageModel.enabled) { 1912 if (controller.findInPageModel.enabled) {
1914 [self showFindBarWithAnimation:NO 1913 [self showFindBarWithAnimation:NO
1915 selectText:YES 1914 selectText:YES
1916 shouldFocus:[_findBarController isFocused]]; 1915 shouldFocus:[_findBarController isFocused]];
1917 } 1916 }
1918 1917
1919 // Hide the toolbar if displaying phone NTP. 1918 // Hide the toolbar if displaying phone NTP.
1920 if (!IsIPadIdiom()) { 1919 if (!IsIPadIdiom()) {
1921 CRWSessionEntry* entry = 1920 web::NavigationItem* item = [tab navigationManager]->GetVisibleItem();
1922 [[tab navigationManagerImpl]->GetSessionController() currentEntry];
1923 BOOL hideToolbar = NO; 1921 BOOL hideToolbar = NO;
1924 if (entry) { 1922 if (item) {
1925 GURL url = [entry navigationItem]->GetURL(); 1923 GURL url = item->GetURL();
1926 BOOL isNTP = url.GetOrigin() == GURL(kChromeUINewTabURL); 1924 BOOL isNTP = url.GetOrigin() == GURL(kChromeUINewTabURL);
1927 hideToolbar = isNTP && !_isOffTheRecord && 1925 hideToolbar = isNTP && !_isOffTheRecord &&
1928 ![_toolbarController isOmniboxFirstResponder] && 1926 ![_toolbarController isOmniboxFirstResponder] &&
1929 ![_toolbarController showingOmniboxPopup]; 1927 ![_toolbarController showingOmniboxPopup];
1930 } 1928 }
1931 [[_toolbarController view] setHidden:hideToolbar]; 1929 [[_toolbarController view] setHidden:hideToolbar];
1932 } 1930 }
1933 } 1931 }
1934 1932
1935 - (void)updateDialogPresenterActiveState { 1933 - (void)updateDialogPresenterActiveState {
(...skipping 1437 matching lines...) Expand 10 before | Expand all | Expand 10 after
3373 // Dismiss the omnibox (if open). 3371 // Dismiss the omnibox (if open).
3374 [_toolbarController cancelOmniboxEdit]; 3372 [_toolbarController cancelOmniboxEdit];
3375 // Dismiss the soft keyboard (if open). 3373 // Dismiss the soft keyboard (if open).
3376 Tab* tab = [_model currentTab]; 3374 Tab* tab = [_model currentTab];
3377 [tab.webController dismissKeyboard]; 3375 [tab.webController dismissKeyboard];
3378 3376
3379 DCHECK([tab navigationManager]); 3377 DCHECK([tab navigationManager]);
3380 CRWSessionController* sc = 3378 CRWSessionController* sc =
3381 [tab navigationManagerImpl]->GetSessionController(); 3379 [tab navigationManagerImpl]->GetSessionController();
3382 [_toolbarController showTabHistoryPopupInView:[self view] 3380 [_toolbarController showTabHistoryPopupInView:[self view]
3383 withSessionEntries:[sc backwardEntries] 3381 withItems:[sc backwardItems]
3384 forBackHistory:YES]; 3382 forBackHistory:YES];
3385 } 3383 }
3386 3384
3387 - (void)showTabHistoryPopupForForwardHistory { 3385 - (void)showTabHistoryPopupForForwardHistory {
3388 DCHECK(self.visible || self.dismissingModal); 3386 DCHECK(self.visible || self.dismissingModal);
3389 3387
3390 // Dismiss the omnibox (if open). 3388 // Dismiss the omnibox (if open).
3391 [_toolbarController cancelOmniboxEdit]; 3389 [_toolbarController cancelOmniboxEdit];
3392 // Dismiss the soft keyboard (if open). 3390 // Dismiss the soft keyboard (if open).
3393 Tab* tab = [_model currentTab]; 3391 Tab* tab = [_model currentTab];
3394 [tab.webController dismissKeyboard]; 3392 [tab.webController dismissKeyboard];
3395 3393
3396 DCHECK([tab navigationManager]); 3394 DCHECK([tab navigationManager]);
3397 CRWSessionController* sc = 3395 CRWSessionController* sc =
3398 [tab navigationManagerImpl]->GetSessionController(); 3396 [tab navigationManagerImpl]->GetSessionController();
3399 [_toolbarController showTabHistoryPopupInView:[self view] 3397 [_toolbarController showTabHistoryPopupInView:[self view]
3400 withSessionEntries:[sc forwardEntries] 3398 withItems:[sc forwardItems]
3401 forBackHistory:NO]; 3399 forBackHistory:NO];
3402 } 3400 }
3403 3401
3404 - (void)navigateToSelectedEntry:(id)sender { 3402 - (void)navigateToSelectedEntry:(id)sender {
3405 DCHECK([sender isKindOfClass:[TabHistoryCell class]]); 3403 DCHECK([sender isKindOfClass:[TabHistoryCell class]]);
3406 TabHistoryCell* selectedCell = (TabHistoryCell*)sender; 3404 TabHistoryCell* selectedCell = (TabHistoryCell*)sender;
3407 [[_model currentTab] goToItem:selectedCell.entry.navigationItem]; 3405 [[_model currentTab] goToItem:selectedCell.item];
3408 [_toolbarController dismissTabHistoryPopup]; 3406 [_toolbarController dismissTabHistoryPopup];
3409 } 3407 }
3410 3408
3411 - (void)print { 3409 - (void)print {
3412 Tab* currentTab = [_model currentTab]; 3410 Tab* currentTab = [_model currentTab];
3413 // The UI should prevent users from printing non-printable pages. However, a 3411 // The UI should prevent users from printing non-printable pages. However, a
3414 // redirection to an un-printable page can happen before it is reflected in 3412 // redirection to an un-printable page can happen before it is reflected in
3415 // the UI. 3413 // the UI.
3416 if (![currentTab viewForPrinting]) { 3414 if (![currentTab viewForPrinting]) {
3417 [self showSnackbar:l10n_util::GetNSString(IDS_IOS_CANNOT_PRINT_PAGE_ERROR)]; 3415 [self showSnackbar:l10n_util::GetNSString(IDS_IOS_CANNOT_PRINT_PAGE_ERROR)];
(...skipping 1392 matching lines...) Expand 10 before | Expand all | Expand 10 after
4810 } 4808 }
4811 return YES; 4809 return YES;
4812 } 4810 }
4813 4811
4814 #pragma mark - PreloadControllerDelegate methods 4812 #pragma mark - PreloadControllerDelegate methods
4815 4813
4816 - (BOOL)shouldUseDesktopUserAgent { 4814 - (BOOL)shouldUseDesktopUserAgent {
4817 return [_model currentTab].usesDesktopUserAgent; 4815 return [_model currentTab].usesDesktopUserAgent;
4818 } 4816 }
4819 4817
4820 - (CRWSessionEntry*)currentSessionEntry {
4821 Tab* tab = [_model currentTab];
4822 if (![tab navigationManager])
4823 return nil;
4824 return [[tab navigationManagerImpl]->GetSessionController() currentEntry];
4825 }
4826
4827 #pragma mark - BookmarkBridgeMethods 4818 #pragma mark - BookmarkBridgeMethods
4828 4819
4829 // If an added or removed bookmark is the same as the current url, update the 4820 // If an added or removed bookmark is the same as the current url, update the
4830 // toolbar so the star highlight is kept in sync. 4821 // toolbar so the star highlight is kept in sync.
4831 - (void)bookmarkNodeModified:(const BookmarkNode*)node { 4822 - (void)bookmarkNodeModified:(const BookmarkNode*)node {
4832 if ([_model currentTab] && node->url() == [_model currentTab].url) 4823 if ([_model currentTab] && node->url() == [_model currentTab].url)
4833 [self updateToolbar]; 4824 [self updateToolbar];
4834 } 4825 }
4835 4826
4836 // If all bookmarks are removed, update the toolbar so the star highlight is 4827 // If all bookmarks are removed, update the toolbar so the star highlight is
(...skipping 188 matching lines...) Expand 10 before | Expand all | Expand 10 after
5025 5016
5026 - (UIView*)voiceSearchButton { 5017 - (UIView*)voiceSearchButton {
5027 return _voiceSearchButton; 5018 return _voiceSearchButton;
5028 } 5019 }
5029 5020
5030 - (id<LogoAnimationControllerOwner>)logoAnimationControllerOwner { 5021 - (id<LogoAnimationControllerOwner>)logoAnimationControllerOwner {
5031 return [self currentLogoAnimationControllerOwner]; 5022 return [self currentLogoAnimationControllerOwner];
5032 } 5023 }
5033 5024
5034 @end 5025 @end
OLDNEW
« no previous file with comments | « ios/chrome/browser/ui/DEPS ('k') | ios/chrome/browser/ui/history/BUILD.gn » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698