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

Side by Side Diff: content/browser/web_contents/web_contents_android.cc

Issue 2422793002: HTML MessagePort as mojo::MessagePipeHandle (Closed)
Patch Set: Eliminate unnecessary PostTask 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 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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 "content/browser/web_contents/web_contents_android.h" 5 #include "content/browser/web_contents/web_contents_android.h"
6 6
7 #include <stdint.h> 7 #include <stdint.h>
8 8
9 #include "base/android/jni_android.h" 9 #include "base/android/jni_android.h"
10 #include "base/android/jni_array.h" 10 #include "base/android/jni_array.h"
(...skipping 11 matching lines...) Expand all
22 #include "content/browser/frame_host/interstitial_page_impl.h" 22 #include "content/browser/frame_host/interstitial_page_impl.h"
23 #include "content/browser/media/android/browser_media_player_manager.h" 23 #include "content/browser/media/android/browser_media_player_manager.h"
24 #include "content/browser/media/android/media_web_contents_observer_android.h" 24 #include "content/browser/media/android/media_web_contents_observer_android.h"
25 #include "content/browser/renderer_host/render_view_host_impl.h" 25 #include "content/browser/renderer_host/render_view_host_impl.h"
26 #include "content/browser/web_contents/web_contents_impl.h" 26 #include "content/browser/web_contents/web_contents_impl.h"
27 #include "content/browser/web_contents/web_contents_view_android.h" 27 #include "content/browser/web_contents/web_contents_view_android.h"
28 #include "content/common/devtools_messages.h" 28 #include "content/common/devtools_messages.h"
29 #include "content/common/frame_messages.h" 29 #include "content/common/frame_messages.h"
30 #include "content/common/input_messages.h" 30 #include "content/common/input_messages.h"
31 #include "content/common/view_messages.h" 31 #include "content/common/view_messages.h"
32 #include "content/public/browser/android/app_web_message_port_service.h"
33 #include "content/public/browser/browser_context.h" 32 #include "content/public/browser/browser_context.h"
34 #include "content/public/browser/browser_thread.h" 33 #include "content/public/browser/browser_thread.h"
35 #include "content/public/browser/message_port_provider.h" 34 #include "content/public/browser/message_port_provider.h"
36 #include "content/public/browser/render_widget_host.h" 35 #include "content/public/browser/render_widget_host.h"
37 #include "content/public/browser/web_contents.h" 36 #include "content/public/browser/web_contents.h"
38 #include "content/public/common/content_switches.h" 37 #include "content/public/common/content_switches.h"
39 #include "jni/WebContentsImpl_jni.h" 38 #include "jni/WebContentsImpl_jni.h"
40 #include "net/android/network_library.h" 39 #include "net/android/network_library.h"
41 #include "ui/accessibility/ax_node_data.h" 40 #include "ui/accessibility/ax_node_data.h"
42 #include "ui/android/overscroll_refresh_handler.h" 41 #include "ui/android/overscroll_refresh_handler.h"
(...skipping 515 matching lines...) Expand 10 before | Expand all | Expand 10 after
558 ConvertJavaStringToUTF8(env, message)); 557 ConvertJavaStringToUTF8(env, message));
559 } 558 }
560 559
561 void WebContentsAndroid::PostMessageToFrame( 560 void WebContentsAndroid::PostMessageToFrame(
562 JNIEnv* env, 561 JNIEnv* env,
563 const JavaParamRef<jobject>& obj, 562 const JavaParamRef<jobject>& obj,
564 const JavaParamRef<jstring>& jframe_name, 563 const JavaParamRef<jstring>& jframe_name,
565 const JavaParamRef<jstring>& jmessage, 564 const JavaParamRef<jstring>& jmessage,
566 const JavaParamRef<jstring>& jsource_origin, 565 const JavaParamRef<jstring>& jsource_origin,
567 const JavaParamRef<jstring>& jtarget_origin, 566 const JavaParamRef<jstring>& jtarget_origin,
568 const JavaParamRef<jintArray>& jsent_ports) { 567 const JavaParamRef<jobjectArray>& jports) {
569 base::string16 source_origin(ConvertJavaStringToUTF16(env, jsource_origin));
570 base::string16 target_origin(ConvertJavaStringToUTF16(env, jtarget_origin));
571 base::string16 message(ConvertJavaStringToUTF16(env, jmessage));
572 std::vector<int> ports;
573
574 if (!jsent_ports.is_null())
575 base::android::JavaIntArrayToIntVector(env, jsent_ports, &ports);
576 content::MessagePortProvider::PostMessageToFrame( 568 content::MessagePortProvider::PostMessageToFrame(
577 web_contents_, source_origin, target_origin, message, ports); 569 web_contents_, env, jsource_origin, jtarget_origin, jmessage, jports);
578 }
579
580 void WebContentsAndroid::CreateMessageChannel(
581 JNIEnv* env,
582 const JavaParamRef<jobject>& obj,
583 const JavaParamRef<jobjectArray>& ports) {
584 content::MessagePortProvider::GetAppWebMessagePortService()
585 ->CreateMessageChannel(env, ports, web_contents_);
586 } 570 }
587 571
588 jboolean WebContentsAndroid::HasAccessedInitialDocument( 572 jboolean WebContentsAndroid::HasAccessedInitialDocument(
589 JNIEnv* env, 573 JNIEnv* env,
590 const JavaParamRef<jobject>& jobj) { 574 const JavaParamRef<jobject>& jobj) {
591 return static_cast<WebContentsImpl*>(web_contents_)-> 575 return static_cast<WebContentsImpl*>(web_contents_)->
592 HasAccessedInitialDocument(); 576 HasAccessedInitialDocument();
593 } 577 }
594 578
595 jint WebContentsAndroid::GetThemeColor(JNIEnv* env, 579 jint WebContentsAndroid::GetThemeColor(JNIEnv* env,
(...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after
734 env, obj, callback, id, http_status_code, jurl, jbitmaps, jsizes); 718 env, obj, callback, id, http_status_code, jurl, jbitmaps, jsizes);
735 } 719 }
736 720
737 void WebContentsAndroid::SetMediaSession( 721 void WebContentsAndroid::SetMediaSession(
738 const ScopedJavaLocalRef<jobject>& j_media_session) { 722 const ScopedJavaLocalRef<jobject>& j_media_session) {
739 JNIEnv* env = base::android::AttachCurrentThread(); 723 JNIEnv* env = base::android::AttachCurrentThread();
740 Java_WebContentsImpl_setMediaSession(env, obj_, j_media_session); 724 Java_WebContentsImpl_setMediaSession(env, obj_, j_media_session);
741 } 725 }
742 726
743 } // namespace content 727 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698