| 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. | 20 // TODO(jrg): this is a shell. Upstream the rest. |
| 21 // | |
| 22 // TODO(jrg): downstream, this class derives from | |
| 23 // base::SupportsWeakPtr<ContentViewCore>. Issues raised in | |
| 24 // http://codereview.chromium.org/10536066/ make us want to rethink | |
| 25 // ownership issues. | |
| 26 // FOR THE MERGE (downstream), re-add derivation from | |
| 27 // base::SupportsWeakPtr<ContentViewCore> to keep everything else working | |
| 28 // until this issue is resolved. | |
| 29 // http://b/6666045 | |
| 30 class ContentViewCore { | 21 class ContentViewCore { |
| 31 public: | 22 public: |
| 32 virtual void Destroy(JNIEnv* env, jobject obj) = 0; | 23 virtual void Destroy(JNIEnv* env, jobject obj) = 0; |
| 33 | 24 |
| 34 static ContentViewCore* Create(JNIEnv* env, jobject obj, | 25 static ContentViewCore* Create(JNIEnv* env, jobject obj, |
| 35 WebContents* web_contents); | 26 WebContents* web_contents); |
| 36 static ContentViewCore* GetNativeContentViewCore(JNIEnv* env, jobject obj); | 27 static ContentViewCore* GetNativeContentViewCore(JNIEnv* env, jobject obj); |
| 37 | 28 |
| 29 // Convenience methods for retrieving the ContentViewCore associated with a |
| 30 // WebContents. Can return NULL. |
| 31 static ContentViewCore* FromWebContents(content::WebContents* web_contents); |
| 32 |
| 33 virtual base::android::ScopedJavaLocalRef<jobject> GetJavaObject() = 0; |
| 34 |
| 35 // Offer handling of a JS dialog to the content view client. Returns false |
| 36 // if the client will handle the dialog, or true if we should use the |
| 37 // default handling - i.e. popping up a dialog box. |
| 38 virtual bool ShouldUseNativeJsModalDialog( |
| 39 content::JavaScriptMessageType type, |
| 40 bool is_before_unload_dialog, |
| 41 const string16& message, |
| 42 const string16& default_value, |
| 43 jobject js_result) = 0; |
| 38 protected: | 44 protected: |
| 39 virtual ~ContentViewCore() {}; | 45 virtual ~ContentViewCore() {}; |
| 40 }; | 46 }; |
| 41 | 47 |
| 42 }; // namespace content | 48 }; // namespace content |
| 43 | 49 |
| 44 #endif // CONTENT_PUBLIC_BROWSER_CONTENT_VIEW_CORE_H_ | 50 #endif // CONTENT_PUBLIC_BROWSER_CONTENT_VIEW_CORE_H_ |
| OLD | NEW |