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

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

Issue 2789433006: Implement request mobile site. (Closed)
Patch Set: Address self review comments Created 3 years, 8 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
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 661 matching lines...) Expand 10 before | Expand all | Expand 10 after
672 // screen or just the size of the space under the header. 672 // screen or just the size of the space under the header.
673 // Returns the CardView that was added. 673 // Returns the CardView that was added.
674 - (CardView*)addCardViewInFullscreen:(BOOL)fullScreen; 674 - (CardView*)addCardViewInFullscreen:(BOOL)fullScreen;
675 // Called when either a tab finishes loading or when a tab with finished content 675 // Called when either a tab finishes loading or when a tab with finished content
676 // is added directly to the model via pre-rendering. The tab must be non-nil and 676 // is added directly to the model via pre-rendering. The tab must be non-nil and
677 // must be a member of the tab model controlled by this BrowserViewController. 677 // must be a member of the tab model controlled by this BrowserViewController.
678 - (void)tabLoadComplete:(Tab*)tab withSuccess:(BOOL)success; 678 - (void)tabLoadComplete:(Tab*)tab withSuccess:(BOOL)success;
679 // Evaluates Javascript asynchronously using the current page context. 679 // Evaluates Javascript asynchronously using the current page context.
680 - (void)openJavascript:(NSString*)javascript; 680 - (void)openJavascript:(NSString*)javascript;
681 681
682 // Sets the desktop user agent flag and reloads the current page. 682 // Reloads the transient item if any, the pending item if a navigation is in
683 - (void)enableDesktopUserAgent; 683 // progress or the last committed item otherwise with |userAgentType|.
684 684 - (void)reloadWithUserAgentType:(web::UserAgentType)userAgentType;
685 // Sets the desktop user agent flag and reloads the current page.
686 - (void)enableMobileUserAgent;
687 685
688 // Helper methods used by ShareToDelegate methods. 686 // Helper methods used by ShareToDelegate methods.
689 // Shows an alert with the given title and message id. 687 // Shows an alert with the given title and message id.
690 - (void)showErrorAlert:(int)titleMessageId message:(int)messageId; 688 - (void)showErrorAlert:(int)titleMessageId message:(int)messageId;
691 // Helper method displaying an alert with the given title and message. 689 // Helper method displaying an alert with the given title and message.
692 // Dismisses previous alert if it has not been dismissed yet. 690 // Dismisses previous alert if it has not been dismissed yet.
693 - (void)showErrorAlertWithStringTitle:(NSString*)title 691 - (void)showErrorAlertWithStringTitle:(NSString*)title
694 message:(NSString*)message; 692 message:(NSString*)message;
695 // Shows a self-dismissing snackbar displaying |message|. 693 // Shows a self-dismissing snackbar displaying |message|.
696 - (void)showSnackbar:(NSString*)message; 694 - (void)showSnackbar:(NSString*)message;
(...skipping 3320 matching lines...) Expand 10 before | Expand all | Expand 10 after
4017 case IDC_SHARE_PAGE: 4015 case IDC_SHARE_PAGE:
4018 [self sharePage]; 4016 [self sharePage];
4019 break; 4017 break;
4020 case IDC_SHOW_MAIL_COMPOSER: 4018 case IDC_SHOW_MAIL_COMPOSER:
4021 [self showMailComposer:sender]; 4019 [self showMailComposer:sender];
4022 break; 4020 break;
4023 case IDC_READER_MODE: 4021 case IDC_READER_MODE:
4024 [[_model currentTab] switchToReaderMode]; 4022 [[_model currentTab] switchToReaderMode];
4025 break; 4023 break;
4026 case IDC_REQUEST_DESKTOP_SITE: 4024 case IDC_REQUEST_DESKTOP_SITE:
4027 [self enableDesktopUserAgent]; 4025 [self reloadWithUserAgentType:web::UserAgentType::DESKTOP];
4028 break; 4026 break;
4029 case IDC_REQUEST_MOBILE_SITE: 4027 case IDC_REQUEST_MOBILE_SITE:
4030 [self enableMobileUserAgent]; 4028 [self reloadWithUserAgentType:web::UserAgentType::MOBILE];
4031 break; 4029 break;
4032 case IDC_SHOW_TOOLS_MENU: { 4030 case IDC_SHOW_TOOLS_MENU: {
4033 [self showToolsMenuPopup]; 4031 [self showToolsMenuPopup];
4034 break; 4032 break;
4035 } 4033 }
4036 case IDC_SHOW_BOOKMARK_MANAGER: { 4034 case IDC_SHOW_BOOKMARK_MANAGER: {
4037 if (IsIPadIdiom()) { 4035 if (IsIPadIdiom()) {
4038 [self showAllBookmarks]; 4036 [self showAllBookmarks];
4039 } else { 4037 } else {
4040 [self initializeBookmarkInteractionController]; 4038 [self initializeBookmarkInteractionController];
(...skipping 188 matching lines...) Expand 10 before | Expand all | Expand 10 after
4229 } 4227 }
4230 4228
4231 - (void)showHelpPage { 4229 - (void)showHelpPage {
4232 GURL helpUrl(l10n_util::GetStringUTF16(IDS_IOS_TOOLS_MENU_HELP_URL)); 4230 GURL helpUrl(l10n_util::GetStringUTF16(IDS_IOS_TOOLS_MENU_HELP_URL));
4233 [self webPageOrderedOpen:helpUrl 4231 [self webPageOrderedOpen:helpUrl
4234 referrer:web::Referrer() 4232 referrer:web::Referrer()
4235 inBackground:NO 4233 inBackground:NO
4236 appendTo:kCurrentTab]; 4234 appendTo:kCurrentTab];
4237 } 4235 }
4238 4236
4239 - (void)enableDesktopUserAgent { 4237 - (void)reloadWithUserAgentType:(web::UserAgentType)userAgentType {
4240 [[_model currentTab] reloadForDesktopUserAgent]; 4238 [[_model currentTab] reloadWithUserAgentType:userAgentType];
kkhorimoto 2017/04/11 01:09:42 Let's just call this in-line in the switch stateme
liaoyuke 2017/04/11 18:27:20 Done.
4241 }
4242
4243 // TODO(crbug.com/692303): Implement the actual functionality of
4244 // "Request Mobile Site", and also refactoring the user agent related function
4245 // names to improve readability.
4246 - (void)enableMobileUserAgent {
4247 } 4239 }
4248 4240
4249 - (void)resetAllWebViews { 4241 - (void)resetAllWebViews {
4250 [_dialogPresenter cancelAllDialogs]; 4242 [_dialogPresenter cancelAllDialogs];
4251 [_model resetAllWebViews]; 4243 [_model resetAllWebViews];
4252 } 4244 }
4253 4245
4254 #pragma mark - Find Bar 4246 #pragma mark - Find Bar
4255 4247
4256 - (void)hideFindBarWithAnimation:(BOOL)animate { 4248 - (void)hideFindBarWithAnimation:(BOOL)animate {
(...skipping 889 matching lines...) Expand 10 before | Expand all | Expand 10 after
5146 5138
5147 - (UIView*)voiceSearchButton { 5139 - (UIView*)voiceSearchButton {
5148 return _voiceSearchButton; 5140 return _voiceSearchButton;
5149 } 5141 }
5150 5142
5151 - (id<LogoAnimationControllerOwner>)logoAnimationControllerOwner { 5143 - (id<LogoAnimationControllerOwner>)logoAnimationControllerOwner {
5152 return [self currentLogoAnimationControllerOwner]; 5144 return [self currentLogoAnimationControllerOwner];
5153 } 5145 }
5154 5146
5155 @end 5147 @end
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698