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

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

Issue 920873003: Return created channels synchronously (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: disable a test for real and remove a wrong assertion Created 5 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 8
9 #include "android_webview/browser/aw_browser_context.h" 9 #include "android_webview/browser/aw_browser_context.h"
10 #include "android_webview/browser/aw_browser_main_parts.h" 10 #include "android_webview/browser/aw_browser_main_parts.h"
(...skipping 1068 matching lines...) Expand 10 before | Expand all | Expand 10 after
1079 1079
1080 if (sent_ports != nullptr) { 1080 if (sent_ports != nullptr) {
1081 base::android::JavaIntArrayToIntVector(env, sent_ports, &j_ports); 1081 base::android::JavaIntArrayToIntVector(env, sent_ports, &j_ports);
1082 BrowserThread::PostTask( 1082 BrowserThread::PostTask(
1083 BrowserThread::IO, 1083 BrowserThread::IO,
1084 FROM_HERE, 1084 FROM_HERE,
1085 base::Bind(&AwMessagePortServiceImpl::RemoveSentPorts, 1085 base::Bind(&AwMessagePortServiceImpl::RemoveSentPorts,
1086 base::Unretained(AwMessagePortServiceImpl::GetInstance()), 1086 base::Unretained(AwMessagePortServiceImpl::GetInstance()),
1087 j_ports)); 1087 j_ports));
1088 } 1088 }
1089
1090 content::MessagePortProvider::PostMessageToFrame(web_contents_.get(), 1089 content::MessagePortProvider::PostMessageToFrame(web_contents_.get(),
1091 j_source_origin, 1090 j_source_origin,
1092 j_target_origin, 1091 j_target_origin,
1093 j_message, 1092 j_message,
1094 j_ports); 1093 j_ports);
1095 } 1094 }
1096 1095
1097 scoped_refptr<AwMessagePortMessageFilter> 1096 scoped_refptr<AwMessagePortMessageFilter>
1098 AwContents::GetMessagePortMessageFilter() { 1097 AwContents::GetMessagePortMessageFilter() {
1099 // Create a message port message filter if necessary 1098 // Create a message port message filter if necessary
1100 if (message_port_message_filter_.get() == nullptr) { 1099 if (message_port_message_filter_.get() == nullptr) {
1101 message_port_message_filter_ = 1100 message_port_message_filter_ =
1102 new AwMessagePortMessageFilter( 1101 new AwMessagePortMessageFilter(
1103 web_contents_->GetMainFrame()->GetRoutingID()); 1102 web_contents_->GetMainFrame()->GetRoutingID());
1104 web_contents_->GetRenderProcessHost()->AddFilter( 1103 web_contents_->GetRenderProcessHost()->AddFilter(
1105 message_port_message_filter_.get()); 1104 message_port_message_filter_.get());
1106 } 1105 }
1107 return message_port_message_filter_; 1106 return message_port_message_filter_;
1108 } 1107 }
1109 1108
1110 void AwContents::CreateMessageChannel(JNIEnv* env, jobject obj, 1109 void AwContents::CreateMessageChannel(JNIEnv* env, jobject obj,
1111 jobject callback) { 1110 jobjectArray ports) {
1112 1111
1113 AwMessagePortServiceImpl::GetInstance()->CreateMessageChannel(env, callback, 1112 AwMessagePortServiceImpl::GetInstance()->CreateMessageChannel(env, ports,
1114 GetMessagePortMessageFilter()); 1113 GetMessagePortMessageFilter());
1115 } 1114 }
1116 1115
1117 void SetShouldDownloadFavicons(JNIEnv* env, jclass jclazz) { 1116 void SetShouldDownloadFavicons(JNIEnv* env, jclass jclazz) {
1118 g_should_download_favicons = true; 1117 g_should_download_favicons = true;
1119 } 1118 }
1120 1119
1121 } // namespace android_webview 1120 } // namespace android_webview
OLDNEW
« no previous file with comments | « android_webview/native/aw_contents.h ('k') | android_webview/native/aw_message_port_service_impl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698