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

Unified 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 side-by-side diff with in-line comments
Download patch
Index: ios/chrome/browser/ui/browser_view_controller.mm
diff --git a/ios/chrome/browser/ui/browser_view_controller.mm b/ios/chrome/browser/ui/browser_view_controller.mm
index 4e535e1707b9fc7381d539b27c44681518c355af..55fd8bd6e2d2b98765a2597056c8187a5543679f 100644
--- a/ios/chrome/browser/ui/browser_view_controller.mm
+++ b/ios/chrome/browser/ui/browser_view_controller.mm
@@ -679,11 +679,9 @@ - (void)tabLoadComplete:(Tab*)tab withSuccess:(BOOL)success;
// Evaluates Javascript asynchronously using the current page context.
- (void)openJavascript:(NSString*)javascript;
-// Sets the desktop user agent flag and reloads the current page.
-- (void)enableDesktopUserAgent;
-
-// Sets the desktop user agent flag and reloads the current page.
-- (void)enableMobileUserAgent;
+// Reloads the transient item if any, the pending item if a navigation is in
+// progress or the last committed item otherwise with |userAgentType|.
+- (void)reloadWithUserAgentType:(web::UserAgentType)userAgentType;
// Helper methods used by ShareToDelegate methods.
// Shows an alert with the given title and message id.
@@ -4024,10 +4022,10 @@ - (IBAction)chromeExecuteCommand:(id)sender {
[[_model currentTab] switchToReaderMode];
break;
case IDC_REQUEST_DESKTOP_SITE:
- [self enableDesktopUserAgent];
+ [self reloadWithUserAgentType:web::UserAgentType::DESKTOP];
break;
case IDC_REQUEST_MOBILE_SITE:
- [self enableMobileUserAgent];
+ [self reloadWithUserAgentType:web::UserAgentType::MOBILE];
break;
case IDC_SHOW_TOOLS_MENU: {
[self showToolsMenuPopup];
@@ -4236,14 +4234,8 @@ - (void)showHelpPage {
appendTo:kCurrentTab];
}
-- (void)enableDesktopUserAgent {
- [[_model currentTab] reloadForDesktopUserAgent];
-}
-
-// TODO(crbug.com/692303): Implement the actual functionality of
-// "Request Mobile Site", and also refactoring the user agent related function
-// names to improve readability.
-- (void)enableMobileUserAgent {
+- (void)reloadWithUserAgentType:(web::UserAgentType)userAgentType {
+ [[_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.
}
- (void)resetAllWebViews {

Powered by Google App Engine
This is Rietveld 408576698