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

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

Issue 2422793002: HTML MessagePort as mojo::MessagePipeHandle (Closed)
Patch Set: Cleanup 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 1131 matching lines...) Expand 10 before | Expand all | Expand 10 after
1213 browser_view_renderer_.TrimMemory(); 1214 browser_view_renderer_.TrimMemory();
1214 } 1215 }
1215 1216
1216 // TODO(sgurun) add support for posting a frame whose name is known (only 1217 // TODO(sgurun) add support for posting a frame whose name is known (only
1217 // main frame is supported at this time, see crbug.com/389721) 1218 // main frame is supported at this time, see crbug.com/389721)
1218 void AwContents::PostMessageToFrame(JNIEnv* env, 1219 void AwContents::PostMessageToFrame(JNIEnv* env,
1219 const JavaParamRef<jobject>& obj, 1220 const JavaParamRef<jobject>& obj,
1220 const JavaParamRef<jstring>& frame_name, 1221 const JavaParamRef<jstring>& frame_name,
1221 const JavaParamRef<jstring>& message, 1222 const JavaParamRef<jstring>& message,
1222 const JavaParamRef<jstring>& target_origin, 1223 const JavaParamRef<jstring>& target_origin,
1223 const JavaParamRef<jintArray>& sent_ports) { 1224 const JavaParamRef<jobjectArray>& ports) {
1224 // Use an empty source origin for android webview. 1225 // Use an empty source origin for android webview.
1225 base::string16 source_origin; 1226 base::string16 source_origin;
1226 base::string16 j_target_origin(ConvertJavaStringToUTF16(env, target_origin)); 1227 base::string16 j_target_origin(ConvertJavaStringToUTF16(env, target_origin));
1227 base::string16 j_message(ConvertJavaStringToUTF16(env, message)); 1228 base::string16 j_message(ConvertJavaStringToUTF16(env, message));
1228 std::vector<int> j_ports; 1229 std::vector<content::MessagePort> j_ports(
1229 1230 content::AppWebMessagePortService::UnwrapJavaArray(env, ports));
1230 if (sent_ports != nullptr)
1231 base::android::JavaIntArrayToIntVector(env, sent_ports, &j_ports);
1232 1231
1233 content::MessagePortProvider::PostMessageToFrame(web_contents_.get(), 1232 content::MessagePortProvider::PostMessageToFrame(web_contents_.get(),
1234 source_origin, 1233 source_origin,
1235 j_target_origin, 1234 j_target_origin,
1236 j_message, 1235 j_message,
1237 j_ports); 1236 j_ports);
1238 } 1237 }
1239 1238
1240 void AwContents::CreateMessageChannel(JNIEnv* env, 1239 void AwContents::CreateMessageChannel(JNIEnv* env,
1241 const JavaParamRef<jobject>& obj, 1240 const JavaParamRef<jobject>& obj,
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
1298 compositor_id.process_id = web_contents_->GetRenderProcessHost()->GetID(); 1297 compositor_id.process_id = web_contents_->GetRenderProcessHost()->GetID();
1299 compositor_id.routing_id = 1298 compositor_id.routing_id =
1300 web_contents_->GetRenderViewHost()->GetRoutingID(); 1299 web_contents_->GetRenderViewHost()->GetRoutingID();
1301 } else { 1300 } else {
1302 LOG(WARNING) << "failed setting the compositor on detaching interstitital"; 1301 LOG(WARNING) << "failed setting the compositor on detaching interstitital";
1303 } 1302 }
1304 browser_view_renderer_.SetActiveCompositorID(compositor_id); 1303 browser_view_renderer_.SetActiveCompositorID(compositor_id);
1305 } 1304 }
1306 1305
1307 } // namespace android_webview 1306 } // namespace android_webview
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698