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