| 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 "android_webview/native/aw_contents.h" | 5 #include "android_webview/native/aw_contents.h" |
| 6 | 6 |
| 7 #include <limits> | 7 #include <limits> |
| 8 #include <utility> | 8 #include <utility> |
| 9 | 9 |
| 10 #include "android_webview/browser/aw_browser_context.h" | 10 #include "android_webview/browser/aw_browser_context.h" |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 49 #include "base/memory/ptr_util.h" | 49 #include "base/memory/ptr_util.h" |
| 50 #include "base/pickle.h" | 50 #include "base/pickle.h" |
| 51 #include "base/single_thread_task_runner.h" | 51 #include "base/single_thread_task_runner.h" |
| 52 #include "base/strings/string16.h" | 52 #include "base/strings/string16.h" |
| 53 #include "base/supports_user_data.h" | 53 #include "base/supports_user_data.h" |
| 54 #include "base/threading/thread_task_runner_handle.h" | 54 #include "base/threading/thread_task_runner_handle.h" |
| 55 #include "components/autofill/content/browser/content_autofill_driver_factory.h" | 55 #include "components/autofill/content/browser/content_autofill_driver_factory.h" |
| 56 #include "components/autofill/core/browser/autofill_manager.h" | 56 #include "components/autofill/core/browser/autofill_manager.h" |
| 57 #include "components/autofill/core/browser/webdata/autofill_webdata_service.h" | 57 #include "components/autofill/core/browser/webdata/autofill_webdata_service.h" |
| 58 #include "components/navigation_interception/intercept_navigation_delegate.h" | 58 #include "components/navigation_interception/intercept_navigation_delegate.h" |
| 59 #include "content/public/browser/android/app_web_message_port_service.h" | |
| 60 #include "content/public/browser/android/content_view_core.h" | 59 #include "content/public/browser/android/content_view_core.h" |
| 61 #include "content/public/browser/android/synchronous_compositor.h" | 60 #include "content/public/browser/android/synchronous_compositor.h" |
| 62 #include "content/public/browser/browser_thread.h" | 61 #include "content/public/browser/browser_thread.h" |
| 63 #include "content/public/browser/child_process_security_policy.h" | 62 #include "content/public/browser/child_process_security_policy.h" |
| 64 #include "content/public/browser/favicon_status.h" | 63 #include "content/public/browser/favicon_status.h" |
| 65 #include "content/public/browser/interstitial_page.h" | 64 #include "content/public/browser/interstitial_page.h" |
| 66 #include "content/public/browser/message_port_provider.h" | 65 #include "content/public/browser/message_port_provider.h" |
| 67 #include "content/public/browser/navigation_entry.h" | 66 #include "content/public/browser/navigation_entry.h" |
| 68 #include "content/public/browser/render_frame_host.h" | 67 #include "content/public/browser/render_frame_host.h" |
| 69 #include "content/public/browser/render_process_host.h" | 68 #include "content/public/browser/render_process_host.h" |
| (...skipping 1257 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1327 browser_view_renderer_.TrimMemory(); | 1326 browser_view_renderer_.TrimMemory(); |
| 1328 } | 1327 } |
| 1329 | 1328 |
| 1330 // TODO(sgurun) add support for posting a frame whose name is known (only | 1329 // TODO(sgurun) add support for posting a frame whose name is known (only |
| 1331 // main frame is supported at this time, see crbug.com/389721) | 1330 // main frame is supported at this time, see crbug.com/389721) |
| 1332 void AwContents::PostMessageToFrame(JNIEnv* env, | 1331 void AwContents::PostMessageToFrame(JNIEnv* env, |
| 1333 const JavaParamRef<jobject>& obj, | 1332 const JavaParamRef<jobject>& obj, |
| 1334 const JavaParamRef<jstring>& frame_name, | 1333 const JavaParamRef<jstring>& frame_name, |
| 1335 const JavaParamRef<jstring>& message, | 1334 const JavaParamRef<jstring>& message, |
| 1336 const JavaParamRef<jstring>& target_origin, | 1335 const JavaParamRef<jstring>& target_origin, |
| 1337 const JavaParamRef<jintArray>& sent_ports) { | 1336 const JavaParamRef<jobjectArray>& ports) { |
| 1338 // Use an empty source origin for android webview. | 1337 // Use an empty source origin for android webview. |
| 1339 base::string16 source_origin; | |
| 1340 base::string16 j_target_origin(ConvertJavaStringToUTF16(env, target_origin)); | |
| 1341 base::string16 j_message(ConvertJavaStringToUTF16(env, message)); | |
| 1342 std::vector<int> j_ports; | |
| 1343 | |
| 1344 if (sent_ports != nullptr) | |
| 1345 base::android::JavaIntArrayToIntVector(env, sent_ports, &j_ports); | |
| 1346 | |
| 1347 content::MessagePortProvider::PostMessageToFrame(web_contents_.get(), | 1338 content::MessagePortProvider::PostMessageToFrame(web_contents_.get(), |
| 1348 source_origin, | 1339 env, |
| 1349 j_target_origin, | 1340 nullptr, |
| 1350 j_message, | 1341 target_origin, |
| 1351 j_ports); | 1342 message, |
| 1352 } | 1343 ports); |
| 1353 | |
| 1354 void AwContents::CreateMessageChannel(JNIEnv* env, | |
| 1355 const JavaParamRef<jobject>& obj, | |
| 1356 const JavaParamRef<jobjectArray>& ports) { | |
| 1357 content::MessagePortProvider::GetAppWebMessagePortService() | |
| 1358 ->CreateMessageChannel(env, ports, web_contents_.get()); | |
| 1359 } | 1344 } |
| 1360 | 1345 |
| 1361 void AwContents::GrantFileSchemeAccesstoChildProcess( | 1346 void AwContents::GrantFileSchemeAccesstoChildProcess( |
| 1362 JNIEnv* env, | 1347 JNIEnv* env, |
| 1363 const JavaParamRef<jobject>& obj) { | 1348 const JavaParamRef<jobject>& obj) { |
| 1364 content::ChildProcessSecurityPolicy::GetInstance()->GrantScheme( | 1349 content::ChildProcessSecurityPolicy::GetInstance()->GrantScheme( |
| 1365 web_contents_->GetRenderProcessHost()->GetID(), url::kFileScheme); | 1350 web_contents_->GetRenderProcessHost()->GetID(), url::kFileScheme); |
| 1366 } | 1351 } |
| 1367 | 1352 |
| 1368 void AwContents::ResumeLoadingCreatedPopupWebContents( | 1353 void AwContents::ResumeLoadingCreatedPopupWebContents( |
| (...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1442 | 1427 |
| 1443 return Java_AwContents_onRenderProcessGoneDetail(env, obj, | 1428 return Java_AwContents_onRenderProcessGoneDetail(env, obj, |
| 1444 child_process_id, crashed); | 1429 child_process_id, crashed); |
| 1445 } | 1430 } |
| 1446 | 1431 |
| 1447 void AwContents::RenderProcessReady(content::RenderProcessHost* host) { | 1432 void AwContents::RenderProcessReady(content::RenderProcessHost* host) { |
| 1448 UpdateRendererPriority(); | 1433 UpdateRendererPriority(); |
| 1449 } | 1434 } |
| 1450 | 1435 |
| 1451 } // namespace android_webview | 1436 } // namespace android_webview |
| OLD | NEW |