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

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

Issue 2422793002: HTML MessagePort as mojo::MessagePipeHandle (Closed)
Patch Set: Add missing ScopedAsyncTaskScheduler instance for the new unit tests; required by a recent change t… 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 524 matching lines...) Expand 10 before | Expand all | Expand 10 after
567 ConvertJavaStringToUTF8(env, message)); 566 ConvertJavaStringToUTF8(env, message));
568 } 567 }
569 568
570 void WebContentsAndroid::PostMessageToFrame( 569 void WebContentsAndroid::PostMessageToFrame(
571 JNIEnv* env, 570 JNIEnv* env,
572 const JavaParamRef<jobject>& obj, 571 const JavaParamRef<jobject>& obj,
573 const JavaParamRef<jstring>& jframe_name, 572 const JavaParamRef<jstring>& jframe_name,
574 const JavaParamRef<jstring>& jmessage, 573 const JavaParamRef<jstring>& jmessage,
575 const JavaParamRef<jstring>& jsource_origin, 574 const JavaParamRef<jstring>& jsource_origin,
576 const JavaParamRef<jstring>& jtarget_origin, 575 const JavaParamRef<jstring>& jtarget_origin,
577 const JavaParamRef<jintArray>& jsent_ports) { 576 const JavaParamRef<jobjectArray>& jports) {
578 base::string16 source_origin(ConvertJavaStringToUTF16(env, jsource_origin));
579 base::string16 target_origin(ConvertJavaStringToUTF16(env, jtarget_origin));
580 base::string16 message(ConvertJavaStringToUTF16(env, jmessage));
581 std::vector<int> ports;
582
583 if (!jsent_ports.is_null())
584 base::android::JavaIntArrayToIntVector(env, jsent_ports, &ports);
585 content::MessagePortProvider::PostMessageToFrame( 577 content::MessagePortProvider::PostMessageToFrame(
586 web_contents_, source_origin, target_origin, message, ports); 578 web_contents_, env, jsource_origin, jtarget_origin, jmessage, jports);
587 }
588
589 void WebContentsAndroid::CreateMessageChannel(
590 JNIEnv* env,
591 const JavaParamRef<jobject>& obj,
592 const JavaParamRef<jobjectArray>& ports) {
593 content::MessagePortProvider::GetAppWebMessagePortService()
594 ->CreateMessageChannel(env, ports, web_contents_);
595 } 579 }
596 580
597 jboolean WebContentsAndroid::HasAccessedInitialDocument( 581 jboolean WebContentsAndroid::HasAccessedInitialDocument(
598 JNIEnv* env, 582 JNIEnv* env,
599 const JavaParamRef<jobject>& jobj) { 583 const JavaParamRef<jobject>& jobj) {
600 return static_cast<WebContentsImpl*>(web_contents_)-> 584 return static_cast<WebContentsImpl*>(web_contents_)->
601 HasAccessedInitialDocument(); 585 HasAccessedInitialDocument();
602 } 586 }
603 587
604 jint WebContentsAndroid::GetThemeColor(JNIEnv* env, 588 jint WebContentsAndroid::GetThemeColor(JNIEnv* env,
(...skipping 158 matching lines...) Expand 10 before | Expand all | Expand 10 after
763 env, obj, callback, id, http_status_code, jurl, jbitmaps, jsizes); 747 env, obj, callback, id, http_status_code, jurl, jbitmaps, jsizes);
764 } 748 }
765 749
766 void WebContentsAndroid::SetMediaSession( 750 void WebContentsAndroid::SetMediaSession(
767 const ScopedJavaLocalRef<jobject>& j_media_session) { 751 const ScopedJavaLocalRef<jobject>& j_media_session) {
768 JNIEnv* env = base::android::AttachCurrentThread(); 752 JNIEnv* env = base::android::AttachCurrentThread();
769 Java_WebContentsImpl_setMediaSession(env, obj_, j_media_session); 753 Java_WebContentsImpl_setMediaSession(env, obj_, j_media_session);
770 } 754 }
771 755
772 } // namespace content 756 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/web_contents/web_contents_android.h ('k') | content/browser/web_contents/web_contents_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698