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

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

Issue 2422793002: HTML MessagePort as mojo::MessagePipeHandle (Closed)
Patch Set: Rebase Created 3 years, 11 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 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
62 #include "content/public/browser/child_process_security_policy.h" 62 #include "content/public/browser/child_process_security_policy.h"
63 #include "content/public/browser/favicon_status.h" 63 #include "content/public/browser/favicon_status.h"
64 #include "content/public/browser/interstitial_page.h" 64 #include "content/public/browser/interstitial_page.h"
65 #include "content/public/browser/message_port_provider.h" 65 #include "content/public/browser/message_port_provider.h"
66 #include "content/public/browser/navigation_entry.h" 66 #include "content/public/browser/navigation_entry.h"
67 #include "content/public/browser/render_frame_host.h" 67 #include "content/public/browser/render_frame_host.h"
68 #include "content/public/browser/render_process_host.h" 68 #include "content/public/browser/render_process_host.h"
69 #include "content/public/browser/render_view_host.h" 69 #include "content/public/browser/render_view_host.h"
70 #include "content/public/browser/ssl_status.h" 70 #include "content/public/browser/ssl_status.h"
71 #include "content/public/browser/web_contents.h" 71 #include "content/public/browser/web_contents.h"
72 #include "content/public/common/message_port.h"
72 #include "content/public/common/mhtml_generation_params.h" 73 #include "content/public/common/mhtml_generation_params.h"
73 #include "content/public/common/renderer_preferences.h" 74 #include "content/public/common/renderer_preferences.h"
74 #include "jni/AwContents_jni.h" 75 #include "jni/AwContents_jni.h"
75 #include "net/base/auth.h" 76 #include "net/base/auth.h"
76 #include "net/cert/x509_certificate.h" 77 #include "net/cert/x509_certificate.h"
77 #include "third_party/skia/include/core/SkPicture.h" 78 #include "third_party/skia/include/core/SkPicture.h"
78 #include "ui/gfx/android/java_bitmap.h" 79 #include "ui/gfx/android/java_bitmap.h"
79 #include "ui/gfx/geometry/rect_f.h" 80 #include "ui/gfx/geometry/rect_f.h"
80 #include "ui/gfx/geometry/size.h" 81 #include "ui/gfx/geometry/size.h"
81 #include "ui/gfx/image/image.h" 82 #include "ui/gfx/image/image.h"
(...skipping 1144 matching lines...) Expand 10 before | Expand all | Expand 10 after
1226 browser_view_renderer_.TrimMemory(); 1227 browser_view_renderer_.TrimMemory();
1227 } 1228 }
1228 1229
1229 // TODO(sgurun) add support for posting a frame whose name is known (only 1230 // TODO(sgurun) add support for posting a frame whose name is known (only
1230 // main frame is supported at this time, see crbug.com/389721) 1231 // main frame is supported at this time, see crbug.com/389721)
1231 void AwContents::PostMessageToFrame(JNIEnv* env, 1232 void AwContents::PostMessageToFrame(JNIEnv* env,
1232 const JavaParamRef<jobject>& obj, 1233 const JavaParamRef<jobject>& obj,
1233 const JavaParamRef<jstring>& frame_name, 1234 const JavaParamRef<jstring>& frame_name,
1234 const JavaParamRef<jstring>& message, 1235 const JavaParamRef<jstring>& message,
1235 const JavaParamRef<jstring>& target_origin, 1236 const JavaParamRef<jstring>& target_origin,
1236 const JavaParamRef<jintArray>& sent_ports) { 1237 const JavaParamRef<jobjectArray>& ports) {
1237 // Use an empty source origin for android webview. 1238 // Use an empty source origin for android webview.
1238 base::string16 source_origin; 1239 base::string16 source_origin;
1239 base::string16 j_target_origin(ConvertJavaStringToUTF16(env, target_origin)); 1240 base::string16 j_target_origin(ConvertJavaStringToUTF16(env, target_origin));
1240 base::string16 j_message(ConvertJavaStringToUTF16(env, message)); 1241 base::string16 j_message(ConvertJavaStringToUTF16(env, message));
1241 std::vector<int> j_ports; 1242 std::vector<content::MessagePort> j_ports(
1242 1243 content::AppWebMessagePortService::UnwrapJavaArray(env, ports));
1243 if (sent_ports != nullptr)
1244 base::android::JavaIntArrayToIntVector(env, sent_ports, &j_ports);
1245 1244
1246 content::MessagePortProvider::PostMessageToFrame(web_contents_.get(), 1245 content::MessagePortProvider::PostMessageToFrame(web_contents_.get(),
1247 source_origin, 1246 source_origin,
1248 j_target_origin, 1247 j_target_origin,
1249 j_message, 1248 j_message,
1250 j_ports); 1249 j_ports);
1251 } 1250 }
1252 1251
1253 void AwContents::CreateMessageChannel(JNIEnv* env, 1252 void AwContents::CreateMessageChannel(JNIEnv* env,
1254 const JavaParamRef<jobject>& obj, 1253 const JavaParamRef<jobject>& obj,
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after
1337 JNIEnv* env = AttachCurrentThread(); 1336 JNIEnv* env = AttachCurrentThread();
1338 ScopedJavaLocalRef<jobject> obj = java_ref_.get(env); 1337 ScopedJavaLocalRef<jobject> obj = java_ref_.get(env);
1339 if (obj.is_null()) 1338 if (obj.is_null())
1340 return false; 1339 return false;
1341 1340
1342 return Java_AwContents_onRenderProcessGoneDetail(env, obj, 1341 return Java_AwContents_onRenderProcessGoneDetail(env, obj,
1343 child_process_id, crashed); 1342 child_process_id, crashed);
1344 } 1343 }
1345 1344
1346 } // namespace android_webview 1345 } // namespace android_webview
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698