| 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" |
| (...skipping 566 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 577 | 577 |
| 578 void AwContents::DocumentHasImages(JNIEnv* env, jobject obj, jobject message) { | 578 void AwContents::DocumentHasImages(JNIEnv* env, jobject obj, jobject message) { |
| 579 ScopedJavaGlobalRef<jobject> j_message; | 579 ScopedJavaGlobalRef<jobject> j_message; |
| 580 j_message.Reset(env, message); | 580 j_message.Reset(env, message); |
| 581 render_view_host_ext_->DocumentHasImages( | 581 render_view_host_ext_->DocumentHasImages( |
| 582 base::Bind(&DocumentHasImagesCallback, j_message)); | 582 base::Bind(&DocumentHasImagesCallback, j_message)); |
| 583 } | 583 } |
| 584 | 584 |
| 585 namespace { | 585 namespace { |
| 586 void GenerateMHTMLCallback(ScopedJavaGlobalRef<jobject>* callback, | 586 void GenerateMHTMLCallback(ScopedJavaGlobalRef<jobject>* callback, |
| 587 const FilePath& path, int64 size) { | 587 const base::FilePath& path, int64 size) { |
| 588 JNIEnv* env = AttachCurrentThread(); | 588 JNIEnv* env = AttachCurrentThread(); |
| 589 // Android files are UTF8, so the path conversion below is safe. | 589 // Android files are UTF8, so the path conversion below is safe. |
| 590 Java_AwContents_generateMHTMLCallback( | 590 Java_AwContents_generateMHTMLCallback( |
| 591 env, | 591 env, |
| 592 ConvertUTF8ToJavaString(env, path.AsUTF8Unsafe()).obj(), | 592 ConvertUTF8ToJavaString(env, path.AsUTF8Unsafe()).obj(), |
| 593 size, callback->obj()); | 593 size, callback->obj()); |
| 594 } | 594 } |
| 595 } // namespace | 595 } // namespace |
| 596 | 596 |
| 597 void AwContents::GenerateMHTML(JNIEnv* env, jobject obj, | 597 void AwContents::GenerateMHTML(JNIEnv* env, jobject obj, |
| 598 jstring jpath, jobject callback) { | 598 jstring jpath, jobject callback) { |
| 599 ScopedJavaGlobalRef<jobject>* j_callback = new ScopedJavaGlobalRef<jobject>(); | 599 ScopedJavaGlobalRef<jobject>* j_callback = new ScopedJavaGlobalRef<jobject>(); |
| 600 j_callback->Reset(env, callback); | 600 j_callback->Reset(env, callback); |
| 601 web_contents_->GenerateMHTML( | 601 web_contents_->GenerateMHTML( |
| 602 FilePath(ConvertJavaStringToUTF8(env, jpath)), | 602 base::FilePath(ConvertJavaStringToUTF8(env, jpath)), |
| 603 base::Bind(&GenerateMHTMLCallback, base::Owned(j_callback))); | 603 base::Bind(&GenerateMHTMLCallback, base::Owned(j_callback))); |
| 604 } | 604 } |
| 605 | 605 |
| 606 void AwContents::RunJavaScriptDialog( | 606 void AwContents::RunJavaScriptDialog( |
| 607 content::JavaScriptMessageType message_type, | 607 content::JavaScriptMessageType message_type, |
| 608 const GURL& origin_url, | 608 const GURL& origin_url, |
| 609 const string16& message_text, | 609 const string16& message_text, |
| 610 const string16& default_prompt_text, | 610 const string16& default_prompt_text, |
| 611 const ScopedJavaLocalRef<jobject>& js_result) { | 611 const ScopedJavaLocalRef<jobject>& js_result) { |
| 612 JNIEnv* env = AttachCurrentThread(); | 612 JNIEnv* env = AttachCurrentThread(); |
| (...skipping 482 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1095 if (!picture) { | 1095 if (!picture) { |
| 1096 render_view_host_ext_->CapturePictureSync(); | 1096 render_view_host_ext_->CapturePictureSync(); |
| 1097 picture = RendererPictureMap::GetInstance()->GetRendererPicture( | 1097 picture = RendererPictureMap::GetInstance()->GetRendererPicture( |
| 1098 web_contents_->GetRoutingID()); | 1098 web_contents_->GetRoutingID()); |
| 1099 } | 1099 } |
| 1100 | 1100 |
| 1101 return picture; | 1101 return picture; |
| 1102 } | 1102 } |
| 1103 | 1103 |
| 1104 } // namespace android_webview | 1104 } // namespace android_webview |
| OLD | NEW |