| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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/ntp/google_landing_controller.h" | 5 #import "ios/chrome/browser/ui/ntp/google_landing_controller.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 | 8 |
| 9 #include "base/i18n/case_conversion.h" | 9 #include "base/i18n/case_conversion.h" |
| 10 #import "base/ios/weak_nsobject.h" | 10 #import "base/ios/weak_nsobject.h" |
| (...skipping 931 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 942 [_headerView updateSearchField:_searchTapTarget | 942 [_headerView updateSearchField:_searchTapTarget |
| 943 withInitialFrame:[self searchFieldFrame] | 943 withInitialFrame:[self searchFieldFrame] |
| 944 subviewConstraints:constraints | 944 subviewConstraints:constraints |
| 945 forOffset:[_mostVisitedView contentOffset].y]; | 945 forOffset:[_mostVisitedView contentOffset].y]; |
| 946 } | 946 } |
| 947 | 947 |
| 948 - (void)addOverscrollActions { | 948 - (void)addOverscrollActions { |
| 949 if (!IsIPadIdiom()) { | 949 if (!IsIPadIdiom()) { |
| 950 _overscrollActionsController.reset([[OverscrollActionsController alloc] | 950 _overscrollActionsController.reset([[OverscrollActionsController alloc] |
| 951 initWithScrollView:_mostVisitedView]); | 951 initWithScrollView:_mostVisitedView]); |
| 952 [_overscrollActionsController | 952 [_overscrollActionsController setStyle:OverscrollStyle::NTP_NON_INCOGNITO]; |
| 953 setStyle:ios_internal::OverscrollStyle::NTP_NON_INCOGNITO]; | |
| 954 [_overscrollActionsController setDelegate:self]; | 953 [_overscrollActionsController setDelegate:self]; |
| 955 } | 954 } |
| 956 } | 955 } |
| 957 | 956 |
| 958 // Check to see if the promo label should be hidden. | 957 // Check to see if the promo label should be hidden. |
| 959 - (void)hideWhatsNewIfNecessary { | 958 - (void)hideWhatsNewIfNecessary { |
| 960 if (![_promoHeaderView isHidden] && _notification_promo && | 959 if (![_promoHeaderView isHidden] && _notification_promo && |
| 961 !_notification_promo->CanShow()) { | 960 !_notification_promo->CanShow()) { |
| 962 [_promoHeaderView setHidden:YES]; | 961 [_promoHeaderView setHidden:YES]; |
| 963 _notification_promo.reset(); | 962 _notification_promo.reset(); |
| (...skipping 716 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1680 return _scrolledToTop; | 1679 return _scrolledToTop; |
| 1681 } | 1680 } |
| 1682 | 1681 |
| 1683 - (BOOL)animateHeader { | 1682 - (BOOL)animateHeader { |
| 1684 return _animateHeader; | 1683 return _animateHeader; |
| 1685 } | 1684 } |
| 1686 | 1685 |
| 1687 #pragma mark - OverscrollActionsControllerDelegate | 1686 #pragma mark - OverscrollActionsControllerDelegate |
| 1688 | 1687 |
| 1689 - (void)overscrollActionsController:(OverscrollActionsController*)controller | 1688 - (void)overscrollActionsController:(OverscrollActionsController*)controller |
| 1690 didTriggerAction:(ios_internal::OverscrollAction)action { | 1689 didTriggerAction:(OverscrollAction)action { |
| 1691 switch (action) { | 1690 switch (action) { |
| 1692 case ios_internal::OverscrollAction::NEW_TAB: { | 1691 case OverscrollAction::NEW_TAB: { |
| 1693 base::scoped_nsobject<GenericChromeCommand> command( | 1692 base::scoped_nsobject<GenericChromeCommand> command( |
| 1694 [[GenericChromeCommand alloc] initWithTag:IDC_NEW_TAB]); | 1693 [[GenericChromeCommand alloc] initWithTag:IDC_NEW_TAB]); |
| 1695 [[self view] chromeExecuteCommand:command]; | 1694 [[self view] chromeExecuteCommand:command]; |
| 1696 } break; | 1695 } break; |
| 1697 case ios_internal::OverscrollAction::CLOSE_TAB: { | 1696 case OverscrollAction::CLOSE_TAB: { |
| 1698 base::scoped_nsobject<GenericChromeCommand> command( | 1697 base::scoped_nsobject<GenericChromeCommand> command( |
| 1699 [[GenericChromeCommand alloc] initWithTag:IDC_CLOSE_TAB]); | 1698 [[GenericChromeCommand alloc] initWithTag:IDC_CLOSE_TAB]); |
| 1700 [[self view] chromeExecuteCommand:command]; | 1699 [[self view] chromeExecuteCommand:command]; |
| 1701 } break; | 1700 } break; |
| 1702 case ios_internal::OverscrollAction::REFRESH: | 1701 case OverscrollAction::REFRESH: |
| 1703 [self reload]; | 1702 [self reload]; |
| 1704 break; | 1703 break; |
| 1705 case ios_internal::OverscrollAction::NONE: | 1704 case OverscrollAction::NONE: |
| 1706 NOTREACHED(); | 1705 NOTREACHED(); |
| 1707 break; | 1706 break; |
| 1708 } | 1707 } |
| 1709 } | 1708 } |
| 1710 | 1709 |
| 1711 - (BOOL)shouldAllowOverscrollActions { | 1710 - (BOOL)shouldAllowOverscrollActions { |
| 1712 return YES; | 1711 return YES; |
| 1713 } | 1712 } |
| 1714 | 1713 |
| 1715 - (UIView*)toolbarSnapshotView { | 1714 - (UIView*)toolbarSnapshotView { |
| (...skipping 25 matching lines...) Expand all Loading... |
| 1741 if (!view) { | 1740 if (!view) { |
| 1742 return nil; | 1741 return nil; |
| 1743 } | 1742 } |
| 1744 if ([view isKindOfClass:aClass]) { | 1743 if ([view isKindOfClass:aClass]) { |
| 1745 return view; | 1744 return view; |
| 1746 } | 1745 } |
| 1747 return [self nearestAncestorOfView:[view superview] withClass:aClass]; | 1746 return [self nearestAncestorOfView:[view superview] withClass:aClass]; |
| 1748 } | 1747 } |
| 1749 | 1748 |
| 1750 @end | 1749 @end |
| OLD | NEW |