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 "base/android/scoped_java_ref.h" | 8 #include "base/android/scoped_java_ref.h" |
9 #include <jni.h> | 9 #include <jni.h> |
10 | 10 |
11 class GURL; | |
12 | |
13 namespace ui { | 11 namespace ui { |
14 class WindowAndroid; | 12 class WindowAndroid; |
15 } | 13 } |
16 | 14 |
17 namespace content { | 15 namespace content { |
18 | |
19 class WebContents; | 16 class WebContents; |
20 | 17 |
21 // Native side of the ContentViewCore.java, which is the primary way of | 18 // Native side of the ContentViewCore.java, which is the primary way of |
22 // communicating with the native Chromium code on Android. This is a | 19 // communicating with the native Chromium code on Android. This is a |
23 // public interface used by native code outside of the content module. | 20 // public interface used by native code outside of the content module. |
24 // | 21 // |
25 // TODO(jrg): this is a shell. Upstream the rest. | |
26 // | |
27 // TODO(jrg): downstream, this class derives from | 22 // TODO(jrg): downstream, this class derives from |
28 // base::SupportsWeakPtr<ContentViewCore>. Issues raised in | 23 // base::SupportsWeakPtr<ContentViewCore>. Issues raised in |
29 // http://codereview.chromium.org/10536066/ make us want to rethink | 24 // http://codereview.chromium.org/10536066/ make us want to rethink |
30 // ownership issues. | 25 // ownership issues. |
31 // FOR THE MERGE (downstream), re-add derivation from | 26 // FOR THE MERGE (downstream), re-add derivation from |
32 // base::SupportsWeakPtr<ContentViewCore> to keep everything else working | 27 // base::SupportsWeakPtr<ContentViewCore> to keep everything else working |
33 // until this issue is resolved. | 28 // until this issue is resolved. |
34 // http://b/6666045 | 29 // http://b/6666045 |
35 class ContentViewCore { | 30 class ContentViewCore { |
36 public: | 31 public: |
37 virtual void Destroy(JNIEnv* env, jobject obj) = 0; | 32 virtual void Destroy(JNIEnv* env, jobject obj) = 0; |
33 virtual content::WebContents* GetWebContents() const = 0; | |
34 virtual base::android::ScopedJavaLocalRef<jobject> GetJavaObject() = 0; | |
35 virtual ui::WindowAndroid* GetWindowAndroid() = 0; | |
38 | 36 |
39 static ContentViewCore* Create(JNIEnv* env, jobject obj, | 37 static ContentViewCore* Create( |
40 WebContents* web_contents); | 38 JNIEnv* env, jobject obj, WebContents* web_contents); |
41 static ContentViewCore* GetNativeContentViewCore(JNIEnv* env, jobject obj); | 39 static ContentViewCore* GetNativeContentViewCore(JNIEnv* env, jobject obj); |
42 | 40 |
43 // -------------------------------------------------------------------------- | |
44 // Methods called from Java via JNI | |
45 // -------------------------------------------------------------------------- | |
joth
2012/09/24 23:16:27
awesome, thanks for cleaning this up!
| |
46 | |
47 virtual int GetNativeImeAdapter(JNIEnv* env, jobject obj) = 0; | |
48 virtual void SelectBetweenCoordinates(JNIEnv* env, jobject obj, | |
49 jint x1, jint y1, jint x2, jint y2) = 0; | |
50 | |
51 // -------------------------------------------------------------------------- | |
52 // Methods called from native code | |
53 // -------------------------------------------------------------------------- | |
54 | |
55 virtual base::android::ScopedJavaLocalRef<jobject> GetJavaObject() = 0; | |
56 | |
57 virtual ui::WindowAndroid* GetWindowAndroid() = 0; | |
58 protected: | 41 protected: |
59 virtual ~ContentViewCore() {}; | 42 virtual ~ContentViewCore() {}; |
60 }; | 43 }; |
61 | 44 |
62 }; // namespace content | 45 }; // namespace content |
63 | 46 |
64 #endif // CONTENT_PUBLIC_BROWSER_CONTENT_VIEW_CORE_H_ | 47 #endif // CONTENT_PUBLIC_BROWSER_ANDROID_CONTENT_VIEW_CORE_H_ |
OLD | NEW |