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

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: removed unused includes 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 web::NavigationItem* item = nullptr;
Eugene But (OOO till 7-30) 2017/03/30 23:01:49 How about this?: web::NavigationItem* item = self
liaoyuke 2017/03/31 15:50:12 Done.
1483 return visibleItem && 1483 if (self.navigationManager->GetTransientItem())
1484 visibleItem->GetUserAgentType() == web::UserAgentType::DESKTOP; 1484 item = self.navigationManager->GetTransientItem();
1485 else if (self.navigationManager->GetPendingItem())
1486 item = self.navigationManager->GetPendingItem();
1487 else if (self.navigationManager->GetLastCommittedItem())
1488 item = self.navigationManager->GetLastCommittedItem();
1489
1490 return item && item->GetUserAgentType() == web::UserAgentType::DESKTOP;
1485 } 1491 }
1486 1492
1487 - (void)enableDesktopUserAgent { 1493 - (void)enableDesktopUserAgent {
1488 DCHECK_EQ(self.usesDesktopUserAgent, NO); 1494 DCHECK_EQ(self.usesDesktopUserAgent, NO);
1489 DCHECK([self navigationManager]); 1495 DCHECK([self navigationManager]);
1490 [self navigationManager]->OverrideDesktopUserAgentForNextPendingItem(); 1496 [self navigationManager]->OverrideDesktopUserAgentForNextPendingItem();
1491 } 1497 }
1492 1498
1493 - (void)reloadForDesktopUserAgent { 1499 - (void)reloadForDesktopUserAgent {
1494 // This removes the web view, which will be recreated at the end of this. 1500 // 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 2093
2088 - (TabModel*)parentTabModel { 2094 - (TabModel*)parentTabModel {
2089 return parentTabModel_; 2095 return parentTabModel_;
2090 } 2096 }
2091 2097
2092 - (FormInputAccessoryViewController*)inputAccessoryViewController { 2098 - (FormInputAccessoryViewController*)inputAccessoryViewController {
2093 return inputAccessoryViewController_.get(); 2099 return inputAccessoryViewController_.get();
2094 } 2100 }
2095 2101
2096 @end 2102 @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