| 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 <sys/system_properties.h> | 7 #include <sys/system_properties.h> |
| 8 | 8 |
| 9 #include "android_webview/browser/aw_browser_main_parts.h" | 9 #include "android_webview/browser/aw_browser_main_parts.h" |
| 10 #include "android_webview/browser/net_disk_cache_remover.h" | 10 #include "android_webview/browser/net_disk_cache_remover.h" |
| (...skipping 452 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 463 g_draw_sw_functions = | 463 g_draw_sw_functions = |
| 464 reinterpret_cast<AwDrawSWFunctionTable*>(function_table); | 464 reinterpret_cast<AwDrawSWFunctionTable*>(function_table); |
| 465 } | 465 } |
| 466 | 466 |
| 467 // static | 467 // static |
| 468 jint GetAwDrawGLFunction(JNIEnv* env, jclass) { | 468 jint GetAwDrawGLFunction(JNIEnv* env, jclass) { |
| 469 return reinterpret_cast<jint>(&DrawGLFunction); | 469 return reinterpret_cast<jint>(&DrawGLFunction); |
| 470 } | 470 } |
| 471 | 471 |
| 472 namespace { | 472 namespace { |
| 473 // |message| is passed as base::Owned, so it will automatically be deleted | 473 void DocumentHasImagesCallback(const ScopedJavaGlobalRef<jobject>& message, |
| 474 // when the callback goes out of scope. | |
| 475 void DocumentHasImagesCallback(ScopedJavaGlobalRef<jobject>* message, | |
| 476 bool has_images) { | 474 bool has_images) { |
| 477 Java_AwContents_onDocumentHasImagesResponse(AttachCurrentThread(), | 475 Java_AwContents_onDocumentHasImagesResponse(AttachCurrentThread(), |
| 478 has_images, | 476 has_images, |
| 479 message->obj()); | 477 message.obj()); |
| 480 } | 478 } |
| 481 } // namespace | 479 } // namespace |
| 482 | 480 |
| 483 void AwContents::DocumentHasImages(JNIEnv* env, jobject obj, jobject message) { | 481 void AwContents::DocumentHasImages(JNIEnv* env, jobject obj, jobject message) { |
| 484 ScopedJavaGlobalRef<jobject>* j_message = new ScopedJavaGlobalRef<jobject>(); | 482 ScopedJavaGlobalRef<jobject> j_message; |
| 485 j_message->Reset(env, message); | 483 j_message.Reset(env, message); |
| 486 render_view_host_ext_->DocumentHasImages( | 484 render_view_host_ext_->DocumentHasImages( |
| 487 base::Bind(&DocumentHasImagesCallback, base::Owned(j_message))); | 485 base::Bind(&DocumentHasImagesCallback, j_message)); |
| 488 } | 486 } |
| 489 | 487 |
| 490 namespace { | 488 namespace { |
| 491 void GenerateMHTMLCallback(ScopedJavaGlobalRef<jobject>* callback, | 489 void GenerateMHTMLCallback(ScopedJavaGlobalRef<jobject>* callback, |
| 492 const FilePath& path, int64 size) { | 490 const FilePath& path, int64 size) { |
| 493 JNIEnv* env = AttachCurrentThread(); | 491 JNIEnv* env = AttachCurrentThread(); |
| 494 // Android files are UTF8, so the path conversion below is safe. | 492 // Android files are UTF8, so the path conversion below is safe. |
| 495 Java_AwContents_generateMHTMLCallback( | 493 Java_AwContents_generateMHTMLCallback( |
| 496 env, | 494 env, |
| 497 ConvertUTF8ToJavaString(env, path.AsUTF8Unsafe()).obj(), | 495 ConvertUTF8ToJavaString(env, path.AsUTF8Unsafe()).obj(), |
| (...skipping 354 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 852 CHECK_EQ(web_contents_->GetRenderProcessHost()->GetID(), process_id); | 850 CHECK_EQ(web_contents_->GetRenderProcessHost()->GetID(), process_id); |
| 853 if (render_view_id != web_contents_->GetRoutingID()) | 851 if (render_view_id != web_contents_->GetRoutingID()) |
| 854 return; | 852 return; |
| 855 | 853 |
| 856 // TODO(leandrogracia): delete when sw rendering uses Ubercompositor. | 854 // TODO(leandrogracia): delete when sw rendering uses Ubercompositor. |
| 857 // Invalidation should be provided by the compositor only. | 855 // Invalidation should be provided by the compositor only. |
| 858 Invalidate(); | 856 Invalidate(); |
| 859 } | 857 } |
| 860 | 858 |
| 861 } // namespace android_webview | 859 } // namespace android_webview |
| OLD | NEW |