| 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/ui/toolbar/web_toolbar_controller.h" | 5 #import "ios/chrome/browser/ui/toolbar/web_toolbar_controller.h" |
| 6 | 6 |
| 7 #import <CoreLocation/CoreLocation.h> | 7 #import <CoreLocation/CoreLocation.h> |
| 8 #include <QuartzCore/QuartzCore.h> | 8 #include <QuartzCore/QuartzCore.h> |
| 9 | 9 |
| 10 #include <stdint.h> | 10 #include <stdint.h> |
| (...skipping 787 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 798 | 798 |
| 799 - (UIImage*)snapshotWithWidth:(CGFloat)width { | 799 - (UIImage*)snapshotWithWidth:(CGFloat)width { |
| 800 if (IsIPadIdiom()) | 800 if (IsIPadIdiom()) |
| 801 return nil; | 801 return nil; |
| 802 // Below call will be no-op if cached snapshot is valid. | 802 // Below call will be no-op if cached snapshot is valid. |
| 803 [self updateSnapshotWithWidth:width forced:YES]; | 803 [self updateSnapshotWithWidth:width forced:YES]; |
| 804 return [[_snapshot retain] autorelease]; | 804 return [[_snapshot retain] autorelease]; |
| 805 } | 805 } |
| 806 | 806 |
| 807 - (void)showTabHistoryPopupInView:(UIView*)view | 807 - (void)showTabHistoryPopupInView:(UIView*)view |
| 808 withSessionEntries:(NSArray*)sessionEntries | 808 withItems:(const web::NavigationItemList&)items |
| 809 forBackHistory:(BOOL)isBackHistory { | 809 forBackHistory:(BOOL)isBackHistory { |
| 810 if (_tabHistoryPopupController) | 810 if (_tabHistoryPopupController) |
| 811 return; | 811 return; |
| 812 | 812 |
| 813 base::RecordAction(UserMetricsAction("MobileToolbarShowTabHistoryMenu")); | 813 base::RecordAction(UserMetricsAction("MobileToolbarShowTabHistoryMenu")); |
| 814 | 814 |
| 815 UIButton* historyButton = isBackHistory ? _backButton : _forwardButton; | 815 UIButton* historyButton = isBackHistory ? _backButton : _forwardButton; |
| 816 // Keep the button pressed by swapping the normal and highlighted images. | 816 // Keep the button pressed by swapping the normal and highlighted images. |
| 817 [self setImagesForNavButton:historyButton withTabHistoryVisible:YES]; | 817 [self setImagesForNavButton:historyButton withTabHistoryVisible:YES]; |
| 818 | 818 |
| 819 // Set the origin for the tools popup to the leading side of the bottom of the | 819 // Set the origin for the tools popup to the leading side of the bottom of the |
| 820 // pressed buttons. | 820 // pressed buttons. |
| 821 CGRect buttonBounds = [historyButton.imageView bounds]; | 821 CGRect buttonBounds = [historyButton.imageView bounds]; |
| 822 CGPoint origin = CGPointMake(CGRectGetLeadingEdge(buttonBounds), | 822 CGPoint origin = CGPointMake(CGRectGetLeadingEdge(buttonBounds), |
| 823 CGRectGetMaxY(buttonBounds)); | 823 CGRectGetMaxY(buttonBounds)); |
| 824 CGPoint convertedOrigin = | 824 CGPoint convertedOrigin = |
| 825 [view convertPoint:origin fromView:historyButton.imageView]; | 825 [view convertPoint:origin fromView:historyButton.imageView]; |
| 826 _tabHistoryPopupController.reset([[TabHistoryPopupController alloc] | 826 _tabHistoryPopupController.reset([[TabHistoryPopupController alloc] |
| 827 initWithOrigin:convertedOrigin | 827 initWithOrigin:convertedOrigin |
| 828 parentView:view | 828 parentView:view |
| 829 entries:sessionEntries]); | 829 items:items]); |
| 830 [_tabHistoryPopupController setDelegate:self]; | 830 [_tabHistoryPopupController setDelegate:self]; |
| 831 | 831 |
| 832 // Fade in the popup and notify observers. |
| 833 CGRect containerFrame = [[_tabHistoryPopupController popupContainer] frame]; |
| 834 CGPoint destination = CGPointMake(CGRectGetLeadingEdge(containerFrame), |
| 835 CGRectGetMinY(containerFrame)); |
| 836 [_tabHistoryPopupController fadeInPopupFromSource:convertedOrigin |
| 837 toDestination:destination]; |
| 832 [[NSNotificationCenter defaultCenter] | 838 [[NSNotificationCenter defaultCenter] |
| 833 postNotificationName:kTabHistoryPopupWillShowNotification | 839 postNotificationName:kTabHistoryPopupWillShowNotification |
| 834 object:nil]; | 840 object:nil]; |
| 835 } | 841 } |
| 836 | 842 |
| 837 - (void)dismissTabHistoryPopup { | 843 - (void)dismissTabHistoryPopup { |
| 838 if (!_tabHistoryPopupController) | 844 if (!_tabHistoryPopupController) |
| 839 return; | 845 return; |
| 840 TabHistoryPopupController* tempTHPC = _tabHistoryPopupController.get(); | 846 TabHistoryPopupController* tempTHPC = _tabHistoryPopupController.get(); |
| 841 [tempTHPC containerView].userInteractionEnabled = NO; | 847 [tempTHPC containerView].userInteractionEnabled = NO; |
| (...skipping 1724 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2566 | 2572 |
| 2567 - (BOOL)isPrerenderAnimationRunning { | 2573 - (BOOL)isPrerenderAnimationRunning { |
| 2568 return _prerenderAnimating; | 2574 return _prerenderAnimating; |
| 2569 } | 2575 } |
| 2570 | 2576 |
| 2571 - (OmniboxTextFieldIOS*)omnibox { | 2577 - (OmniboxTextFieldIOS*)omnibox { |
| 2572 return _omniBox.get(); | 2578 return _omniBox.get(); |
| 2573 } | 2579 } |
| 2574 | 2580 |
| 2575 @end | 2581 @end |
| OLD | NEW |