Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(286)

Side by Side Diff: android_webview/native/aw_contents.cc

Issue 2422793002: HTML MessagePort as mojo::MessagePipeHandle (Closed)
Patch Set: Rebase Created 3 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
65 #include "content/public/browser/interstitial_page.h" 65 #include "content/public/browser/interstitial_page.h"
66 #include "content/public/browser/message_port_provider.h" 66 #include "content/public/browser/message_port_provider.h"
67 #include "content/public/browser/navigation_entry.h" 67 #include "content/public/browser/navigation_entry.h"
68 #include "content/public/browser/render_frame_host.h" 68 #include "content/public/browser/render_frame_host.h"
69 #include "content/public/browser/render_process_host.h" 69 #include "content/public/browser/render_process_host.h"
70 #include "content/public/browser/render_view_host.h" 70 #include "content/public/browser/render_view_host.h"
71 #include "content/public/browser/render_widget_host.h" 71 #include "content/public/browser/render_widget_host.h"
72 #include "content/public/browser/render_widget_host_iterator.h" 72 #include "content/public/browser/render_widget_host_iterator.h"
73 #include "content/public/browser/ssl_status.h" 73 #include "content/public/browser/ssl_status.h"
74 #include "content/public/browser/web_contents.h" 74 #include "content/public/browser/web_contents.h"
75 #include "content/public/common/message_port.h"
75 #include "content/public/common/mhtml_generation_params.h" 76 #include "content/public/common/mhtml_generation_params.h"
76 #include "content/public/common/renderer_preferences.h" 77 #include "content/public/common/renderer_preferences.h"
77 #include "jni/AwContents_jni.h" 78 #include "jni/AwContents_jni.h"
78 #include "net/base/auth.h" 79 #include "net/base/auth.h"
79 #include "net/cert/x509_certificate.h" 80 #include "net/cert/x509_certificate.h"
80 #include "third_party/skia/include/core/SkPicture.h" 81 #include "third_party/skia/include/core/SkPicture.h"
81 #include "ui/gfx/android/java_bitmap.h" 82 #include "ui/gfx/android/java_bitmap.h"
82 #include "ui/gfx/geometry/rect_f.h" 83 #include "ui/gfx/geometry/rect_f.h"
83 #include "ui/gfx/geometry/size.h" 84 #include "ui/gfx/geometry/size.h"
84 #include "ui/gfx/image/image.h" 85 #include "ui/gfx/image/image.h"
(...skipping 1242 matching lines...) Expand 10 before | Expand all | Expand 10 after
1327 browser_view_renderer_.TrimMemory(); 1328 browser_view_renderer_.TrimMemory();
1328 } 1329 }
1329 1330
1330 // TODO(sgurun) add support for posting a frame whose name is known (only 1331 // 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) 1332 // main frame is supported at this time, see crbug.com/389721)
1332 void AwContents::PostMessageToFrame(JNIEnv* env, 1333 void AwContents::PostMessageToFrame(JNIEnv* env,
1333 const JavaParamRef<jobject>& obj, 1334 const JavaParamRef<jobject>& obj,
1334 const JavaParamRef<jstring>& frame_name, 1335 const JavaParamRef<jstring>& frame_name,
1335 const JavaParamRef<jstring>& message, 1336 const JavaParamRef<jstring>& message,
1336 const JavaParamRef<jstring>& target_origin, 1337 const JavaParamRef<jstring>& target_origin,
1337 const JavaParamRef<jintArray>& sent_ports) { 1338 const JavaParamRef<jobjectArray>& ports) {
1338 // Use an empty source origin for android webview. 1339 // Use an empty source origin for android webview.
1339 base::string16 source_origin; 1340 base::string16 source_origin;
1340 base::string16 j_target_origin(ConvertJavaStringToUTF16(env, target_origin)); 1341 base::string16 j_target_origin(ConvertJavaStringToUTF16(env, target_origin));
1341 base::string16 j_message(ConvertJavaStringToUTF16(env, message)); 1342 base::string16 j_message(ConvertJavaStringToUTF16(env, message));
1342 std::vector<int> j_ports; 1343 std::vector<content::MessagePort> j_ports(
1343 1344 content::AppWebMessagePortService::UnwrapJavaArray(env, ports));
1344 if (sent_ports != nullptr)
1345 base::android::JavaIntArrayToIntVector(env, sent_ports, &j_ports);
1346 1345
1347 content::MessagePortProvider::PostMessageToFrame(web_contents_.get(), 1346 content::MessagePortProvider::PostMessageToFrame(web_contents_.get(),
1348 source_origin, 1347 source_origin,
1349 j_target_origin, 1348 j_target_origin,
1350 j_message, 1349 j_message,
1351 j_ports); 1350 j_ports);
1352 } 1351 }
1353 1352
1354 void AwContents::CreateMessageChannel(JNIEnv* env, 1353 void AwContents::CreateMessageChannel(JNIEnv* env,
1355 const JavaParamRef<jobject>& obj, 1354 const JavaParamRef<jobject>& obj,
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after
1442 1441
1443 return Java_AwContents_onRenderProcessGoneDetail(env, obj, 1442 return Java_AwContents_onRenderProcessGoneDetail(env, obj,
1444 child_process_id, crashed); 1443 child_process_id, crashed);
1445 } 1444 }
1446 1445
1447 void AwContents::RenderProcessReady(content::RenderProcessHost* host) { 1446 void AwContents::RenderProcessReady(content::RenderProcessHost* host) {
1448 UpdateRendererPriority(); 1447 UpdateRendererPriority();
1449 } 1448 }
1450 1449
1451 } // namespace android_webview 1450 } // namespace android_webview
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698