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_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_helper.h" | 10 #include "base/android/jni_helper.h" |
(...skipping 17 matching lines...) Expand all Loading... |
28 class WindowAndroid; | 28 class WindowAndroid; |
29 } | 29 } |
30 | 30 |
31 namespace content { | 31 namespace content { |
32 class RenderWidgetHostViewAndroid; | 32 class RenderWidgetHostViewAndroid; |
33 | 33 |
34 // TODO(jrg): this is a shell. Upstream the rest. | 34 // TODO(jrg): this is a shell. Upstream the rest. |
35 class ContentViewCoreImpl : public ContentViewCore, | 35 class ContentViewCoreImpl : public ContentViewCore, |
36 public NotificationObserver { | 36 public NotificationObserver { |
37 public: | 37 public: |
| 38 static ContentViewCoreImpl* FromWebContents(WebContents* web_contents); |
38 ContentViewCoreImpl(JNIEnv* env, | 39 ContentViewCoreImpl(JNIEnv* env, |
39 jobject obj, | 40 jobject obj, |
40 bool hardware_accelerated, | 41 bool hardware_accelerated, |
41 WebContents* web_contents, | 42 WebContents* web_contents, |
42 ui::WindowAndroid* window_android); | 43 ui::WindowAndroid* window_android); |
43 | 44 |
44 // ContentViewCore implementation. | 45 // ContentViewCore implementation. |
45 virtual void Destroy(JNIEnv* env, jobject obj) OVERRIDE; | |
46 virtual base::android::ScopedJavaLocalRef<jobject> GetJavaObject() OVERRIDE; | 46 virtual base::android::ScopedJavaLocalRef<jobject> GetJavaObject() OVERRIDE; |
47 virtual WebContents* GetWebContents() const OVERRIDE; | 47 virtual WebContents* GetWebContents() const OVERRIDE; |
48 virtual ui::WindowAndroid* GetWindowAndroid() OVERRIDE; | 48 virtual ui::WindowAndroid* GetWindowAndroid() OVERRIDE; |
49 virtual void LoadUrl(NavigationController::LoadURLParams& params) OVERRIDE; | 49 virtual void LoadUrl(NavigationController::LoadURLParams& params) OVERRIDE; |
50 virtual void OnWebPreferencesUpdated() OVERRIDE; | 50 virtual void OnWebPreferencesUpdated() OVERRIDE; |
51 virtual jint GetCurrentRenderProcessId(JNIEnv* env, jobject obj) OVERRIDE; | 51 virtual jint GetCurrentRenderProcessId(JNIEnv* env, jobject obj) OVERRIDE; |
52 | 52 |
53 // -------------------------------------------------------------------------- | 53 // -------------------------------------------------------------------------- |
54 // Methods called from Java via JNI | 54 // Methods called from Java via JNI |
55 // -------------------------------------------------------------------------- | 55 // -------------------------------------------------------------------------- |
56 | 56 |
| 57 void OnJavaContentViewCoreDestroyed(JNIEnv* env, jobject obj); |
| 58 |
57 // Notifies the ContentViewCore that items were selected in the currently | 59 // Notifies the ContentViewCore that items were selected in the currently |
58 // showing select popup. | 60 // showing select popup. |
59 void SelectPopupMenuItems(JNIEnv* env, jobject obj, jintArray indices); | 61 void SelectPopupMenuItems(JNIEnv* env, jobject obj, jintArray indices); |
60 | 62 |
61 void LoadUrl( | 63 void LoadUrl( |
62 JNIEnv* env, jobject obj, | 64 JNIEnv* env, jobject obj, |
63 jstring url, | 65 jstring url, |
64 jint load_url_type, | 66 jint load_url_type, |
65 jint transition_type, | 67 jint transition_type, |
66 jint ua_override_option, | 68 jint ua_override_option, |
(...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
203 | 205 |
204 void StartContentIntent(const GURL& content_url); | 206 void StartContentIntent(const GURL& content_url); |
205 | 207 |
206 // -------------------------------------------------------------------------- | 208 // -------------------------------------------------------------------------- |
207 // Methods called from native code | 209 // Methods called from native code |
208 // -------------------------------------------------------------------------- | 210 // -------------------------------------------------------------------------- |
209 | 211 |
210 gfx::Rect GetBounds() const; | 212 gfx::Rect GetBounds() const; |
211 | 213 |
212 private: | 214 private: |
| 215 class ContentViewUserData; |
| 216 friend class ContentViewUserData; |
| 217 virtual ~ContentViewCoreImpl(); |
| 218 |
213 // NotificationObserver implementation. | 219 // NotificationObserver implementation. |
214 virtual void Observe(int type, | 220 virtual void Observe(int type, |
215 const NotificationSource& source, | 221 const NotificationSource& source, |
216 const NotificationDetails& details) OVERRIDE; | 222 const NotificationDetails& details) OVERRIDE; |
217 | 223 |
218 // -------------------------------------------------------------------------- | 224 // -------------------------------------------------------------------------- |
219 // Private methods that call to Java via JNI | |
220 // -------------------------------------------------------------------------- | |
221 virtual ~ContentViewCoreImpl(); | |
222 | |
223 // -------------------------------------------------------------------------- | |
224 // Other private methods and data | 225 // Other private methods and data |
225 // -------------------------------------------------------------------------- | 226 // -------------------------------------------------------------------------- |
226 | 227 |
227 void InitJNI(JNIEnv* env, jobject obj); | 228 void InitJNI(JNIEnv* env, jobject obj); |
228 | 229 |
229 void InitWebContents(content::WebContents* web_contents); | 230 void InitWebContents(); |
230 | 231 |
231 RenderWidgetHostViewAndroid* GetRenderWidgetHostViewAndroid(); | 232 RenderWidgetHostViewAndroid* GetRenderWidgetHostViewAndroid(); |
232 | 233 |
233 int GetTouchPadding(); | 234 int GetTouchPadding(); |
234 | 235 |
235 float DpiScale() const; | 236 float DpiScale() const; |
236 WebKit::WebGestureEvent MakeGestureEvent(WebKit::WebInputEvent::Type type, | 237 WebKit::WebGestureEvent MakeGestureEvent(WebKit::WebInputEvent::Type type, |
237 long time_ms, int x, int y) const; | 238 long time_ms, int x, int y) const; |
238 struct JavaObject; | 239 struct JavaObject; |
239 JavaObject* java_object_; | 240 JavaObject* java_object_; |
(...skipping 16 matching lines...) Expand all Loading... |
256 ui::WindowAndroid* window_android_; | 257 ui::WindowAndroid* window_android_; |
257 | 258 |
258 DISALLOW_COPY_AND_ASSIGN(ContentViewCoreImpl); | 259 DISALLOW_COPY_AND_ASSIGN(ContentViewCoreImpl); |
259 }; | 260 }; |
260 | 261 |
261 bool RegisterContentViewCore(JNIEnv* env); | 262 bool RegisterContentViewCore(JNIEnv* env); |
262 | 263 |
263 } // namespace content | 264 } // namespace content |
264 | 265 |
265 #endif // CONTENT_BROWSER_ANDROID_CONTENT_VIEW_CORE_IMPL_H_ | 266 #endif // CONTENT_BROWSER_ANDROID_CONTENT_VIEW_CORE_IMPL_H_ |
OLD | NEW |