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

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

Issue 944443003: Step two of optionally sending messages to/from message ports as base::Value. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@n-c-message-as-values-take2
Patch Set: use auto where it makes sense Created 5 years, 9 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 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
53 #include "content/public/browser/android/synchronous_compositor.h" 53 #include "content/public/browser/android/synchronous_compositor.h"
54 #include "content/public/browser/browser_thread.h" 54 #include "content/public/browser/browser_thread.h"
55 #include "content/public/browser/cert_store.h" 55 #include "content/public/browser/cert_store.h"
56 #include "content/public/browser/favicon_status.h" 56 #include "content/public/browser/favicon_status.h"
57 #include "content/public/browser/message_port_provider.h" 57 #include "content/public/browser/message_port_provider.h"
58 #include "content/public/browser/navigation_entry.h" 58 #include "content/public/browser/navigation_entry.h"
59 #include "content/public/browser/render_frame_host.h" 59 #include "content/public/browser/render_frame_host.h"
60 #include "content/public/browser/render_process_host.h" 60 #include "content/public/browser/render_process_host.h"
61 #include "content/public/browser/render_view_host.h" 61 #include "content/public/browser/render_view_host.h"
62 #include "content/public/browser/web_contents.h" 62 #include "content/public/browser/web_contents.h"
63 #include "content/public/common/message_port_types.h"
63 #include "content/public/common/renderer_preferences.h" 64 #include "content/public/common/renderer_preferences.h"
64 #include "content/public/common/ssl_status.h" 65 #include "content/public/common/ssl_status.h"
65 #include "jni/AwContents_jni.h" 66 #include "jni/AwContents_jni.h"
66 #include "net/base/auth.h" 67 #include "net/base/auth.h"
67 #include "net/cert/x509_certificate.h" 68 #include "net/cert/x509_certificate.h"
68 #include "third_party/skia/include/core/SkPicture.h" 69 #include "third_party/skia/include/core/SkPicture.h"
69 #include "ui/gfx/android/java_bitmap.h" 70 #include "ui/gfx/android/java_bitmap.h"
70 #include "ui/gfx/geometry/rect_f.h" 71 #include "ui/gfx/geometry/rect_f.h"
71 #include "ui/gfx/geometry/size.h" 72 #include "ui/gfx/geometry/size.h"
72 #include "ui/gfx/image/image.h" 73 #include "ui/gfx/image/image.h"
(...skipping 1033 matching lines...) Expand 10 before | Expand all | Expand 10 after
1106 1107
1107 if (sent_ports != nullptr) { 1108 if (sent_ports != nullptr) {
1108 base::android::JavaIntArrayToIntVector(env, sent_ports, &j_ports); 1109 base::android::JavaIntArrayToIntVector(env, sent_ports, &j_ports);
1109 BrowserThread::PostTask( 1110 BrowserThread::PostTask(
1110 BrowserThread::IO, 1111 BrowserThread::IO,
1111 FROM_HERE, 1112 FROM_HERE,
1112 base::Bind(&AwMessagePortServiceImpl::RemoveSentPorts, 1113 base::Bind(&AwMessagePortServiceImpl::RemoveSentPorts,
1113 base::Unretained(AwMessagePortServiceImpl::GetInstance()), 1114 base::Unretained(AwMessagePortServiceImpl::GetInstance()),
1114 j_ports)); 1115 j_ports));
1115 } 1116 }
1117 std::vector<content::TransferredMessagePort> ports(j_ports.size());
1118 for (size_t i = 0; i < j_ports.size(); ++i)
1119 ports[i].id = j_ports[i];
1116 content::MessagePortProvider::PostMessageToFrame(web_contents_.get(), 1120 content::MessagePortProvider::PostMessageToFrame(web_contents_.get(),
1117 source_origin, 1121 source_origin,
1118 j_target_origin, 1122 j_target_origin,
1119 j_message, 1123 j_message,
1120 j_ports); 1124 ports);
1121 } 1125 }
1122 1126
1123 scoped_refptr<AwMessagePortMessageFilter> 1127 scoped_refptr<AwMessagePortMessageFilter>
1124 AwContents::GetMessagePortMessageFilter() { 1128 AwContents::GetMessagePortMessageFilter() {
1125 // Create a message port message filter if necessary 1129 // Create a message port message filter if necessary
1126 if (message_port_message_filter_.get() == nullptr) { 1130 if (message_port_message_filter_.get() == nullptr) {
1127 message_port_message_filter_ = 1131 message_port_message_filter_ =
1128 new AwMessagePortMessageFilter( 1132 new AwMessagePortMessageFilter(
1129 web_contents_->GetMainFrame()->GetRoutingID()); 1133 web_contents_->GetMainFrame()->GetRoutingID());
1130 web_contents_->GetRenderProcessHost()->AddFilter( 1134 web_contents_->GetRenderProcessHost()->AddFilter(
1131 message_port_message_filter_.get()); 1135 message_port_message_filter_.get());
1132 } 1136 }
1133 return message_port_message_filter_; 1137 return message_port_message_filter_;
1134 } 1138 }
1135 1139
1136 void AwContents::CreateMessageChannel(JNIEnv* env, jobject obj, 1140 void AwContents::CreateMessageChannel(JNIEnv* env, jobject obj,
1137 jobjectArray ports) { 1141 jobjectArray ports) {
1138 1142
1139 AwMessagePortServiceImpl::GetInstance()->CreateMessageChannel(env, ports, 1143 AwMessagePortServiceImpl::GetInstance()->CreateMessageChannel(env, ports,
1140 GetMessagePortMessageFilter()); 1144 GetMessagePortMessageFilter());
1141 } 1145 }
1142 1146
1143 void SetShouldDownloadFavicons(JNIEnv* env, jclass jclazz) { 1147 void SetShouldDownloadFavicons(JNIEnv* env, jclass jclazz) {
1144 g_should_download_favicons = true; 1148 g_should_download_favicons = true;
1145 } 1149 }
1146 1150
1147 } // namespace android_webview 1151 } // namespace android_webview
OLDNEW
« no previous file with comments | « android_webview/browser/aw_message_port_message_filter.cc ('k') | content/browser/message_port_message_filter.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698