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

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

Issue 22035002: Android WebView: Make a custom Picture subclass (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: endRecording is OK Created 7 years, 4 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 | Annotate | Revision Log
« no previous file with comments | « android_webview/native/aw_contents.h ('k') | android_webview/native/aw_picture.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 "android_webview/browser/aw_browser_context.h" 7 #include "android_webview/browser/aw_browser_context.h"
8 #include "android_webview/browser/aw_browser_main_parts.h" 8 #include "android_webview/browser/aw_browser_main_parts.h"
9 #include "android_webview/browser/gpu_memory_buffer_factory_impl.h" 9 #include "android_webview/browser/gpu_memory_buffer_factory_impl.h"
10 #include "android_webview/browser/in_process_view_renderer.h" 10 #include "android_webview/browser/in_process_view_renderer.h"
11 #include "android_webview/browser/net_disk_cache_remover.h" 11 #include "android_webview/browser/net_disk_cache_remover.h"
12 #include "android_webview/browser/renderer_host/aw_resource_dispatcher_host_dele gate.h" 12 #include "android_webview/browser/renderer_host/aw_resource_dispatcher_host_dele gate.h"
13 #include "android_webview/common/aw_hit_test_data.h" 13 #include "android_webview/common/aw_hit_test_data.h"
14 #include "android_webview/native/aw_autofill_manager_delegate.h" 14 #include "android_webview/native/aw_autofill_manager_delegate.h"
15 #include "android_webview/native/aw_browser_dependency_factory.h" 15 #include "android_webview/native/aw_browser_dependency_factory.h"
16 #include "android_webview/native/aw_contents_client_bridge.h" 16 #include "android_webview/native/aw_contents_client_bridge.h"
17 #include "android_webview/native/aw_contents_io_thread_client_impl.h" 17 #include "android_webview/native/aw_contents_io_thread_client_impl.h"
18 #include "android_webview/native/aw_picture.h"
18 #include "android_webview/native/aw_web_contents_delegate.h" 19 #include "android_webview/native/aw_web_contents_delegate.h"
19 #include "android_webview/native/java_browser_view_renderer_helper.h" 20 #include "android_webview/native/java_browser_view_renderer_helper.h"
20 #include "android_webview/native/state_serializer.h" 21 #include "android_webview/native/state_serializer.h"
21 #include "android_webview/public/browser/draw_gl.h" 22 #include "android_webview/public/browser/draw_gl.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/android/scoped_java_ref.h" 26 #include "base/android/scoped_java_ref.h"
26 #include "base/atomicops.h" 27 #include "base/atomicops.h"
27 #include "base/bind.h" 28 #include "base/bind.h"
(...skipping 10 matching lines...) Expand all
38 #include "content/public/browser/browser_thread.h" 39 #include "content/public/browser/browser_thread.h"
39 #include "content/public/browser/cert_store.h" 40 #include "content/public/browser/cert_store.h"
40 #include "content/public/browser/favicon_status.h" 41 #include "content/public/browser/favicon_status.h"
41 #include "content/public/browser/navigation_entry.h" 42 #include "content/public/browser/navigation_entry.h"
42 #include "content/public/browser/render_process_host.h" 43 #include "content/public/browser/render_process_host.h"
43 #include "content/public/browser/render_view_host.h" 44 #include "content/public/browser/render_view_host.h"
44 #include "content/public/browser/web_contents.h" 45 #include "content/public/browser/web_contents.h"
45 #include "content/public/common/ssl_status.h" 46 #include "content/public/common/ssl_status.h"
46 #include "jni/AwContents_jni.h" 47 #include "jni/AwContents_jni.h"
47 #include "net/cert/x509_certificate.h" 48 #include "net/cert/x509_certificate.h"
49 #include "third_party/skia/include/core/SkPicture.h"
48 #include "ui/base/l10n/l10n_util_android.h" 50 #include "ui/base/l10n/l10n_util_android.h"
49 #include "ui/gfx/android/java_bitmap.h" 51 #include "ui/gfx/android/java_bitmap.h"
50 #include "ui/gfx/image/image.h" 52 #include "ui/gfx/image/image.h"
51 53
52 struct AwDrawSWFunctionTable; 54 struct AwDrawSWFunctionTable;
53 struct AwDrawGLFunctionTable; 55 struct AwDrawGLFunctionTable;
54 56
55 using autofill::AutofillDriverImpl; 57 using autofill::AutofillDriverImpl;
56 using autofill::AutofillManager; 58 using autofill::AutofillManager;
57 using base::android::AttachCurrentThread; 59 using base::android::AttachCurrentThread;
(...skipping 19 matching lines...) Expand all
77 reinterpret_cast<android_webview::BrowserViewRenderer*>(view_context)->DrawGL( 79 reinterpret_cast<android_webview::BrowserViewRenderer*>(view_context)->DrawGL(
78 draw_info); 80 draw_info);
79 } 81 }
80 } 82 }
81 83
82 namespace android_webview { 84 namespace android_webview {
83 85
84 namespace { 86 namespace {
85 87
86 JavaBrowserViewRendererHelper* java_renderer_helper() { 88 JavaBrowserViewRendererHelper* java_renderer_helper() {
87 static JavaBrowserViewRendererHelper* g_instance 89 return JavaBrowserViewRendererHelper::GetInstance();
88 = new JavaBrowserViewRendererHelper;
89 return g_instance;
90 } 90 }
91 91
92 const void* kAwContentsUserDataKey = &kAwContentsUserDataKey; 92 const void* kAwContentsUserDataKey = &kAwContentsUserDataKey;
93 93
94 class AwContentsUserData : public base::SupportsUserData::Data { 94 class AwContentsUserData : public base::SupportsUserData::Data {
95 public: 95 public:
96 AwContentsUserData(AwContents* ptr) : contents_(ptr) {} 96 AwContentsUserData(AwContents* ptr) : contents_(ptr) {}
97 97
98 static AwContents* GetContents(WebContents* web_contents) { 98 static AwContents* GetContents(WebContents* web_contents) {
99 if (!web_contents) 99 if (!web_contents)
(...skipping 651 matching lines...) Expand 10 before | Expand all | Expand 10 after
751 751
752 void AwContents::OnWebLayoutPageScaleFactorChanged(float page_scale_factor) { 752 void AwContents::OnWebLayoutPageScaleFactorChanged(float page_scale_factor) {
753 JNIEnv* env = AttachCurrentThread(); 753 JNIEnv* env = AttachCurrentThread();
754 ScopedJavaLocalRef<jobject> obj = java_ref_.get(env); 754 ScopedJavaLocalRef<jobject> obj = java_ref_.get(env);
755 if (obj.is_null()) 755 if (obj.is_null())
756 return; 756 return;
757 Java_AwContents_onWebLayoutPageScaleFactorChanged(env, obj.obj(), 757 Java_AwContents_onWebLayoutPageScaleFactorChanged(env, obj.obj(),
758 page_scale_factor); 758 page_scale_factor);
759 } 759 }
760 760
761 ScopedJavaLocalRef<jobject> AwContents::CapturePicture(JNIEnv* env, 761 jint AwContents::CapturePicture(JNIEnv* env,
762 jobject obj, 762 jobject obj,
763 int width, 763 int width,
764 int height) { 764 int height) {
765 return browser_view_renderer_->CapturePicture(width, height); 765 return reinterpret_cast<jint>(new AwPicture(
766 browser_view_renderer_->CapturePicture(width, height)));
766 } 767 }
767 768
768 void AwContents::EnableOnNewPicture(JNIEnv* env, 769 void AwContents::EnableOnNewPicture(JNIEnv* env,
769 jobject obj, 770 jobject obj,
770 jboolean enabled) { 771 jboolean enabled) {
771 browser_view_renderer_->EnableOnNewPicture(enabled); 772 browser_view_renderer_->EnableOnNewPicture(enabled);
772 } 773 }
773 774
774 } // namespace android_webview 775 } // namespace android_webview
OLDNEW
« no previous file with comments | « android_webview/native/aw_contents.h ('k') | android_webview/native/aw_picture.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698