OLD | NEW |
---|---|
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 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 <android/bitmap.h> | 7 #include <android/bitmap.h> |
8 #include <sys/system_properties.h> | 8 #include <sys/system_properties.h> |
9 | 9 |
10 #include "android_webview/browser/aw_browser_context.h" | 10 #include "android_webview/browser/aw_browser_context.h" |
11 #include "android_webview/browser/aw_browser_main_parts.h" | 11 #include "android_webview/browser/aw_browser_main_parts.h" |
12 #include "android_webview/browser/net_disk_cache_remover.h" | 12 #include "android_webview/browser/net_disk_cache_remover.h" |
13 #include "android_webview/browser/renderer_host/aw_render_view_host_ext.h" | 13 #include "android_webview/browser/renderer_host/aw_render_view_host_ext.h" |
14 #include "android_webview/browser/renderer_host/aw_resource_dispatcher_host_dele gate.h" | 14 #include "android_webview/browser/renderer_host/aw_resource_dispatcher_host_dele gate.h" |
15 #include "android_webview/common/aw_hit_test_data.h" | 15 #include "android_webview/common/aw_hit_test_data.h" |
16 #include "android_webview/common/renderer_picture_map.h" | 16 #include "android_webview/common/renderer_picture_map.h" |
17 #include "android_webview/native/aw_browser_dependency_factory.h" | 17 #include "android_webview/native/aw_browser_dependency_factory.h" |
18 #include "android_webview/native/aw_contents_client_bridge.h" | |
18 #include "android_webview/native/aw_contents_io_thread_client_impl.h" | 19 #include "android_webview/native/aw_contents_io_thread_client_impl.h" |
19 #include "android_webview/native/aw_web_contents_delegate.h" | 20 #include "android_webview/native/aw_web_contents_delegate.h" |
20 #include "android_webview/native/state_serializer.h" | 21 #include "android_webview/native/state_serializer.h" |
21 #include "android_webview/public/browser/draw_sw.h" | 22 #include "android_webview/public/browser/draw_sw.h" |
22 #include "base/android/jni_android.h" | 23 #include "base/android/jni_android.h" |
23 #include "base/android/jni_array.h" | 24 #include "base/android/jni_array.h" |
24 #include "base/android/jni_string.h" | 25 #include "base/android/jni_string.h" |
25 #include "base/bind.h" | 26 #include "base/bind.h" |
26 #include "base/callback.h" | 27 #include "base/callback.h" |
27 #include "base/debug/trace_event.h" | 28 #include "base/debug/trace_event.h" |
(...skipping 638 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
666 | 667 |
667 Java_AwContents_performLongClick(env, obj.obj()); | 668 Java_AwContents_performLongClick(env, obj.obj()); |
668 } | 669 } |
669 | 670 |
670 void AwContents::OnReceivedHttpAuthRequest(const JavaRef<jobject>& handler, | 671 void AwContents::OnReceivedHttpAuthRequest(const JavaRef<jobject>& handler, |
671 const std::string& host, | 672 const std::string& host, |
672 const std::string& realm) { | 673 const std::string& realm) { |
673 JNIEnv* env = AttachCurrentThread(); | 674 JNIEnv* env = AttachCurrentThread(); |
674 ScopedJavaLocalRef<jstring> jhost = ConvertUTF8ToJavaString(env, host); | 675 ScopedJavaLocalRef<jstring> jhost = ConvertUTF8ToJavaString(env, host); |
675 ScopedJavaLocalRef<jstring> jrealm = ConvertUTF8ToJavaString(env, realm); | 676 ScopedJavaLocalRef<jstring> jrealm = ConvertUTF8ToJavaString(env, realm); |
676 Java_AwContents_onReceivedHttpAuthRequest(env, java_ref_.get(env).obj(), | 677 Java_AwContents_onReceivedHttpAuthRequest(env, java_ref_.get(env).obj(), |
joth
2013/02/22 02:39:44
stash result in ScopedLocalRef and do null check.
sgurun-gerrit only
2013/02/22 19:31:31
Done.
| |
677 handler.obj(), jhost.obj(), | 678 handler.obj(), jhost.obj(), |
678 jrealm.obj()); | 679 jrealm.obj()); |
679 } | 680 } |
680 | 681 |
681 void AwContents::SetIoThreadClient(JNIEnv* env, jobject obj, jobject client) { | 682 void AwContents::SetIoThreadClient(JNIEnv* env, jobject obj, jobject client) { |
682 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 683 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
683 AwContentsIoThreadClientImpl::Associate( | 684 AwContentsIoThreadClientImpl::Associate( |
684 web_contents_.get(), ScopedJavaLocalRef<jobject>(env, client)); | 685 web_contents_.get(), ScopedJavaLocalRef<jobject>(env, client)); |
685 int child_id = web_contents_->GetRenderProcessHost()->GetID(); | 686 int child_id = web_contents_->GetRenderProcessHost()->GetID(); |
686 int route_id = web_contents_->GetRoutingID(); | 687 int route_id = web_contents_->GetRoutingID(); |
(...skipping 474 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1161 // If not available or not in listener mode get it synchronously. | 1162 // If not available or not in listener mode get it synchronously. |
1162 if (!picture) { | 1163 if (!picture) { |
1163 render_view_host_ext_->CapturePictureSync(); | 1164 render_view_host_ext_->CapturePictureSync(); |
1164 picture = RendererPictureMap::GetInstance()->GetRendererPicture( | 1165 picture = RendererPictureMap::GetInstance()->GetRendererPicture( |
1165 web_contents_->GetRoutingID()); | 1166 web_contents_->GetRoutingID()); |
1166 } | 1167 } |
1167 | 1168 |
1168 return picture; | 1169 return picture; |
1169 } | 1170 } |
1170 | 1171 |
1172 AwContentsClientBridge* AwContents::get_aw_contents_client_bridge() { | |
1173 return contents_client_bridge_.get(); | |
1174 } | |
1175 | |
1176 void AwContents::set_aw_contents_client_bridge( | |
1177 AwContentsClientBridge* bridge) { | |
1178 contents_client_bridge_.reset(bridge); | |
1179 } | |
1180 | |
1171 } // namespace android_webview | 1181 } // namespace android_webview |
OLD | NEW |