| OLD | NEW |
| 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 #include <utility> | 8 #include <utility> |
| 9 | 9 |
| 10 #include "android_webview/browser/aw_browser_context.h" | 10 #include "android_webview/browser/aw_browser_context.h" |
| (...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 62 #include "content/public/browser/child_process_security_policy.h" | 62 #include "content/public/browser/child_process_security_policy.h" |
| 63 #include "content/public/browser/favicon_status.h" | 63 #include "content/public/browser/favicon_status.h" |
| 64 #include "content/public/browser/interstitial_page.h" | 64 #include "content/public/browser/interstitial_page.h" |
| 65 #include "content/public/browser/message_port_provider.h" | 65 #include "content/public/browser/message_port_provider.h" |
| 66 #include "content/public/browser/navigation_entry.h" | 66 #include "content/public/browser/navigation_entry.h" |
| 67 #include "content/public/browser/render_frame_host.h" | 67 #include "content/public/browser/render_frame_host.h" |
| 68 #include "content/public/browser/render_process_host.h" | 68 #include "content/public/browser/render_process_host.h" |
| 69 #include "content/public/browser/render_view_host.h" | 69 #include "content/public/browser/render_view_host.h" |
| 70 #include "content/public/browser/ssl_status.h" | 70 #include "content/public/browser/ssl_status.h" |
| 71 #include "content/public/browser/web_contents.h" | 71 #include "content/public/browser/web_contents.h" |
| 72 #include "content/public/common/message_port.h" |
| 72 #include "content/public/common/mhtml_generation_params.h" | 73 #include "content/public/common/mhtml_generation_params.h" |
| 73 #include "content/public/common/renderer_preferences.h" | 74 #include "content/public/common/renderer_preferences.h" |
| 74 #include "jni/AwContents_jni.h" | 75 #include "jni/AwContents_jni.h" |
| 75 #include "net/base/auth.h" | 76 #include "net/base/auth.h" |
| 76 #include "net/cert/x509_certificate.h" | 77 #include "net/cert/x509_certificate.h" |
| 77 #include "third_party/skia/include/core/SkPicture.h" | 78 #include "third_party/skia/include/core/SkPicture.h" |
| 78 #include "ui/gfx/android/java_bitmap.h" | 79 #include "ui/gfx/android/java_bitmap.h" |
| 79 #include "ui/gfx/geometry/rect_f.h" | 80 #include "ui/gfx/geometry/rect_f.h" |
| 80 #include "ui/gfx/geometry/size.h" | 81 #include "ui/gfx/geometry/size.h" |
| 81 #include "ui/gfx/image/image.h" | 82 #include "ui/gfx/image/image.h" |
| (...skipping 1138 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1220 browser_view_renderer_.TrimMemory(); | 1221 browser_view_renderer_.TrimMemory(); |
| 1221 } | 1222 } |
| 1222 | 1223 |
| 1223 // TODO(sgurun) add support for posting a frame whose name is known (only | 1224 // TODO(sgurun) add support for posting a frame whose name is known (only |
| 1224 // main frame is supported at this time, see crbug.com/389721) | 1225 // main frame is supported at this time, see crbug.com/389721) |
| 1225 void AwContents::PostMessageToFrame(JNIEnv* env, | 1226 void AwContents::PostMessageToFrame(JNIEnv* env, |
| 1226 const JavaParamRef<jobject>& obj, | 1227 const JavaParamRef<jobject>& obj, |
| 1227 const JavaParamRef<jstring>& frame_name, | 1228 const JavaParamRef<jstring>& frame_name, |
| 1228 const JavaParamRef<jstring>& message, | 1229 const JavaParamRef<jstring>& message, |
| 1229 const JavaParamRef<jstring>& target_origin, | 1230 const JavaParamRef<jstring>& target_origin, |
| 1230 const JavaParamRef<jintArray>& sent_ports) { | 1231 const JavaParamRef<jobjectArray>& ports) { |
| 1231 // Use an empty source origin for android webview. | 1232 // Use an empty source origin for android webview. |
| 1232 base::string16 source_origin; | 1233 base::string16 source_origin; |
| 1233 base::string16 j_target_origin(ConvertJavaStringToUTF16(env, target_origin)); | 1234 base::string16 j_target_origin(ConvertJavaStringToUTF16(env, target_origin)); |
| 1234 base::string16 j_message(ConvertJavaStringToUTF16(env, message)); | 1235 base::string16 j_message(ConvertJavaStringToUTF16(env, message)); |
| 1235 std::vector<int> j_ports; | 1236 std::vector<content::MessagePort> j_ports( |
| 1236 | 1237 content::AppWebMessagePortService::UnwrapJavaArray(env, ports)); |
| 1237 if (sent_ports != nullptr) | |
| 1238 base::android::JavaIntArrayToIntVector(env, sent_ports, &j_ports); | |
| 1239 | 1238 |
| 1240 content::MessagePortProvider::PostMessageToFrame(web_contents_.get(), | 1239 content::MessagePortProvider::PostMessageToFrame(web_contents_.get(), |
| 1241 source_origin, | 1240 source_origin, |
| 1242 j_target_origin, | 1241 j_target_origin, |
| 1243 j_message, | 1242 j_message, |
| 1244 j_ports); | 1243 j_ports); |
| 1245 } | 1244 } |
| 1246 | 1245 |
| 1247 void AwContents::CreateMessageChannel(JNIEnv* env, | 1246 void AwContents::CreateMessageChannel(JNIEnv* env, |
| 1248 const JavaParamRef<jobject>& obj, | 1247 const JavaParamRef<jobject>& obj, |
| (...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1309 | 1308 |
| 1310 bool AwContents::CanShowInterstitial() { | 1309 bool AwContents::CanShowInterstitial() { |
| 1311 JNIEnv* env = AttachCurrentThread(); | 1310 JNIEnv* env = AttachCurrentThread(); |
| 1312 const ScopedJavaLocalRef<jobject> obj = java_ref_.get(env); | 1311 const ScopedJavaLocalRef<jobject> obj = java_ref_.get(env); |
| 1313 if (obj.is_null()) | 1312 if (obj.is_null()) |
| 1314 return false; | 1313 return false; |
| 1315 return Java_AwContents_canShowInterstitial(env, obj); | 1314 return Java_AwContents_canShowInterstitial(env, obj); |
| 1316 } | 1315 } |
| 1317 | 1316 |
| 1318 } // namespace android_webview | 1317 } // namespace android_webview |
| OLD | NEW |