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

Unified Diff: android_webview/native/aw_contents.cc

Issue 2375133002: Move MessagePort implementation from android_webview to content (Closed)
Patch Set: rsesek nits and git cl format Created 4 years, 2 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 side-by-side diff with in-line comments
Download patch
« 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 »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: android_webview/native/aw_contents.cc
diff --git a/android_webview/native/aw_contents.cc b/android_webview/native/aw_contents.cc
index 335886a2bfa4fb091a07535e41ac3dfdf59725fd..8132d6b3e364233046b44cf2a8a82c0feff72c6a 100644
--- a/android_webview/native/aw_contents.cc
+++ b/android_webview/native/aw_contents.cc
@@ -26,7 +26,6 @@
#include "android_webview/native/aw_contents_io_thread_client_impl.h"
#include "android_webview/native/aw_contents_lifecycle_notifier.h"
#include "android_webview/native/aw_gl_functor.h"
-#include "android_webview/native/aw_message_port_service_impl.h"
#include "android_webview/native/aw_pdf_exporter.h"
#include "android_webview/native/aw_picture.h"
#include "android_webview/native/aw_web_contents_delegate.h"
@@ -57,6 +56,7 @@
#include "components/autofill/core/browser/autofill_manager.h"
#include "components/autofill/core/browser/webdata/autofill_webdata_service.h"
#include "components/navigation_interception/intercept_navigation_delegate.h"
+#include "content/public/browser/android/app_web_message_port_service.h"
#include "content/public/browser/android/content_view_core.h"
#include "content/public/browser/android/synchronous_compositor.h"
#include "content/public/browser/browser_thread.h"
@@ -1224,15 +1224,9 @@ void AwContents::PostMessageToFrame(JNIEnv* env,
base::string16 j_message(ConvertJavaStringToUTF16(env, message));
std::vector<int> j_ports;
- if (sent_ports != nullptr) {
+ if (sent_ports != nullptr)
base::android::JavaIntArrayToIntVector(env, sent_ports, &j_ports);
- BrowserThread::PostTask(
- BrowserThread::IO,
- FROM_HERE,
- base::Bind(&AwMessagePortServiceImpl::RemoveSentPorts,
- base::Unretained(AwMessagePortServiceImpl::GetInstance()),
- j_ports));
- }
+
content::MessagePortProvider::PostMessageToFrame(web_contents_.get(),
source_origin,
j_target_origin,
@@ -1240,24 +1234,11 @@ void AwContents::PostMessageToFrame(JNIEnv* env,
j_ports);
}
-scoped_refptr<AwMessagePortMessageFilter>
-AwContents::GetMessagePortMessageFilter() {
- // Create a message port message filter if necessary
- if (message_port_message_filter_.get() == nullptr) {
- message_port_message_filter_ =
- new AwMessagePortMessageFilter(
- web_contents_->GetMainFrame()->GetRoutingID());
- web_contents_->GetRenderProcessHost()->AddFilter(
- message_port_message_filter_.get());
- }
- return message_port_message_filter_;
-}
-
void AwContents::CreateMessageChannel(JNIEnv* env,
const JavaParamRef<jobject>& obj,
const JavaParamRef<jobjectArray>& ports) {
- AwMessagePortServiceImpl::GetInstance()->CreateMessageChannel(env, ports,
- GetMessagePortMessageFilter());
+ content::MessagePortProvider::GetAppWebMessagePortService()
+ ->CreateMessageChannel(env, ports, web_contents_.get());
}
void AwContents::GrantFileSchemeAccesstoChildProcess(
« 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