Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(979)

Side by Side Diff: ios/chrome/browser/ui/overscroll_actions/overscroll_actions_controller.mm

Issue 2817483002: [Workaround] Notify Overscroll Actions that a gesture ended. (Closed)
Patch Set: Add back removeTarget, use weak protocol Created 3 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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/overscroll_actions/overscroll_actions_controller. h" 5 #import "ios/chrome/browser/ui/overscroll_actions/overscroll_actions_controller. h"
6 6
7 #import <QuartzCore/QuartzCore.h> 7 #import <QuartzCore/QuartzCore.h>
8 8
9 #include <algorithm> 9 #include <algorithm>
10 #include "base/logging.h" 10 #include "base/logging.h"
11 #include "base/mac/objc_property_releaser.h" 11 #include "base/mac/objc_property_releaser.h"
12 #include "base/mac/scoped_nsobject.h" 12 #include "base/mac/scoped_nsobject.h"
13 #include "base/metrics/histogram_macros.h" 13 #include "base/metrics/histogram_macros.h"
14 #import "ios/chrome/browser/ui/browser_view_controller.h" 14 #import "ios/chrome/browser/ui/browser_view_controller.h"
15 #import "ios/chrome/browser/ui/overscroll_actions/overscroll_actions_gesture_rec ognizer.h"
15 #import "ios/chrome/browser/ui/overscroll_actions/overscroll_actions_view.h" 16 #import "ios/chrome/browser/ui/overscroll_actions/overscroll_actions_view.h"
16 #include "ios/chrome/browser/ui/rtl_geometry.h" 17 #include "ios/chrome/browser/ui/rtl_geometry.h"
17 #import "ios/chrome/browser/ui/toolbar/toolbar_controller.h" 18 #import "ios/chrome/browser/ui/toolbar/toolbar_controller.h"
18 #import "ios/chrome/browser/ui/toolbar/web_toolbar_controller.h" 19 #import "ios/chrome/browser/ui/toolbar/web_toolbar_controller.h"
19 #include "ios/chrome/browser/ui/uikit_ui_util.h" 20 #include "ios/chrome/browser/ui/uikit_ui_util.h"
20 #import "ios/chrome/browser/ui/voice/voice_search_notification_names.h" 21 #import "ios/chrome/browser/ui/voice/voice_search_notification_names.h"
21 #import "ios/web/public/web_state/ui/crw_web_view_proxy.h" 22 #import "ios/web/public/web_state/ui/crw_web_view_proxy.h"
22 23
23 namespace { 24 namespace {
24 // This enum is used to record the overscroll actions performed by the user on 25 // This enum is used to record the overscroll actions performed by the user on
(...skipping 542 matching lines...) Expand 10 before | Expand all | Expand 10 after
567 name:UIDeviceOrientationDidChangeNotification 568 name:UIDeviceOrientationDidChangeNotification
568 object:nil]; 569 object:nil];
569 } 570 }
570 571
571 - (void)tearDown { 572 - (void)tearDown {
572 [[self scrollView] removeGestureRecognizer:self.panGestureRecognizer]; 573 [[self scrollView] removeGestureRecognizer:self.panGestureRecognizer];
573 self.panGestureRecognizer = nil; 574 self.panGestureRecognizer = nil;
574 } 575 }
575 576
576 - (void)setup { 577 - (void)setup {
577 base::scoped_nsobject<UIPanGestureRecognizer> panGesture( 578 base::scoped_nsobject<UIPanGestureRecognizer> panGesture;
578 [[UIPanGestureRecognizer alloc] initWithTarget:self 579 // Workaround a bug occuring when Speak Selection is enabled.
579 action:@selector(panGesture:)]); 580 // See crbug.com/699655.
581 if (UIAccessibilityIsSpeakSelectionEnabled()) {
582 panGesture.reset([[OverscrollActionsGestureRecognizer alloc]
583 initWithTarget:self
584 action:@selector(panGesture:)]);
585 } else {
586 panGesture.reset([[UIPanGestureRecognizer alloc]
587 initWithTarget:self
588 action:@selector(panGesture:)]);
589 }
580 [panGesture setMaximumNumberOfTouches:1]; 590 [panGesture setMaximumNumberOfTouches:1];
581 [panGesture setDelegate:self]; 591 [panGesture setDelegate:self];
582 [[self scrollView] addGestureRecognizer:panGesture]; 592 [[self scrollView] addGestureRecognizer:panGesture];
583 self.panGestureRecognizer = panGesture.get(); 593 self.panGestureRecognizer = panGesture.get();
584 } 594 }
585 595
586 - (id<OverscrollActionsScrollView>)scrollView { 596 - (id<OverscrollActionsScrollView>)scrollView {
587 if (_scrollview) { 597 if (_scrollview) {
588 return static_cast<id<OverscrollActionsScrollView>>(_scrollview.get()); 598 return static_cast<id<OverscrollActionsScrollView>>(_scrollview.get());
589 } else { 599 } else {
(...skipping 311 matching lines...) Expand 10 before | Expand all | Expand 10 after
901 overscrollActionsController:self 911 overscrollActionsController:self
902 didTriggerAction:self.overscrollActionView.selectedAction]; 912 didTriggerAction:self.overscrollActionView.selectedAction];
903 } 913 }
904 914
905 - (void)overscrollActionsView:(OverscrollActionsView*)view 915 - (void)overscrollActionsView:(OverscrollActionsView*)view
906 selectedActionDidChange:(OverscrollAction)newAction { 916 selectedActionDidChange:(OverscrollAction)newAction {
907 TriggerHapticFeedbackForSelectionChange(); 917 TriggerHapticFeedbackForSelectionChange();
908 } 918 }
909 919
910 @end 920 @end
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698