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 267 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
278 } | 278 } |
279 | 279 |
280 jlong AwContents::GetWebContents(JNIEnv* env, jobject obj) { | 280 jlong AwContents::GetWebContents(JNIEnv* env, jobject obj) { |
281 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 281 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
282 DCHECK(web_contents_); | 282 DCHECK(web_contents_); |
283 return reinterpret_cast<intptr_t>(web_contents_.get()); | 283 return reinterpret_cast<intptr_t>(web_contents_.get()); |
284 } | 284 } |
285 | 285 |
286 void AwContents::Destroy(JNIEnv* env, jobject obj) { | 286 void AwContents::Destroy(JNIEnv* env, jobject obj) { |
287 java_ref_.reset(); | 287 java_ref_.reset(); |
| 288 |
| 289 // We clear the contents_client_bridge_ here so that we break the link with |
| 290 // the java peer. This is important for the popup window case, where we are |
| 291 // swapping AwContents out that share the same java AwContentsClientBridge. |
| 292 // See b/15074651. |
| 293 contents_client_bridge_.reset(); |
| 294 |
288 // We do not delete AwContents immediately. Some applications try to delete | 295 // We do not delete AwContents immediately. Some applications try to delete |
289 // Webview in ShouldOverrideUrlLoading callback, which is a sync IPC from | 296 // Webview in ShouldOverrideUrlLoading callback, which is a sync IPC from |
290 // Webkit. | 297 // Webkit. |
291 BrowserThread::DeleteSoon(BrowserThread::UI, FROM_HERE, this); | 298 BrowserThread::DeleteSoon(BrowserThread::UI, FROM_HERE, this); |
292 } | 299 } |
293 | 300 |
294 static jlong Init(JNIEnv* env, jclass, jobject browser_context) { | 301 static jlong Init(JNIEnv* env, jclass, jobject browser_context) { |
295 // TODO(joth): Use |browser_context| to get the native BrowserContext, rather | 302 // TODO(joth): Use |browser_context| to get the native BrowserContext, rather |
296 // than hard-code the default instance lookup here. | 303 // than hard-code the default instance lookup here. |
297 scoped_ptr<WebContents> web_contents(content::WebContents::Create( | 304 scoped_ptr<WebContents> web_contents(content::WebContents::Create( |
(...skipping 797 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1095 return; | 1102 return; |
1096 | 1103 |
1097 browser_view_renderer_.TrimMemory(level, visible); | 1104 browser_view_renderer_.TrimMemory(level, visible); |
1098 } | 1105 } |
1099 | 1106 |
1100 void SetShouldDownloadFavicons(JNIEnv* env, jclass jclazz) { | 1107 void SetShouldDownloadFavicons(JNIEnv* env, jclass jclazz) { |
1101 g_should_download_favicons = true; | 1108 g_should_download_favicons = true; |
1102 } | 1109 } |
1103 | 1110 |
1104 } // namespace android_webview | 1111 } // namespace android_webview |
OLD | NEW |