| 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" |
| 11 #include "base/basictypes.h" | 11 #include "base/basictypes.h" |
| 12 #include "base/compiler_specific.h" | 12 #include "base/compiler_specific.h" |
| 13 #include "base/i18n/rtl.h" | 13 #include "base/i18n/rtl.h" |
| 14 #include "base/memory/scoped_ptr.h" | 14 #include "base/memory/scoped_ptr.h" |
| 15 #include "base/process.h" | 15 #include "base/process.h" |
| 16 #include "content/browser/web_contents/web_contents_impl.h" |
| 16 #include "content/public/browser/android/content_view_core.h" | 17 #include "content/public/browser/android/content_view_core.h" |
| 17 #include "content/public/browser/notification_observer.h" | 18 #include "content/public/browser/notification_observer.h" |
| 18 #include "googleurl/src/gurl.h" | 19 #include "googleurl/src/gurl.h" |
| 19 #include "ui/gfx/rect.h" | 20 #include "ui/gfx/rect.h" |
| 20 | 21 |
| 21 struct WebMenuItem; | 22 struct WebMenuItem; |
| 22 | 23 |
| 23 namespace content { | 24 namespace content { |
| 24 class ContentViewClient; | 25 class ContentViewClient; |
| 25 class RenderWidgetHostViewAndroid; | 26 class RenderWidgetHostViewAndroid; |
| 26 | 27 |
| 27 // TODO(jrg): this is a shell. Upstream the rest. | 28 // TODO(jrg): this is a shell. Upstream the rest. |
| 28 class ContentViewCoreImpl : public ContentViewCore, | 29 class ContentViewCoreImpl : public ContentViewCore, |
| 29 public NotificationObserver { | 30 public NotificationObserver { |
| 30 public: | 31 public: |
| 31 ContentViewCoreImpl(JNIEnv* env, | 32 ContentViewCoreImpl(JNIEnv* env, |
| 32 jobject obj, | 33 jobject obj, |
| 33 WebContents* web_contents); | 34 WebContents* web_contents); |
| 34 virtual void Destroy(JNIEnv* env, jobject obj); | 35 |
| 36 // ContentViewCore overrides |
| 37 virtual void Destroy(JNIEnv* env, jobject obj) OVERRIDE; |
| 38 virtual void AddJavascriptInterface( |
| 39 JNIEnv* env, |
| 40 jobject obj, |
| 41 jobject object, |
| 42 jstring name, |
| 43 jboolean allow_inherited_methods) OVERRIDE; |
| 44 virtual void RemoveJavascriptInterface(JNIEnv* env, jobject obj, |
| 45 jstring name) OVERRIDE; |
| 35 | 46 |
| 36 // -------------------------------------------------------------------------- | 47 // -------------------------------------------------------------------------- |
| 37 // Methods called from Java via JNI | 48 // Methods called from Java via JNI |
| 38 // -------------------------------------------------------------------------- | 49 // -------------------------------------------------------------------------- |
| 39 | 50 |
| 40 // Notifies the ContentViewCore that items were selected in the currently | 51 // Notifies the ContentViewCore that items were selected in the currently |
| 41 // showing select popup. | 52 // showing select popup. |
| 42 void SelectPopupMenuItems(JNIEnv* env, jobject obj, jintArray indices); | 53 void SelectPopupMenuItems(JNIEnv* env, jobject obj, jintArray indices); |
| 43 | 54 |
| 44 void LoadUrlWithoutUrlSanitization(JNIEnv* env, | 55 void LoadUrlWithoutUrlSanitization(JNIEnv* env, |
| (...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 100 bool activated, | 111 bool activated, |
| 101 bool force); | 112 bool force); |
| 102 virtual void StartContentIntent(const GURL& content_url) OVERRIDE; | 113 virtual void StartContentIntent(const GURL& content_url) OVERRIDE; |
| 103 | 114 |
| 104 // -------------------------------------------------------------------------- | 115 // -------------------------------------------------------------------------- |
| 105 // Methods called from native code | 116 // Methods called from native code |
| 106 // -------------------------------------------------------------------------- | 117 // -------------------------------------------------------------------------- |
| 107 | 118 |
| 108 gfx::Rect GetBounds() const; | 119 gfx::Rect GetBounds() const; |
| 109 | 120 |
| 110 WebContents* web_contents() const { return web_contents_; } | 121 WebContents* web_contents() const { return web_contents_impl_; } |
| 111 void LoadUrl(const GURL& url, int page_transition); | 122 void LoadUrl(const GURL& url, int page_transition); |
| 112 void LoadUrlWithUserAgentOverride( | 123 void LoadUrlWithUserAgentOverride( |
| 113 const GURL& url, | 124 const GURL& url, |
| 114 int page_transition, | 125 int page_transition, |
| 115 const std::string& user_agent_override); | 126 const std::string& user_agent_override); |
| 116 | 127 |
| 117 private: | 128 private: |
| 118 // NotificationObserver implementation. | 129 // NotificationObserver implementation. |
| 119 virtual void Observe(int type, | 130 virtual void Observe(int type, |
| 120 const NotificationSource& source, | 131 const NotificationSource& source, |
| (...skipping 10 matching lines...) Expand all Loading... |
| 131 | 142 |
| 132 void InitJNI(JNIEnv* env, jobject obj); | 143 void InitJNI(JNIEnv* env, jobject obj); |
| 133 | 144 |
| 134 void PostLoadUrl(const GURL& url); | 145 void PostLoadUrl(const GURL& url); |
| 135 | 146 |
| 136 struct JavaObject; | 147 struct JavaObject; |
| 137 JavaObject* java_object_; | 148 JavaObject* java_object_; |
| 138 | 149 |
| 139 // Reference to the current WebContents used to determine how and what to | 150 // Reference to the current WebContents used to determine how and what to |
| 140 // display in the ContentViewCore. | 151 // display in the ContentViewCore. |
| 141 WebContents* web_contents_; | 152 WebContentsImpl* web_contents_impl_; |
| 142 | 153 |
| 143 // We only set this to be the delegate of the web_contents if we own it. | 154 // We only set this to be the delegate of the web_contents if we own it. |
| 144 scoped_ptr<ContentViewClient> content_view_client_; | 155 scoped_ptr<ContentViewClient> content_view_client_; |
| 145 | 156 |
| 146 // Whether the renderer backing this ContentViewCore has crashed. | 157 // Whether the renderer backing this ContentViewCore has crashed. |
| 147 bool tab_crashed_; | 158 bool tab_crashed_; |
| 148 | 159 |
| 149 DISALLOW_COPY_AND_ASSIGN(ContentViewCoreImpl); | 160 DISALLOW_COPY_AND_ASSIGN(ContentViewCoreImpl); |
| 150 }; | 161 }; |
| 151 | 162 |
| 152 bool RegisterContentViewCore(JNIEnv* env); | 163 bool RegisterContentViewCore(JNIEnv* env); |
| 153 | 164 |
| 154 }; // namespace content | 165 }; // namespace content |
| 155 | 166 |
| 156 #endif // CONTENT_BROWSER_ANDROID_CONTENT_VIEW_CORE_IMPL_H_ | 167 #endif // CONTENT_BROWSER_ANDROID_CONTENT_VIEW_CORE_IMPL_H_ |
| OLD | NEW |