Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | |
| 2 // Use of this source code is governed by a BSD-style license that can be | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #ifndef CONTENT_BROWSER_RENDERER_HOST_INPUT_GESTURES_ZOOM_MANAGER_H_ | |
| 6 #define CONTENT_BROWSER_RENDERER_HOST_INPUT_GESTURES_ZOOM_MANAGER_H_ | |
| 7 | |
| 8 #include "base/memory/scoped_ptr.h" | |
| 9 #include "content/browser/renderer_host/input/gestures/scale_gesture_detector.h" | |
| 10 | |
| 11 namespace content { | |
| 12 | |
| 13 // Port of ZoomManager.java from Chromium | |
| 14 // * Changes to this class should be cosmetic only, easing fork maintenance. | |
|
tdresser
2014/01/08 19:18:21
Will we still need the java version of ZoomManager
| |
| 15 // Responsible for maintaining zoom state and processing scale-related gestures. | |
| 16 class ZoomManager : public ScaleGestureDetector::OnScaleGestureListener { | |
| 17 public: | |
| 18 ZoomManager(ScaleGestureDetector::Config config, | |
| 19 ScaleGestureDetector::OnScaleGestureListener* listener); | |
| 20 virtual ~ZoomManager(); | |
| 21 | |
| 22 // Passes the touch event to ScaleGestureDetector so that its internal | |
| 23 // state won't go wrong, but instructs the listener to ignore the result | |
| 24 // of processing, if any. | |
| 25 void PassTouchEventThrough(const MotionEvent& event); | |
| 26 | |
| 27 // Passes the touch event to ScaleGestureDetector so that its internal state | |
| 28 // won't go wrong. ScaleGestureDetector needs two pointers in a MotionEvent | |
| 29 // to recognize a zoom gesture. | |
| 30 bool ProcessTouchEvent(const MotionEvent& event); | |
| 31 | |
| 32 void UpdateMultiTouchSupport(bool supports_multi_touch_zoom); | |
| 33 | |
| 34 bool IsScaleGestureDetectionInProgress() const; | |
| 35 | |
| 36 private: | |
| 37 // OnScaleGestureListener | |
| 38 virtual bool OnScaleBegin(const ScaleGestureDetector& detector) OVERRIDE; | |
| 39 virtual void OnScaleEnd(const ScaleGestureDetector& detector) OVERRIDE; | |
| 40 virtual bool OnScale(const ScaleGestureDetector& detector) OVERRIDE; | |
| 41 | |
| 42 bool IgnoreDetectorEvents() const; | |
| 43 | |
| 44 scoped_ptr<ScaleGestureDetector> multi_touch_detector_; | |
| 45 | |
| 46 ScaleGestureDetector::OnScaleGestureListener* const listener_; | |
| 47 | |
| 48 // Completely silence scaling events. Used in WebView when zoom support | |
| 49 // is turned off. | |
| 50 bool permanently_ignore_detector_events_; | |
| 51 | |
| 52 // Bypass events through the detector to maintain its state. Used when | |
| 53 // renderes already handles the touch event. | |
| 54 bool temporarily_ignore_detector_events_; | |
| 55 | |
| 56 // Whether any pinch zoom event has been sent to native. | |
| 57 bool pinch_event_sent_; | |
| 58 | |
| 59 DISALLOW_COPY_AND_ASSIGN(ZoomManager); | |
| 60 }; | |
| 61 | |
| 62 } // namespace content | |
| 63 | |
| 64 #endif // CONTENT_BROWSER_RENDERER_HOST_INPUT_GESTURES_ZOOM_MANAGER_H_ | |
| OLD | NEW |