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

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

Issue 2787723003: [Workaround] Notify Overscroll Actions that a gesture ended. (Closed)
Patch Set: v3 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 543 matching lines...) Expand 10 before | Expand all | Expand 10 after
568 name:UIDeviceOrientationDidChangeNotification 569 name:UIDeviceOrientationDidChangeNotification
569 object:nil]; 570 object:nil];
570 } 571 }
571 572
572 - (void)tearDown { 573 - (void)tearDown {
573 [[self scrollView] removeGestureRecognizer:self.panGestureRecognizer]; 574 [[self scrollView] removeGestureRecognizer:self.panGestureRecognizer];
574 self.panGestureRecognizer = nil; 575 self.panGestureRecognizer = nil;
575 } 576 }
576 577
577 - (void)setup { 578 - (void)setup {
578 base::scoped_nsobject<UIPanGestureRecognizer> panGesture( 579 base::scoped_nsobject<UIPanGestureRecognizer> panGesture;
579 [[UIPanGestureRecognizer alloc] initWithTarget:self 580 // Workaround a bug occuring when Speak Selection is enabled.
580 action:@selector(panGesture:)]); 581 // See crbug.com/699655.
582 if (UIAccessibilityIsSpeakSelectionEnabled()) {
justincohen 2017/04/05 14:22:07 Does -setup only get called once per process start
583 panGesture.reset([[OverscrollActionsGestureRecognizer alloc]
584 initWithTarget:self
585 action:@selector(panGesture:)]);
586 } else {
587 panGesture.reset([[UIPanGestureRecognizer alloc]
588 initWithTarget:self
589 action:@selector(panGesture:)]);
590 }
581 [panGesture setMaximumNumberOfTouches:1]; 591 [panGesture setMaximumNumberOfTouches:1];
582 [panGesture setDelegate:self]; 592 [panGesture setDelegate:self];
583 [[self scrollView] addGestureRecognizer:panGesture]; 593 [[self scrollView] addGestureRecognizer:panGesture];
584 self.panGestureRecognizer = panGesture.get(); 594 self.panGestureRecognizer = panGesture.get();
585 } 595 }
586 596
587 - (id<OverscrollActionsScrollView>)scrollView { 597 - (id<OverscrollActionsScrollView>)scrollView {
588 if (_scrollview) { 598 if (_scrollview) {
589 return static_cast<id<OverscrollActionsScrollView>>(_scrollview.get()); 599 return static_cast<id<OverscrollActionsScrollView>>(_scrollview.get());
590 } else { 600 } else {
(...skipping 311 matching lines...) Expand 10 before | Expand all | Expand 10 after
902 overscrollActionsController:self 912 overscrollActionsController:self
903 didTriggerAction:self.overscrollActionView.selectedAction]; 913 didTriggerAction:self.overscrollActionView.selectedAction];
904 } 914 }
905 915
906 - (void)overscrollActionsView:(OverscrollActionsView*)view 916 - (void)overscrollActionsView:(OverscrollActionsView*)view
907 selectedActionDidChange:(OverscrollAction)newAction { 917 selectedActionDidChange:(OverscrollAction)newAction {
908 TriggerHapticFeedbackForSelectionChange(); 918 TriggerHapticFeedbackForSelectionChange();
909 } 919 }
910 920
911 @end 921 @end
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698