| OLD | NEW |
| 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 <limits> | 7 #include <limits> |
| 8 | 8 |
| 9 #include "android_webview/browser/aw_browser_context.h" | 9 #include "android_webview/browser/aw_browser_context.h" |
| 10 #include "android_webview/browser/aw_browser_main_parts.h" | 10 #include "android_webview/browser/aw_browser_main_parts.h" |
| (...skipping 167 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 178 AwBrowserPermissionRequestDelegate* AwBrowserPermissionRequestDelegate::FromID( | 178 AwBrowserPermissionRequestDelegate* AwBrowserPermissionRequestDelegate::FromID( |
| 179 int render_process_id, int render_frame_id) { | 179 int render_process_id, int render_frame_id) { |
| 180 AwContents* aw_contents = AwContents::FromWebContents( | 180 AwContents* aw_contents = AwContents::FromWebContents( |
| 181 content::WebContents::FromRenderFrameHost( | 181 content::WebContents::FromRenderFrameHost( |
| 182 content::RenderFrameHost::FromID(render_process_id, | 182 content::RenderFrameHost::FromID(render_process_id, |
| 183 render_frame_id))); | 183 render_frame_id))); |
| 184 return aw_contents; | 184 return aw_contents; |
| 185 } | 185 } |
| 186 | 186 |
| 187 AwContents::AwContents(scoped_ptr<WebContents> web_contents) | 187 AwContents::AwContents(scoped_ptr<WebContents> web_contents) |
| 188 : web_contents_(web_contents.Pass()), | 188 : browser_view_renderer_( |
| 189 browser_view_renderer_( | |
| 190 this, | 189 this, |
| 191 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::UI), | 190 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::UI), |
| 192 base::CommandLine::ForCurrentProcess()->HasSwitch( | 191 base::CommandLine::ForCurrentProcess()->HasSwitch( |
| 193 switches::kDisablePageVisibility)), | 192 switches::kDisablePageVisibility)), |
| 193 web_contents_(web_contents.Pass()), |
| 194 renderer_manager_key_(GLViewRendererManager::GetInstance()->NullKey()) { | 194 renderer_manager_key_(GLViewRendererManager::GetInstance()->NullKey()) { |
| 195 base::subtle::NoBarrier_AtomicIncrement(&g_instance_count, 1); | 195 base::subtle::NoBarrier_AtomicIncrement(&g_instance_count, 1); |
| 196 icon_helper_.reset(new IconHelper(web_contents_.get())); | 196 icon_helper_.reset(new IconHelper(web_contents_.get())); |
| 197 icon_helper_->SetListener(this); | 197 icon_helper_->SetListener(this); |
| 198 web_contents_->SetUserData(android_webview::kAwContentsUserDataKey, | 198 web_contents_->SetUserData(android_webview::kAwContentsUserDataKey, |
| 199 new AwContentsUserData(this)); | 199 new AwContentsUserData(this)); |
| 200 browser_view_renderer_.RegisterWithWebContents(web_contents_.get()); | 200 browser_view_renderer_.RegisterWithWebContents(web_contents_.get()); |
| 201 render_view_host_ext_.reset( | 201 render_view_host_ext_.reset( |
| 202 new AwRenderViewHostExt(this, web_contents_.get())); | 202 new AwRenderViewHostExt(this, web_contents_.get())); |
| 203 | 203 |
| (...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 280 DCHECK_CURRENTLY_ON(BrowserThread::UI); | 280 DCHECK_CURRENTLY_ON(BrowserThread::UI); |
| 281 JNIEnv* env = AttachCurrentThread(); | 281 JNIEnv* env = AttachCurrentThread(); |
| 282 ScopedJavaLocalRef<jobject> obj = java_ref_.get(env); | 282 ScopedJavaLocalRef<jobject> obj = java_ref_.get(env); |
| 283 if (obj.is_null()) | 283 if (obj.is_null()) |
| 284 return; | 284 return; |
| 285 Java_AwContents_setAwAutofillClient(env, obj.obj(), client); | 285 Java_AwContents_setAwAutofillClient(env, obj.obj(), client); |
| 286 } | 286 } |
| 287 | 287 |
| 288 AwContents::~AwContents() { | 288 AwContents::~AwContents() { |
| 289 DCHECK_EQ(this, AwContents::FromWebContents(web_contents_.get())); | 289 DCHECK_EQ(this, AwContents::FromWebContents(web_contents_.get())); |
| 290 content::SynchronousCompositor::SetClientForWebContents(web_contents_.get(), | |
| 291 NULL); | |
| 292 web_contents_->RemoveUserData(kAwContentsUserDataKey); | 290 web_contents_->RemoveUserData(kAwContentsUserDataKey); |
| 293 if (find_helper_.get()) | 291 if (find_helper_.get()) |
| 294 find_helper_->SetListener(NULL); | 292 find_helper_->SetListener(NULL); |
| 295 if (icon_helper_.get()) | 293 if (icon_helper_.get()) |
| 296 icon_helper_->SetListener(NULL); | 294 icon_helper_->SetListener(NULL); |
| 297 base::subtle::NoBarrier_AtomicIncrement(&g_instance_count, -1); | 295 base::subtle::NoBarrier_AtomicIncrement(&g_instance_count, -1); |
| 298 // When the last WebView is destroyed free all discardable memory allocated by | 296 // When the last WebView is destroyed free all discardable memory allocated by |
| 299 // Chromium, because the app process may continue to run for a long time | 297 // Chromium, because the app process may continue to run for a long time |
| 300 // without ever using another WebView. | 298 // without ever using another WebView. |
| 301 if (base::subtle::NoBarrier_Load(&g_instance_count) == 0) { | 299 if (base::subtle::NoBarrier_Load(&g_instance_count) == 0) { |
| (...skipping 921 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1223 content::ChildProcessSecurityPolicy::GetInstance()->GrantScheme( | 1221 content::ChildProcessSecurityPolicy::GetInstance()->GrantScheme( |
| 1224 web_contents_->GetRenderProcessHost()->GetID(), url::kFileScheme); | 1222 web_contents_->GetRenderProcessHost()->GetID(), url::kFileScheme); |
| 1225 } | 1223 } |
| 1226 | 1224 |
| 1227 void SetShouldDownloadFavicons(JNIEnv* env, | 1225 void SetShouldDownloadFavicons(JNIEnv* env, |
| 1228 const JavaParamRef<jclass>& jclazz) { | 1226 const JavaParamRef<jclass>& jclazz) { |
| 1229 g_should_download_favicons = true; | 1227 g_should_download_favicons = true; |
| 1230 } | 1228 } |
| 1231 | 1229 |
| 1232 } // namespace android_webview | 1230 } // namespace android_webview |
| OLD | NEW |