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 115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
165 | 170 |
166 // -------------------------------------------------------------------------- | 171 // -------------------------------------------------------------------------- |
167 // Methods called from native code | 172 // Methods called from native code |
168 // -------------------------------------------------------------------------- | 173 // -------------------------------------------------------------------------- |
169 | 174 |
170 gfx::Rect GetBounds() const; | 175 gfx::Rect GetBounds() const; |
171 | 176 |
172 WebContents* web_contents() const { return web_contents_; } | 177 WebContents* web_contents() const { return web_contents_; } |
173 | 178 |
174 virtual void LoadUrl(NavigationController::LoadURLParams& params) OVERRIDE; | 179 virtual void LoadUrl(NavigationController::LoadURLParams& params) OVERRIDE; |
| 180 virtual ui::WindowAndroid* GetWindowAndroid() OVERRIDE; |
175 | 181 |
176 private: | 182 private: |
177 // NotificationObserver implementation. | 183 // NotificationObserver implementation. |
178 virtual void Observe(int type, | 184 virtual void Observe(int type, |
179 const NotificationSource& source, | 185 const NotificationSource& source, |
180 const NotificationDetails& details) OVERRIDE; | 186 const NotificationDetails& details) OVERRIDE; |
181 | 187 |
182 // -------------------------------------------------------------------------- | 188 // -------------------------------------------------------------------------- |
183 // Private methods that call to Java via JNI | 189 // Private methods that call to Java via JNI |
184 // -------------------------------------------------------------------------- | 190 // -------------------------------------------------------------------------- |
(...skipping 24 matching lines...) Expand all Loading... |
209 // display in the ContentViewCore. | 215 // display in the ContentViewCore. |
210 WebContentsImpl* web_contents_; | 216 WebContentsImpl* web_contents_; |
211 bool owns_web_contents_; | 217 bool owns_web_contents_; |
212 | 218 |
213 // We only set this to be the delegate of the web_contents if we own it. | 219 // We only set this to be the delegate of the web_contents if we own it. |
214 scoped_ptr<ContentViewClient> content_view_client_; | 220 scoped_ptr<ContentViewClient> content_view_client_; |
215 | 221 |
216 // Whether the renderer backing this ContentViewCore has crashed. | 222 // Whether the renderer backing this ContentViewCore has crashed. |
217 bool tab_crashed_; | 223 bool tab_crashed_; |
218 | 224 |
| 225 // The owning window that has a hold of main application activity. |
| 226 ui::WindowAndroid* window_android_; |
| 227 |
219 DISALLOW_COPY_AND_ASSIGN(ContentViewCoreImpl); | 228 DISALLOW_COPY_AND_ASSIGN(ContentViewCoreImpl); |
220 }; | 229 }; |
221 | 230 |
222 bool RegisterContentViewCore(JNIEnv* env); | 231 bool RegisterContentViewCore(JNIEnv* env); |
223 | 232 |
224 } // namespace content | 233 } // namespace content |
225 | 234 |
226 #endif // CONTENT_BROWSER_ANDROID_CONTENT_VIEW_CORE_IMPL_H_ | 235 #endif // CONTENT_BROWSER_ANDROID_CONTENT_VIEW_CORE_IMPL_H_ |
OLD | NEW |