OLD | NEW |
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 Loading... |
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 Loading... |
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 |
OLD | NEW |