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 #include "content/browser/android/content_view_core_impl.h" | 5 #include "content/browser/android/content_view_core_impl.h" |
6 | 6 |
7 #include "base/android/jni_android.h" | 7 #include "base/android/jni_android.h" |
8 #include "base/android/jni_array.h" | 8 #include "base/android/jni_array.h" |
9 #include "base/android/jni_string.h" | 9 #include "base/android/jni_string.h" |
10 #include "base/android/scoped_java_ref.h" | 10 #include "base/android/scoped_java_ref.h" |
11 #include "base/command_line.h" | 11 #include "base/command_line.h" |
12 #include "base/json/json_writer.h" | 12 #include "base/json/json_writer.h" |
13 #include "base/logging.h" | 13 #include "base/logging.h" |
14 #include "base/metrics/histogram.h" | 14 #include "base/metrics/histogram.h" |
15 #include "base/strings/utf_string_conversions.h" | 15 #include "base/strings/utf_string_conversions.h" |
16 #include "base/values.h" | 16 #include "base/values.h" |
17 #include "cc/layers/layer.h" | 17 #include "cc/layers/layer.h" |
18 #include "cc/layers/solid_color_layer.h" | 18 #include "cc/layers/solid_color_layer.h" |
19 #include "cc/output/begin_frame_args.h" | 19 #include "cc/output/begin_frame_args.h" |
20 #include "content/browser/android/gesture_event_type.h" | 20 #include "content/browser/android/gesture_event_type.h" |
21 #include "content/browser/android/interstitial_page_delegate_android.h" | 21 #include "content/browser/android/interstitial_page_delegate_android.h" |
22 #include "content/browser/android/load_url_params.h" | 22 #include "content/browser/android/load_url_params.h" |
23 #include "content/browser/frame_host/interstitial_page_impl.h" | 23 #include "content/browser/frame_host/interstitial_page_impl.h" |
24 #include "content/browser/frame_host/navigation_controller_impl.h" | 24 #include "content/browser/frame_host/navigation_controller_impl.h" |
25 #include "content/browser/frame_host/navigation_entry_impl.h" | 25 #include "content/browser/frame_host/navigation_entry_impl.h" |
26 #include "content/browser/geolocation/geolocation_dispatcher_host.h" | 26 #include "content/browser/geolocation/geolocation_dispatcher_host.h" |
27 #include "content/browser/media/android/browser_media_player_manager.h" | 27 #include "content/browser/media/android/media_web_contents_observer.h" |
28 #include "content/browser/renderer_host/compositor_impl_android.h" | 28 #include "content/browser/renderer_host/compositor_impl_android.h" |
29 #include "content/browser/renderer_host/input/motion_event_android.h" | 29 #include "content/browser/renderer_host/input/motion_event_android.h" |
30 #include "content/browser/renderer_host/input/web_input_event_builders_android.h
" | 30 #include "content/browser/renderer_host/input/web_input_event_builders_android.h
" |
31 #include "content/browser/renderer_host/input/web_input_event_util.h" | 31 #include "content/browser/renderer_host/input/web_input_event_util.h" |
32 #include "content/browser/renderer_host/java/java_bound_object.h" | 32 #include "content/browser/renderer_host/java/java_bound_object.h" |
33 #include "content/browser/renderer_host/java/java_bridge_dispatcher_host_manager
.h" | 33 #include "content/browser/renderer_host/java/java_bridge_dispatcher_host_manager
.h" |
34 #include "content/browser/renderer_host/render_view_host_impl.h" | 34 #include "content/browser/renderer_host/render_view_host_impl.h" |
35 #include "content/browser/renderer_host/render_widget_host_impl.h" | 35 #include "content/browser/renderer_host/render_widget_host_impl.h" |
36 #include "content/browser/renderer_host/render_widget_host_view_android.h" | 36 #include "content/browser/renderer_host/render_widget_host_view_android.h" |
37 #include "content/browser/screen_orientation/screen_orientation_dispatcher_host.
h" | 37 #include "content/browser/screen_orientation/screen_orientation_dispatcher_host.
h" |
(...skipping 368 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
406 void ContentViewCoreImpl::Show() { | 406 void ContentViewCoreImpl::Show() { |
407 GetWebContents()->WasShown(); | 407 GetWebContents()->WasShown(); |
408 } | 408 } |
409 | 409 |
410 void ContentViewCoreImpl::Hide() { | 410 void ContentViewCoreImpl::Hide() { |
411 GetWebContents()->WasHidden(); | 411 GetWebContents()->WasHidden(); |
412 PauseVideo(); | 412 PauseVideo(); |
413 } | 413 } |
414 | 414 |
415 void ContentViewCoreImpl::PauseVideo() { | 415 void ContentViewCoreImpl::PauseVideo() { |
416 RenderViewHost* host = web_contents_->GetRenderViewHost(); | 416 RenderViewHostImpl* rvhi = static_cast<RenderViewHostImpl*>( |
417 if (host) | 417 web_contents_->GetRenderViewHost()); |
418 host->Send(new ViewMsg_PauseVideo(host->GetRoutingID())); | 418 if (rvhi) |
| 419 rvhi->media_web_contents_observer()->PauseVideo(); |
419 } | 420 } |
420 | 421 |
421 void ContentViewCoreImpl::PauseOrResumeGeolocation(bool should_pause) { | 422 void ContentViewCoreImpl::PauseOrResumeGeolocation(bool should_pause) { |
422 web_contents_->geolocation_dispatcher_host()->PauseOrResume(should_pause); | 423 web_contents_->geolocation_dispatcher_host()->PauseOrResume(should_pause); |
423 } | 424 } |
424 | 425 |
425 // All positions and sizes are in CSS pixels. | 426 // All positions and sizes are in CSS pixels. |
426 // Note that viewport_width/height is a best effort based. | 427 // Note that viewport_width/height is a best effort based. |
427 // ContentViewCore has the actual information about the physical viewport size. | 428 // ContentViewCore has the actual information about the physical viewport size. |
428 void ContentViewCoreImpl::UpdateFrameInfo( | 429 void ContentViewCoreImpl::UpdateFrameInfo( |
(...skipping 1234 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1663 reinterpret_cast<ui::WindowAndroid*>(window_android), | 1664 reinterpret_cast<ui::WindowAndroid*>(window_android), |
1664 retained_objects_set); | 1665 retained_objects_set); |
1665 return reinterpret_cast<intptr_t>(view); | 1666 return reinterpret_cast<intptr_t>(view); |
1666 } | 1667 } |
1667 | 1668 |
1668 bool RegisterContentViewCore(JNIEnv* env) { | 1669 bool RegisterContentViewCore(JNIEnv* env) { |
1669 return RegisterNativesImpl(env); | 1670 return RegisterNativesImpl(env); |
1670 } | 1671 } |
1671 | 1672 |
1672 } // namespace content | 1673 } // namespace content |
OLD | NEW |