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