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 #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/utf_string_conversions.h" | 14 #include "base/utf_string_conversions.h" |
15 #include "base/values.h" | 15 #include "base/values.h" |
16 #include "cc/layer.h" | 16 #include "cc/layer.h" |
17 #include "content/browser/android/interstitial_page_delegate_android.h" | 17 #include "content/browser/android/interstitial_page_delegate_android.h" |
18 #include "content/browser/android/load_url_params.h" | 18 #include "content/browser/android/load_url_params.h" |
19 #include "content/browser/android/media_player_manager_android.h" | |
19 #include "content/browser/android/touch_point.h" | 20 #include "content/browser/android/touch_point.h" |
20 #include "content/browser/renderer_host/java/java_bound_object.h" | 21 #include "content/browser/renderer_host/java/java_bound_object.h" |
21 #include "content/browser/renderer_host/java/java_bridge_dispatcher_host_manager .h" | 22 #include "content/browser/renderer_host/java/java_bridge_dispatcher_host_manager .h" |
22 #include "content/browser/renderer_host/compositor_impl_android.h" | 23 #include "content/browser/renderer_host/compositor_impl_android.h" |
23 #include "content/browser/renderer_host/render_view_host_impl.h" | 24 #include "content/browser/renderer_host/render_view_host_impl.h" |
24 #include "content/browser/renderer_host/render_widget_host_impl.h" | 25 #include "content/browser/renderer_host/render_widget_host_impl.h" |
25 #include "content/browser/renderer_host/render_widget_host_view_android.h" | 26 #include "content/browser/renderer_host/render_widget_host_view_android.h" |
26 #include "content/browser/ssl/ssl_host_state.h" | 27 #include "content/browser/ssl/ssl_host_state.h" |
27 #include "content/browser/web_contents/interstitial_page_impl.h" | 28 #include "content/browser/web_contents/interstitial_page_impl.h" |
28 #include "content/browser/web_contents/navigation_controller_impl.h" | 29 #include "content/browser/web_contents/navigation_controller_impl.h" |
(...skipping 1162 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1191 bool enable) { | 1192 bool enable) { |
1192 RenderViewHost* host = web_contents_->GetRenderViewHost(); | 1193 RenderViewHost* host = web_contents_->GetRenderViewHost(); |
1193 host->Send(new ViewMsg_EnableHidingTopControls(host->GetRoutingID(), enable)); | 1194 host->Send(new ViewMsg_EnableHidingTopControls(host->GetRoutingID(), enable)); |
1194 } | 1195 } |
1195 | 1196 |
1196 void ContentViewCoreImpl::ShowImeIfNeeded(JNIEnv* env, jobject obj) { | 1197 void ContentViewCoreImpl::ShowImeIfNeeded(JNIEnv* env, jobject obj) { |
1197 RenderViewHost* host = web_contents_->GetRenderViewHost(); | 1198 RenderViewHost* host = web_contents_->GetRenderViewHost(); |
1198 host->Send(new ViewMsg_ShowImeIfNeeded(host->GetRoutingID())); | 1199 host->Send(new ViewMsg_ShowImeIfNeeded(host->GetRoutingID())); |
1199 } | 1200 } |
1200 | 1201 |
1202 void ContentViewCoreImpl::ExternalVideoSurfaceCreated(JNIEnv* env, | |
1203 jobject obj, | |
1204 jobject jsurface) { | |
1205 RenderViewHostImpl* rvhi = static_cast<RenderViewHostImpl*>( | |
1206 web_contents_->GetRenderViewHost()); | |
1207 DCHECK(rvhi); | |
scherkus (not reviewing)
2013/03/07 00:09:13
DCHECKs aren't useful when you immediately derefer
wonsik
2013/03/07 02:54:08
Removed & added the condition in if clause.
| |
1208 if (rvhi->media_player_manager()) | |
1209 rvhi->media_player_manager()->SetExternalVideoSurface(jsurface); | |
1210 } | |
1211 | |
1212 void ContentViewCoreImpl::ExternalVideoSurfaceDestroyed(JNIEnv* env, | |
1213 jobject obj) { | |
1214 RenderViewHostImpl* rvhi = static_cast<RenderViewHostImpl*>( | |
1215 web_contents_->GetRenderViewHost()); | |
1216 DCHECK(rvhi); | |
scherkus (not reviewing)
2013/03/07 00:09:13
ditto
wonsik
2013/03/07 02:54:08
Removed & added the condition in if clause.
| |
1217 if (rvhi->media_player_manager()) | |
1218 rvhi->media_player_manager()->SetExternalVideoSurface(NULL); | |
1219 } | |
1220 | |
1201 void ContentViewCoreImpl::ScrollFocusedEditableNodeIntoView(JNIEnv* env, | 1221 void ContentViewCoreImpl::ScrollFocusedEditableNodeIntoView(JNIEnv* env, |
1202 jobject obj) { | 1222 jobject obj) { |
1203 RenderViewHost* host = web_contents_->GetRenderViewHost(); | 1223 RenderViewHost* host = web_contents_->GetRenderViewHost(); |
1204 host->Send(new ViewMsg_ScrollFocusedEditableNodeIntoRect(host->GetRoutingID(), | 1224 host->Send(new ViewMsg_ScrollFocusedEditableNodeIntoRect(host->GetRoutingID(), |
1205 gfx::Rect())); | 1225 gfx::Rect())); |
1206 } | 1226 } |
1207 | 1227 |
1208 namespace { | 1228 namespace { |
1209 | 1229 |
1210 static void AddNavigationEntryToHistory(JNIEnv* env, jobject obj, | 1230 static void AddNavigationEntryToHistory(JNIEnv* env, jobject obj, |
(...skipping 207 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1418 if (!HasField(env, clazz, "mNativeContentViewCore", "I")) { | 1438 if (!HasField(env, clazz, "mNativeContentViewCore", "I")) { |
1419 DLOG(ERROR) << "Unable to find ContentView.mNativeContentViewCore!"; | 1439 DLOG(ERROR) << "Unable to find ContentView.mNativeContentViewCore!"; |
1420 return false; | 1440 return false; |
1421 } | 1441 } |
1422 g_native_content_view = GetFieldID(env, clazz, "mNativeContentViewCore", "I"); | 1442 g_native_content_view = GetFieldID(env, clazz, "mNativeContentViewCore", "I"); |
1423 | 1443 |
1424 return RegisterNativesImpl(env) >= 0; | 1444 return RegisterNativesImpl(env) >= 0; |
1425 } | 1445 } |
1426 | 1446 |
1427 } // namespace content | 1447 } // namespace content |
OLD | NEW |