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

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

Issue 2779263002: Set user agent type of transient item the same as pending item. (Closed)
Patch Set: Address comments and add unit tests 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/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 1461 matching lines...) Expand 10 before | Expand all | Expand 10 after
1472 1472
1473 [self.readerModeController exitReaderMode]; 1473 [self.readerModeController exitReaderMode];
1474 } 1474 }
1475 1475
1476 #pragma mark - 1476 #pragma mark -
1477 1477
1478 - (BOOL)usesDesktopUserAgent { 1478 - (BOOL)usesDesktopUserAgent {
1479 if (!self.navigationManager) 1479 if (!self.navigationManager)
1480 return NO; 1480 return NO;
1481 1481
1482 web::NavigationItem* visibleItem = self.navigationManager->GetVisibleItem(); 1482 // TODO(crbug.com/707081): Clean this up once the bug is fixed.
1483 return visibleItem && 1483 web::NavigationItem* item = self.navigationManager->GetTransientItem();
1484 visibleItem->GetUserAgentType() == web::UserAgentType::DESKTOP; 1484 if (!item)
1485 item = self.navigationManager->GetPendingItem();
1486 if (!item)
1487 item = self.navigationManager->GetLastCommittedItem();
1488
1489 return item && item->GetUserAgentType() == web::UserAgentType::DESKTOP;
1485 } 1490 }
1486 1491
1487 - (void)enableDesktopUserAgent { 1492 - (void)enableDesktopUserAgent {
1488 DCHECK_EQ(self.usesDesktopUserAgent, NO); 1493 DCHECK_EQ(self.usesDesktopUserAgent, NO);
1489 DCHECK([self navigationManager]); 1494 DCHECK([self navigationManager]);
1490 [self navigationManager]->OverrideDesktopUserAgentForNextPendingItem(); 1495 [self navigationManager]->OverrideDesktopUserAgentForNextPendingItem();
1491 } 1496 }
1492 1497
1493 - (void)reloadForDesktopUserAgent { 1498 - (void)reloadForDesktopUserAgent {
1494 // This removes the web view, which will be recreated at the end of this. 1499 // This removes the web view, which will be recreated at the end of this.
(...skipping 592 matching lines...) Expand 10 before | Expand all | Expand 10 after
2087 2092
2088 - (TabModel*)parentTabModel { 2093 - (TabModel*)parentTabModel {
2089 return parentTabModel_; 2094 return parentTabModel_;
2090 } 2095 }
2091 2096
2092 - (FormInputAccessoryViewController*)inputAccessoryViewController { 2097 - (FormInputAccessoryViewController*)inputAccessoryViewController {
2093 return inputAccessoryViewController_.get(); 2098 return inputAccessoryViewController_.get();
2094 } 2099 }
2095 2100
2096 @end 2101 @end
OLDNEW
« no previous file with comments | « no previous file | ios/chrome/browser/ui/browser_view_controller.mm » ('j') | ios/chrome/browser/ui/browser_view_controller.mm » ('J')

Powered by Google App Engine
This is Rietveld 408576698