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/renderer_host/render_widget_host_view_android.h" | 16 #include "content/browser/renderer_host/render_widget_host_view_android.h" |
17 #include "content/browser/web_contents/web_contents_impl.h" | 17 #include "content/browser/web_contents/web_contents_impl.h" |
18 #include "content/public/browser/android/content_view_core.h" | 18 #include "content/public/browser/android/content_view_core.h" |
19 #include "content/public/browser/notification_observer.h" | 19 #include "content/public/browser/notification_observer.h" |
20 #include "content/public/browser/notification_registrar.h" | 20 #include "content/public/browser/notification_registrar.h" |
21 #include "googleurl/src/gurl.h" | 21 #include "googleurl/src/gurl.h" |
22 #include "third_party/WebKit/Source/WebKit/chromium/public/WebInputEvent.h" | 22 #include "third_party/WebKit/Source/WebKit/chromium/public/WebInputEvent.h" |
23 #include "ui/gfx/rect.h" | 23 #include "ui/gfx/rect.h" |
24 | 24 |
25 struct WebMenuItem; | 25 struct WebMenuItem; |
26 | 26 |
| 27 namespace ui { |
| 28 class WindowAndroid; |
| 29 } |
| 30 |
27 namespace content { | 31 namespace content { |
28 class ContentViewClient; | 32 class ContentViewClient; |
29 class RenderWidgetHostViewAndroid; | 33 class RenderWidgetHostViewAndroid; |
30 | 34 |
31 // TODO(jrg): this is a shell. Upstream the rest. | 35 // TODO(jrg): this is a shell. Upstream the rest. |
32 class ContentViewCoreImpl : public ContentViewCore, | 36 class ContentViewCoreImpl : public ContentViewCore, |
33 public NotificationObserver { | 37 public NotificationObserver { |
34 public: | 38 public: |
35 ContentViewCoreImpl(JNIEnv* env, | 39 ContentViewCoreImpl(JNIEnv* env, |
36 jobject obj, | 40 jobject obj, |
37 bool hardware_accelerated, | 41 bool hardware_accelerated, |
38 bool take_ownership_of_web_contents, | 42 bool take_ownership_of_web_contents, |
39 WebContents* web_contents); | 43 WebContents* web_contents, |
| 44 ui::WindowAndroid* window_android); |
40 | 45 |
41 // ContentViewCore overrides | 46 // ContentViewCore overrides |
42 virtual void Destroy(JNIEnv* env, jobject obj) OVERRIDE; | 47 virtual void Destroy(JNIEnv* env, jobject obj) OVERRIDE; |
43 | 48 |
44 // -------------------------------------------------------------------------- | 49 // -------------------------------------------------------------------------- |
45 // Methods called from Java via JNI | 50 // Methods called from Java via JNI |
46 // -------------------------------------------------------------------------- | 51 // -------------------------------------------------------------------------- |
47 | 52 |
48 // Notifies the ContentViewCore that items were selected in the currently | 53 // Notifies the ContentViewCore that items were selected in the currently |
49 // showing select popup. | 54 // showing select popup. |
(...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
162 | 167 |
163 // -------------------------------------------------------------------------- | 168 // -------------------------------------------------------------------------- |
164 // Methods called from native code | 169 // Methods called from native code |
165 // -------------------------------------------------------------------------- | 170 // -------------------------------------------------------------------------- |
166 | 171 |
167 gfx::Rect GetBounds() const; | 172 gfx::Rect GetBounds() const; |
168 | 173 |
169 WebContents* web_contents() const { return web_contents_; } | 174 WebContents* web_contents() const { return web_contents_; } |
170 | 175 |
171 virtual void LoadUrl(NavigationController::LoadURLParams& params) OVERRIDE; | 176 virtual void LoadUrl(NavigationController::LoadURLParams& params) OVERRIDE; |
| 177 virtual ui::WindowAndroid* GetWindowAndroid() OVERRIDE; |
172 | 178 |
173 private: | 179 private: |
174 // NotificationObserver implementation. | 180 // NotificationObserver implementation. |
175 virtual void Observe(int type, | 181 virtual void Observe(int type, |
176 const NotificationSource& source, | 182 const NotificationSource& source, |
177 const NotificationDetails& details) OVERRIDE; | 183 const NotificationDetails& details) OVERRIDE; |
178 | 184 |
179 // -------------------------------------------------------------------------- | 185 // -------------------------------------------------------------------------- |
180 // Private methods that call to Java via JNI | 186 // Private methods that call to Java via JNI |
181 // -------------------------------------------------------------------------- | 187 // -------------------------------------------------------------------------- |
(...skipping 26 matching lines...) Expand all Loading... |
208 // display in the ContentViewCore. | 214 // display in the ContentViewCore. |
209 WebContentsImpl* web_contents_; | 215 WebContentsImpl* web_contents_; |
210 bool owns_web_contents_; | 216 bool owns_web_contents_; |
211 | 217 |
212 // We only set this to be the delegate of the web_contents if we own it. | 218 // We only set this to be the delegate of the web_contents if we own it. |
213 scoped_ptr<ContentViewClient> content_view_client_; | 219 scoped_ptr<ContentViewClient> content_view_client_; |
214 | 220 |
215 // Whether the renderer backing this ContentViewCore has crashed. | 221 // Whether the renderer backing this ContentViewCore has crashed. |
216 bool tab_crashed_; | 222 bool tab_crashed_; |
217 | 223 |
| 224 // The owning window that has a hold of main application activity. |
| 225 ui::WindowAndroid* window_android_; |
| 226 |
218 DISALLOW_COPY_AND_ASSIGN(ContentViewCoreImpl); | 227 DISALLOW_COPY_AND_ASSIGN(ContentViewCoreImpl); |
219 }; | 228 }; |
220 | 229 |
221 bool RegisterContentViewCore(JNIEnv* env); | 230 bool RegisterContentViewCore(JNIEnv* env); |
222 | 231 |
223 } // namespace content | 232 } // namespace content |
224 | 233 |
225 #endif // CONTENT_BROWSER_ANDROID_CONTENT_VIEW_CORE_IMPL_H_ | 234 #endif // CONTENT_BROWSER_ANDROID_CONTENT_VIEW_CORE_IMPL_H_ |
OLD | NEW |