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

Side by Side Diff: content/browser/android/content_view_core_impl.h

Issue 182383007: Make the ContentGestureProvider a ui::FilteredGestureProvider (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Test fix Created 6 years, 9 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 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 #ifndef CONTENT_BROWSER_ANDROID_CONTENT_VIEW_CORE_IMPL_H_ 5 #ifndef CONTENT_BROWSER_ANDROID_CONTENT_VIEW_CORE_IMPL_H_
6 #define CONTENT_BROWSER_ANDROID_CONTENT_VIEW_CORE_IMPL_H_ 6 #define CONTENT_BROWSER_ANDROID_CONTENT_VIEW_CORE_IMPL_H_
7 7
8 #include <vector> 8 #include <vector>
9 9
10 #include "base/android/jni_android.h" 10 #include "base/android/jni_android.h"
11 #include "base/android/jni_helper.h" 11 #include "base/android/jni_helper.h"
12 #include "base/basictypes.h" 12 #include "base/basictypes.h"
13 #include "base/compiler_specific.h" 13 #include "base/compiler_specific.h"
14 #include "base/i18n/rtl.h" 14 #include "base/i18n/rtl.h"
15 #include "base/memory/scoped_ptr.h" 15 #include "base/memory/scoped_ptr.h"
16 #include "base/process/process.h" 16 #include "base/process/process.h"
17 #include "content/browser/renderer_host/input/content_gesture_provider.h"
18 #include "content/browser/renderer_host/render_widget_host_view_android.h" 17 #include "content/browser/renderer_host/render_widget_host_view_android.h"
19 #include "content/browser/web_contents/web_contents_impl.h" 18 #include "content/browser/web_contents/web_contents_impl.h"
20 #include "content/public/browser/android/content_view_core.h" 19 #include "content/public/browser/android/content_view_core.h"
21 #include "content/public/browser/notification_observer.h" 20 #include "content/public/browser/notification_observer.h"
22 #include "content/public/browser/notification_registrar.h" 21 #include "content/public/browser/notification_registrar.h"
23 #include "content/public/browser/web_contents_observer.h" 22 #include "content/public/browser/web_contents_observer.h"
24 #include "third_party/WebKit/public/web/WebInputEvent.h" 23 #include "third_party/WebKit/public/web/WebInputEvent.h"
24 #include "ui/events/gesture_detection/filtered_gesture_provider.h"
25 #include "ui/gfx/rect.h" 25 #include "ui/gfx/rect.h"
26 #include "ui/gfx/rect_f.h" 26 #include "ui/gfx/rect_f.h"
27 #include "url/gurl.h" 27 #include "url/gurl.h"
28 28
29 namespace ui { 29 namespace ui {
30 class ViewAndroid; 30 class ViewAndroid;
31 class WindowAndroid; 31 class WindowAndroid;
32 } 32 }
33 33
34 namespace content { 34 namespace content {
35 class RenderWidgetHostViewAndroid; 35 class RenderWidgetHostViewAndroid;
36 struct MenuItem; 36 struct MenuItem;
37 37
38 // TODO(jrg): this is a shell. Upstream the rest. 38 // TODO(jrg): this is a shell. Upstream the rest.
39 class ContentViewCoreImpl : public ContentViewCore, 39 class ContentViewCoreImpl : public ContentViewCore,
40 public ContentGestureProviderClient, 40 public ui::GestureProviderClient,
41 public NotificationObserver, 41 public NotificationObserver,
42 public WebContentsObserver { 42 public WebContentsObserver {
43 public: 43 public:
44 static ContentViewCoreImpl* FromWebContents(WebContents* web_contents); 44 static ContentViewCoreImpl* FromWebContents(WebContents* web_contents);
45 ContentViewCoreImpl(JNIEnv* env, 45 ContentViewCoreImpl(JNIEnv* env,
46 jobject obj, 46 jobject obj,
47 WebContents* web_contents, 47 WebContents* web_contents,
48 ui::ViewAndroid* view_android, 48 ui::ViewAndroid* view_android,
49 ui::WindowAndroid* window_android); 49 ui::WindowAndroid* window_android);
50 50
(...skipping 258 matching lines...) Expand 10 before | Expand all | Expand 10 after
309 309
310 // NotificationObserver implementation. 310 // NotificationObserver implementation.
311 virtual void Observe(int type, 311 virtual void Observe(int type,
312 const NotificationSource& source, 312 const NotificationSource& source,
313 const NotificationDetails& details) OVERRIDE; 313 const NotificationDetails& details) OVERRIDE;
314 314
315 // WebContentsObserver implementation. 315 // WebContentsObserver implementation.
316 virtual void RenderViewReady() OVERRIDE; 316 virtual void RenderViewReady() OVERRIDE;
317 virtual void WebContentsDestroyed(WebContents* web_contents) OVERRIDE; 317 virtual void WebContentsDestroyed(WebContents* web_contents) OVERRIDE;
318 318
319 // ContentGestureProviderClient implementation. 319 // ui::GestureProviderClient implementation.
320 virtual void OnGestureEvent(const blink::WebGestureEvent& event) OVERRIDE; 320 virtual void OnGestureEvent(const ui::GestureEventData& gesture) OVERRIDE;
321 321
322 // -------------------------------------------------------------------------- 322 // --------------------------------------------------------------------------
323 // Other private methods and data 323 // Other private methods and data
324 // -------------------------------------------------------------------------- 324 // --------------------------------------------------------------------------
325 325
326 void InitWebContents(); 326 void InitWebContents();
327 327
328 RenderWidgetHostViewAndroid* GetRenderWidgetHostViewAndroid(); 328 RenderWidgetHostViewAndroid* GetRenderWidgetHostViewAndroid();
329 329
330 blink::WebGestureEvent MakeGestureEvent( 330 blink::WebGestureEvent MakeGestureEvent(
331 blink::WebInputEvent::Type type, int64 time_ms, float x, float y) const; 331 blink::WebInputEvent::Type type, int64 time_ms, float x, float y) const;
332 332
333 void SendBeginFrame(base::TimeTicks frame_time); 333 void SendBeginFrame(base::TimeTicks frame_time);
334 334
335 gfx::Size GetViewportSizePix() const; 335 gfx::Size GetViewportSizePix() const;
336 gfx::Size GetViewportSizeOffsetPix() const; 336 gfx::Size GetViewportSizeOffsetPix() const;
337 337
338 void DeleteScaledSnapshotTexture(); 338 void DeleteScaledSnapshotTexture();
339 339
340 void SendGestureEvent(const blink::WebGestureEvent& event); 340 void SendGestureEvent(const blink::WebGestureEvent& event);
341 341
342 // Update focus state of the RenderWidgetHostView. 342 // Update focus state of the RenderWidgetHostView.
343 void SetFocusInternal(bool focused); 343 void SetFocusInternal(bool focused);
344 344
345 // Send device_orientation_ to renderer. 345 // Send device_orientation_ to renderer.
346 void SendOrientationChangeEventInternal(); 346 void SendOrientationChangeEventInternal();
347 347
348 float dpi_scale() const { return dpi_scale_; }
349
348 // A weak reference to the Java ContentViewCore object. 350 // A weak reference to the Java ContentViewCore object.
349 JavaObjectWeakGlobalRef java_ref_; 351 JavaObjectWeakGlobalRef java_ref_;
350 352
351 NotificationRegistrar notification_registrar_; 353 NotificationRegistrar notification_registrar_;
352 354
353 // Reference to the current WebContents used to determine how and what to 355 // Reference to the current WebContents used to determine how and what to
354 // display in the ContentViewCore. 356 // display in the ContentViewCore.
355 WebContentsImpl* web_contents_; 357 WebContentsImpl* web_contents_;
356 358
357 // A compositor layer containing any layer that should be shown. 359 // A compositor layer containing any layer that should be shown.
358 scoped_refptr<cc::Layer> root_layer_; 360 scoped_refptr<cc::Layer> root_layer_;
359 361
360 // Device scale factor. 362 // Device scale factor.
361 float dpi_scale_; 363 float dpi_scale_;
362 364
363 // Variables used to keep track of frame timestamps and deadlines. 365 // Variables used to keep track of frame timestamps and deadlines.
364 base::TimeDelta vsync_interval_; 366 base::TimeDelta vsync_interval_;
365 base::TimeDelta expected_browser_composite_time_; 367 base::TimeDelta expected_browser_composite_time_;
366 368
367 // The Android view that can be used to add and remove decoration layers 369 // The Android view that can be used to add and remove decoration layers
368 // like AutofillPopup. 370 // like AutofillPopup.
369 ui::ViewAndroid* view_android_; 371 ui::ViewAndroid* view_android_;
370 372
371 // The owning window that has a hold of main application activity. 373 // The owning window that has a hold of main application activity.
372 ui::WindowAndroid* window_android_; 374 ui::WindowAndroid* window_android_;
373 375
374 // Provides gesture synthesis given a stream of touch events (derived from 376 // Provides gesture synthesis given a stream of touch events (derived from
375 // Android MotionEvent's) and touch event acks. 377 // Android MotionEvent's) and touch event acks.
376 ContentGestureProvider gesture_provider_; 378 ui::FilteredGestureProvider gesture_provider_;
377 379
378 // The cache of device's current orientation set from Java side, this value 380 // The cache of device's current orientation set from Java side, this value
379 // will be sent to Renderer once it is ready. 381 // will be sent to Renderer once it is ready.
380 int device_orientation_; 382 int device_orientation_;
381 383
382 bool geolocation_needs_pause_; 384 bool geolocation_needs_pause_;
383 385
384 DISALLOW_COPY_AND_ASSIGN(ContentViewCoreImpl); 386 DISALLOW_COPY_AND_ASSIGN(ContentViewCoreImpl);
385 }; 387 };
386 388
387 bool RegisterContentViewCore(JNIEnv* env); 389 bool RegisterContentViewCore(JNIEnv* env);
388 390
389 } // namespace content 391 } // namespace content
390 392
391 #endif // CONTENT_BROWSER_ANDROID_CONTENT_VIEW_CORE_IMPL_H_ 393 #endif // CONTENT_BROWSER_ANDROID_CONTENT_VIEW_CORE_IMPL_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698