| 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 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 107 | 107 |
| 108 } // namespace | 108 } // namespace |
| 109 | 109 |
| 110 // static | 110 // static |
| 111 AwContents* AwContents::FromWebContents(WebContents* web_contents) { | 111 AwContents* AwContents::FromWebContents(WebContents* web_contents) { |
| 112 return AwContentsUserData::GetContents(web_contents); | 112 return AwContentsUserData::GetContents(web_contents); |
| 113 } | 113 } |
| 114 | 114 |
| 115 AwContents::AwContents(JNIEnv* env, | 115 AwContents::AwContents(JNIEnv* env, |
| 116 jobject obj, | 116 jobject obj, |
| 117 jobject web_contents_delegate, | 117 jobject web_contents_delegate) |
| 118 bool private_browsing) | |
| 119 : java_ref_(env, obj), | 118 : java_ref_(env, obj), |
| 120 web_contents_delegate_( | 119 web_contents_delegate_( |
| 121 new AwWebContentsDelegate(env, web_contents_delegate)), | 120 new AwWebContentsDelegate(env, web_contents_delegate)), |
| 122 view_visible_(false), | 121 view_visible_(false), |
| 123 compositor_visible_(false), | 122 compositor_visible_(false), |
| 124 is_composite_pending_(false), | 123 is_composite_pending_(false), |
| 125 last_scroll_x_(0), last_scroll_y_(0), | 124 last_scroll_x_(0), last_scroll_y_(0), |
| 126 last_frame_context_(NULL) { | 125 last_frame_context_(NULL) { |
| 127 RendererPictureMap::CreateInstance(); | 126 RendererPictureMap::CreateInstance(); |
| 128 android_webview::AwBrowserDependencyFactory* dependency_factory = | 127 android_webview::AwBrowserDependencyFactory* dependency_factory = |
| 129 android_webview::AwBrowserDependencyFactory::GetInstance(); | 128 android_webview::AwBrowserDependencyFactory::GetInstance(); |
| 130 | 129 |
| 131 // TODO(joth): rather than create and set the WebContents here, expose the | 130 // TODO(joth): rather than create and set the WebContents here, expose the |
| 132 // factory method to java side and have that orchestrate the construction | 131 // factory method to java side and have that orchestrate the construction |
| 133 // order. | 132 // order. |
| 134 SetWebContents(dependency_factory->CreateWebContents(private_browsing)); | 133 SetWebContents(dependency_factory->CreateWebContents()); |
| 135 } | 134 } |
| 136 | 135 |
| 137 void AwContents::ResetCompositor() { | 136 void AwContents::ResetCompositor() { |
| 138 compositor_.reset(content::Compositor::Create(this)); | 137 compositor_.reset(content::Compositor::Create(this)); |
| 139 if (scissor_clip_layer_.get()) | 138 if (scissor_clip_layer_.get()) |
| 140 AttachLayerTree(); | 139 AttachLayerTree(); |
| 141 } | 140 } |
| 142 | 141 |
| 143 void AwContents::SetWebContents(content::WebContents* web_contents) { | 142 void AwContents::SetWebContents(content::WebContents* web_contents) { |
| 144 web_contents_.reset(web_contents); | 143 web_contents_.reset(web_contents); |
| (...skipping 459 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 604 jobject obj, | 603 jobject obj, |
| 605 jobject delegate) { | 604 jobject delegate) { |
| 606 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 605 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
| 607 InterceptNavigationDelegate::Associate( | 606 InterceptNavigationDelegate::Associate( |
| 608 web_contents_.get(), | 607 web_contents_.get(), |
| 609 make_scoped_ptr(new InterceptNavigationDelegate(env, delegate))); | 608 make_scoped_ptr(new InterceptNavigationDelegate(env, delegate))); |
| 610 } | 609 } |
| 611 | 610 |
| 612 static jint Init(JNIEnv* env, | 611 static jint Init(JNIEnv* env, |
| 613 jobject obj, | 612 jobject obj, |
| 614 jobject web_contents_delegate, | 613 jobject web_contents_delegate) { |
| 615 jboolean private_browsing) { | 614 AwContents* tab = new AwContents(env, obj, web_contents_delegate); |
| 616 AwContents* tab = new AwContents(env, obj, web_contents_delegate, | |
| 617 private_browsing); | |
| 618 return reinterpret_cast<jint>(tab); | 615 return reinterpret_cast<jint>(tab); |
| 619 } | 616 } |
| 620 | 617 |
| 621 bool RegisterAwContents(JNIEnv* env) { | 618 bool RegisterAwContents(JNIEnv* env) { |
| 622 return RegisterNativesImpl(env) >= 0; | 619 return RegisterNativesImpl(env) >= 0; |
| 623 } | 620 } |
| 624 | 621 |
| 625 jint AwContents::FindAllSync(JNIEnv* env, jobject obj, jstring search_string) { | 622 jint AwContents::FindAllSync(JNIEnv* env, jobject obj, jstring search_string) { |
| 626 return GetFindHelper()->FindAllSync( | 623 return GetFindHelper()->FindAllSync( |
| 627 ConvertJavaStringToUTF16(env, search_string)); | 624 ConvertJavaStringToUTF16(env, search_string)); |
| (...skipping 215 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 843 | 840 |
| 844 void AwContents::OnPictureUpdated(int process_id, int render_view_id) { | 841 void AwContents::OnPictureUpdated(int process_id, int render_view_id) { |
| 845 CHECK_EQ(web_contents_->GetRenderProcessHost()->GetID(), process_id); | 842 CHECK_EQ(web_contents_->GetRenderProcessHost()->GetID(), process_id); |
| 846 if (render_view_id != web_contents_->GetRoutingID()) | 843 if (render_view_id != web_contents_->GetRoutingID()) |
| 847 return; | 844 return; |
| 848 | 845 |
| 849 Invalidate(); | 846 Invalidate(); |
| 850 } | 847 } |
| 851 | 848 |
| 852 } // namespace android_webview | 849 } // namespace android_webview |
| OLD | NEW |