OLD | NEW |
1 // Copyright 2012 The Chromium Authors. All rights reserved. | 1 // Copyright 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_android.h" | 10 #include "base/android/jni_android.h" |
11 #include "base/android/jni_weak_ref.h" | 11 #include "base/android/jni_weak_ref.h" |
12 #include "base/basictypes.h" | 12 #include "base/basictypes.h" |
13 #include "base/compiler_specific.h" | 13 #include "base/compiler_specific.h" |
14 #include "base/i18n/rtl.h" | 14 #include "base/i18n/rtl.h" |
15 #include "base/memory/scoped_ptr.h" | 15 #include "base/memory/scoped_ptr.h" |
16 #include "base/process/process.h" | 16 #include "base/process/process.h" |
17 #include "content/browser/renderer_host/render_widget_host_view_android.h" | 17 #include "content/browser/renderer_host/render_widget_host_view_android.h" |
18 #include "content/browser/web_contents/web_contents_impl.h" | 18 #include "content/browser/web_contents/web_contents_impl.h" |
19 #include "content/public/browser/android/content_view_core.h" | 19 #include "content/public/browser/android/content_view_core.h" |
20 #include "content/public/browser/notification_observer.h" | |
21 #include "content/public/browser/notification_registrar.h" | |
22 #include "content/public/browser/web_contents_observer.h" | 20 #include "content/public/browser/web_contents_observer.h" |
23 #include "third_party/WebKit/public/web/WebInputEvent.h" | 21 #include "third_party/WebKit/public/web/WebInputEvent.h" |
24 #include "ui/gfx/rect.h" | 22 #include "ui/gfx/rect.h" |
25 #include "ui/gfx/rect_f.h" | 23 #include "ui/gfx/rect_f.h" |
26 #include "url/gurl.h" | 24 #include "url/gurl.h" |
27 | 25 |
28 namespace ui { | 26 namespace ui { |
29 class ViewAndroid; | 27 class ViewAndroid; |
30 class WindowAndroid; | 28 class WindowAndroid; |
31 } | 29 } |
32 | 30 |
33 namespace content { | 31 namespace content { |
34 class JavaBridgeDispatcherHostManager; | 32 class JavaBridgeDispatcherHostManager; |
35 class RenderWidgetHostViewAndroid; | 33 class RenderWidgetHostViewAndroid; |
36 struct MenuItem; | 34 struct MenuItem; |
37 | 35 |
38 // TODO(jrg): this is a shell. Upstream the rest. | 36 // TODO(jrg): this is a shell. Upstream the rest. |
39 class ContentViewCoreImpl : public ContentViewCore, | 37 class ContentViewCoreImpl : public ContentViewCore, |
40 public NotificationObserver, | |
41 public WebContentsObserver { | 38 public WebContentsObserver { |
42 public: | 39 public: |
43 static ContentViewCoreImpl* FromWebContents(WebContents* web_contents); | 40 static ContentViewCoreImpl* FromWebContents(WebContents* web_contents); |
44 ContentViewCoreImpl(JNIEnv* env, | 41 ContentViewCoreImpl(JNIEnv* env, |
45 jobject obj, | 42 jobject obj, |
46 WebContents* web_contents, | 43 WebContents* web_contents, |
47 ui::ViewAndroid* view_android, | 44 ui::ViewAndroid* view_android, |
48 ui::WindowAndroid* window_android, | 45 ui::WindowAndroid* window_android, |
49 jobject java_bridge_retained_object_set); | 46 jobject java_bridge_retained_object_set); |
50 | 47 |
(...skipping 254 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
305 | 302 |
306 void AttachLayer(scoped_refptr<cc::Layer> layer); | 303 void AttachLayer(scoped_refptr<cc::Layer> layer); |
307 void RemoveLayer(scoped_refptr<cc::Layer> layer); | 304 void RemoveLayer(scoped_refptr<cc::Layer> layer); |
308 | 305 |
309 private: | 306 private: |
310 class ContentViewUserData; | 307 class ContentViewUserData; |
311 | 308 |
312 friend class ContentViewUserData; | 309 friend class ContentViewUserData; |
313 virtual ~ContentViewCoreImpl(); | 310 virtual ~ContentViewCoreImpl(); |
314 | 311 |
315 // NotificationObserver implementation. | |
316 virtual void Observe(int type, | |
317 const NotificationSource& source, | |
318 const NotificationDetails& details) OVERRIDE; | |
319 | |
320 // WebContentsObserver implementation. | 312 // WebContentsObserver implementation. |
321 virtual void RenderViewReady() OVERRIDE; | 313 virtual void RenderViewReady() OVERRIDE; |
| 314 virtual void RenderViewHostChanged(RenderViewHost* old_host, |
| 315 RenderViewHost* new_host) OVERRIDE; |
322 virtual void WebContentsDestroyed() OVERRIDE; | 316 virtual void WebContentsDestroyed() OVERRIDE; |
323 | 317 |
324 // -------------------------------------------------------------------------- | 318 // -------------------------------------------------------------------------- |
325 // Other private methods and data | 319 // Other private methods and data |
326 // -------------------------------------------------------------------------- | 320 // -------------------------------------------------------------------------- |
327 | 321 |
328 void InitWebContents(); | 322 void InitWebContents(); |
329 | 323 |
330 RenderWidgetHostViewAndroid* GetRenderWidgetHostViewAndroid(); | 324 RenderWidgetHostViewAndroid* GetRenderWidgetHostViewAndroid(); |
331 | 325 |
(...skipping 12 matching lines...) Expand all Loading... |
344 void SetFocusInternal(bool focused); | 338 void SetFocusInternal(bool focused); |
345 | 339 |
346 // Send device_orientation_ to renderer. | 340 // Send device_orientation_ to renderer. |
347 void SendOrientationChangeEventInternal(); | 341 void SendOrientationChangeEventInternal(); |
348 | 342 |
349 float dpi_scale() const { return dpi_scale_; } | 343 float dpi_scale() const { return dpi_scale_; } |
350 | 344 |
351 // A weak reference to the Java ContentViewCore object. | 345 // A weak reference to the Java ContentViewCore object. |
352 JavaObjectWeakGlobalRef java_ref_; | 346 JavaObjectWeakGlobalRef java_ref_; |
353 | 347 |
354 NotificationRegistrar notification_registrar_; | |
355 | |
356 // Reference to the current WebContents used to determine how and what to | 348 // Reference to the current WebContents used to determine how and what to |
357 // display in the ContentViewCore. | 349 // display in the ContentViewCore. |
358 WebContentsImpl* web_contents_; | 350 WebContentsImpl* web_contents_; |
359 | 351 |
360 // A compositor layer containing any layer that should be shown. | 352 // A compositor layer containing any layer that should be shown. |
361 scoped_refptr<cc::Layer> root_layer_; | 353 scoped_refptr<cc::Layer> root_layer_; |
362 | 354 |
363 // Device scale factor. | 355 // Device scale factor. |
364 float dpi_scale_; | 356 float dpi_scale_; |
365 | 357 |
(...skipping 15 matching lines...) Expand all Loading... |
381 java_bridge_dispatcher_host_manager_; | 373 java_bridge_dispatcher_host_manager_; |
382 | 374 |
383 DISALLOW_COPY_AND_ASSIGN(ContentViewCoreImpl); | 375 DISALLOW_COPY_AND_ASSIGN(ContentViewCoreImpl); |
384 }; | 376 }; |
385 | 377 |
386 bool RegisterContentViewCore(JNIEnv* env); | 378 bool RegisterContentViewCore(JNIEnv* env); |
387 | 379 |
388 } // namespace content | 380 } // namespace content |
389 | 381 |
390 #endif // CONTENT_BROWSER_ANDROID_CONTENT_VIEW_CORE_IMPL_H_ | 382 #endif // CONTENT_BROWSER_ANDROID_CONTENT_VIEW_CORE_IMPL_H_ |
OLD | NEW |