OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 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_PUBLIC_BROWSER_ANDROID_CONTENT_VIEW_CORE_H_ | 5 #ifndef CONTENT_PUBLIC_BROWSER_ANDROID_CONTENT_VIEW_CORE_H_ |
6 #define CONTENT_PUBLIC_BROWSER_ANDROID_CONTENT_VIEW_CORE_H_ | 6 #define CONTENT_PUBLIC_BROWSER_ANDROID_CONTENT_VIEW_CORE_H_ |
7 | 7 |
8 #include <jni.h> | 8 #include <jni.h> |
9 | 9 |
10 #include "base/android/scoped_java_ref.h" | 10 #include "base/android/scoped_java_ref.h" |
11 #include "base/callback.h" | 11 #include "base/callback.h" |
12 #include "content/common/content_export.h" | 12 #include "content/common/content_export.h" |
13 #include "content/public/browser/navigation_controller.h" | 13 #include "content/public/browser/navigation_controller.h" |
| 14 #include "content/public/common/input_event_ack_state.h" |
14 | 15 |
15 namespace cc { | 16 namespace cc { |
16 class Layer; | 17 class Layer; |
17 } | 18 } |
18 | 19 |
19 namespace gfx { | 20 namespace gfx { |
20 class Rect; | 21 class Rect; |
21 class Size; | 22 class Size; |
22 class SizeF; | 23 class SizeF; |
23 class Vector2dF; | 24 class Vector2dF; |
24 } | 25 } |
25 | 26 |
26 namespace ui { | 27 namespace ui { |
27 class ViewAndroid; | 28 class ViewAndroid; |
28 class WindowAndroid; | 29 class WindowAndroid; |
29 } | 30 } |
30 | 31 |
| 32 namespace WebKit { |
| 33 class WebInputEvent; |
| 34 } |
| 35 |
31 namespace content { | 36 namespace content { |
32 class WebContents; | 37 class WebContents; |
33 | 38 |
34 // Native side of the ContentViewCore.java, which is the primary way of | 39 // Native side of the ContentViewCore.java, which is the primary way of |
35 // communicating with the native Chromium code on Android. This is a | 40 // communicating with the native Chromium code on Android. This is a |
36 // public interface used by native code outside of the content module. | 41 // public interface used by native code outside of the content module. |
37 class CONTENT_EXPORT ContentViewCore { | 42 class CONTENT_EXPORT ContentViewCore { |
38 public: | 43 public: |
39 // Returns the existing ContentViewCore for |web_contents|, or NULL. | 44 // Returns the existing ContentViewCore for |web_contents|, or NULL. |
40 static ContentViewCore* FromWebContents(WebContents* web_contents); | 45 static ContentViewCore* FromWebContents(WebContents* web_contents); |
41 static ContentViewCore* GetNativeContentViewCore(JNIEnv* env, jobject obj); | 46 static ContentViewCore* GetNativeContentViewCore(JNIEnv* env, jobject obj); |
42 | 47 |
43 virtual WebContents* GetWebContents() const = 0; | 48 virtual WebContents* GetWebContents() const = 0; |
44 virtual base::android::ScopedJavaLocalRef<jobject> GetJavaObject() = 0; | 49 virtual base::android::ScopedJavaLocalRef<jobject> GetJavaObject() = 0; |
45 virtual ui::ViewAndroid* GetViewAndroid() const = 0; | 50 virtual ui::ViewAndroid* GetViewAndroid() const = 0; |
46 virtual ui::WindowAndroid* GetWindowAndroid() const = 0; | 51 virtual ui::WindowAndroid* GetWindowAndroid() const = 0; |
47 virtual scoped_refptr<cc::Layer> GetLayer() const = 0; | 52 virtual scoped_refptr<cc::Layer> GetLayer() const = 0; |
48 virtual void LoadUrl(NavigationController::LoadURLParams& params) = 0; | 53 virtual void LoadUrl(NavigationController::LoadURLParams& params) = 0; |
49 virtual jint GetCurrentRenderProcessId(JNIEnv* env, jobject obj) = 0; | 54 virtual jint GetCurrentRenderProcessId(JNIEnv* env, jobject obj) = 0; |
50 virtual void ShowPastePopup(int x, int y) = 0; | 55 virtual void ShowPastePopup(int x, int y) = 0; |
51 virtual unsigned int GetScaledContentTexture( | 56 virtual unsigned int GetScaledContentTexture( |
52 float scale, | 57 float scale, |
53 gfx::Size* out_size) = 0; | 58 gfx::Size* out_size) = 0; |
54 virtual float GetDpiScale() const = 0; | 59 virtual float GetDpiScale() const = 0; |
55 virtual void RequestContentClipping(const gfx::Rect& clipping, | 60 virtual void RequestContentClipping(const gfx::Rect& clipping, |
56 const gfx::Size& content_size) = 0; | 61 const gfx::Size& content_size) = 0; |
57 | 62 |
| 63 typedef base::Callback<InputEventAckState( |
| 64 int routing_id, |
| 65 const WebKit::WebInputEvent& input_event)> InputEventFilterCallback; |
| 66 virtual void SetInputEventFilterCallback( |
| 67 const InputEventFilterCallback& callback) = 0; |
| 68 |
58 // Observer callback for frame metadata updates. | 69 // Observer callback for frame metadata updates. |
59 typedef base::Callback<void( | 70 typedef base::Callback<void( |
60 const gfx::SizeF& content_size, | 71 const gfx::SizeF& content_size, |
61 const gfx::Vector2dF& scroll_offset, | 72 const gfx::Vector2dF& scroll_offset, |
62 float page_scale_factor)> UpdateFrameInfoCallback; | 73 float page_scale_factor)> UpdateFrameInfoCallback; |
63 | 74 |
64 virtual void AddFrameInfoCallback( | 75 virtual void AddFrameInfoCallback( |
65 const UpdateFrameInfoCallback& callback) = 0; | 76 const UpdateFrameInfoCallback& callback) = 0; |
66 virtual void RemoveFrameInfoCallback( | 77 virtual void RemoveFrameInfoCallback( |
67 const UpdateFrameInfoCallback& callback) = 0; | 78 const UpdateFrameInfoCallback& callback) = 0; |
68 | 79 |
69 protected: | 80 protected: |
70 virtual ~ContentViewCore() {}; | 81 virtual ~ContentViewCore() {}; |
71 }; | 82 }; |
72 | 83 |
73 }; // namespace content | 84 }; // namespace content |
74 | 85 |
75 #endif // CONTENT_PUBLIC_BROWSER_ANDROID_CONTENT_VIEW_CORE_H_ | 86 #endif // CONTENT_PUBLIC_BROWSER_ANDROID_CONTENT_VIEW_CORE_H_ |
OLD | NEW |