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 664 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 675 provider:(id<CRWNativeContentProvider>)provider | 675 provider:(id<CRWNativeContentProvider>)provider |
| 676 opener:(Tab*)opener | 676 opener:(Tab*)opener |
| 677 desktopUserAgent:(BOOL)desktopUserAgent | 677 desktopUserAgent:(BOOL)desktopUserAgent |
| 678 configuration:(void (^)(Tab*))configuration { | 678 configuration:(void (^)(Tab*))configuration { |
| 679 Tab* tab = [[[Tab alloc] initWithWindowName:nil | 679 Tab* tab = [[[Tab alloc] initWithWindowName:nil |
| 680 opener:opener | 680 opener:opener |
| 681 openedByDOM:NO | 681 openedByDOM:NO |
| 682 model:nil | 682 model:nil |
| 683 browserState:browserState] autorelease]; | 683 browserState:browserState] autorelease]; |
| 684 if (desktopUserAgent) | 684 if (desktopUserAgent) |
| 685 [tab enableDesktopUserAgent]; | 685 [tab activateDesktopUserAgent]; |
| 686 [[tab webController] setNativeProvider:provider]; | 686 [[tab webController] setNativeProvider:provider]; |
| 687 [[tab webController] setWebUsageEnabled:YES]; | 687 [[tab webController] setWebUsageEnabled:YES]; |
| 688 | 688 |
| 689 if (configuration) | 689 if (configuration) |
| 690 configuration(tab); | 690 configuration(tab); |
| 691 | 691 |
| 692 web::NavigationManager::WebLoadParams params(URL); | 692 web::NavigationManager::WebLoadParams params(URL); |
| 693 params.transition_type = transition; | 693 params.transition_type = transition; |
| 694 params.referrer = referrer; | 694 params.referrer = referrer; |
| 695 [[tab webController] loadWithParams:params]; | 695 [[tab webController] loadWithParams:params]; |
| (...skipping 855 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1551 } | 1551 } |
| 1552 | 1552 |
| 1553 - (BOOL)usesDesktopUserAgent { | 1553 - (BOOL)usesDesktopUserAgent { |
| 1554 if (!self.navigationManager) | 1554 if (!self.navigationManager) |
| 1555 return NO; | 1555 return NO; |
| 1556 | 1556 |
| 1557 web::NavigationItem* visibleItem = self.navigationManager->GetVisibleItem(); | 1557 web::NavigationItem* visibleItem = self.navigationManager->GetVisibleItem(); |
| 1558 return visibleItem && visibleItem->IsOverridingUserAgent(); | 1558 return visibleItem && visibleItem->IsOverridingUserAgent(); |
| 1559 } | 1559 } |
| 1560 | 1560 |
| 1561 - (void)enableDesktopUserAgent { | 1561 - (void)activateDesktopUserAgent { |
| 1562 DCHECK_EQ(self.usesDesktopUserAgent, NO); | 1562 DCHECK_EQ(self.usesDesktopUserAgent, NO); |
| 1563 DCHECK([self navigationManager]); | 1563 DCHECK([self navigationManager]); |
| 1564 [self navigationManager]->OverrideDesktopUserAgentForNextPendingItem(); | 1564 [self navigationManager]->OverrideDesktopUserAgentForNextPendingItem(); |
| 1565 } | 1565 } |
| 1566 | 1566 |
| 1567 - (void)reloadForDesktopUserAgent { | 1567 - (void)activateMobileUserAgent { |
| 1568 } | |
|
liaoyuke
2017/02/23 22:17:17
Place holder, will get rid of "[self navigationMan
| |
| 1569 | |
| 1570 - (void)reloadForUpdatedUserAgent { | |
| 1568 // |loadWithParams| will recreate the removed UIWebView. | 1571 // |loadWithParams| will recreate the removed UIWebView. |
| 1569 [self.webController requirePageReconstruction]; | 1572 [self.webController requirePageReconstruction]; |
| 1570 | 1573 |
| 1571 // TODO(crbug.com/228171): A hack in session_controller -addPendingItem | 1574 // TODO(crbug.com/228171): A hack in session_controller -addPendingItem |
| 1572 // discusses making tab responsible for distinguishing history stack | 1575 // discusses making tab responsible for distinguishing history stack |
| 1573 // navigation from new navigations. Because we want a new navigation here, we | 1576 // navigation from new navigations. Because we want a new navigation here, we |
| 1574 // use |PAGE_TRANSITION_FORM_SUBMIT|. When session_controller changes, so | 1577 // use |PAGE_TRANSITION_FORM_SUBMIT|. When session_controller changes, so |
| 1575 // should this. | 1578 // should this. |
| 1576 ui::PageTransition transition = | 1579 ui::PageTransition transition = |
| 1577 ui::PageTransitionFromInt(ui::PAGE_TRANSITION_FORM_SUBMIT); | 1580 ui::PageTransitionFromInt(ui::PAGE_TRANSITION_FORM_SUBMIT); |
| (...skipping 631 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2209 | 2212 |
| 2210 - (TabModel*)parentTabModel { | 2213 - (TabModel*)parentTabModel { |
| 2211 return parentTabModel_; | 2214 return parentTabModel_; |
| 2212 } | 2215 } |
| 2213 | 2216 |
| 2214 - (FormInputAccessoryViewController*)inputAccessoryViewController { | 2217 - (FormInputAccessoryViewController*)inputAccessoryViewController { |
| 2215 return inputAccessoryViewController_.get(); | 2218 return inputAccessoryViewController_.get(); |
| 2216 } | 2219 } |
| 2217 | 2220 |
| 2218 @end | 2221 @end |
| OLD | NEW |