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 #include <utility> |
8 | 9 |
9 #include "android_webview/browser/aw_browser_context.h" | 10 #include "android_webview/browser/aw_browser_context.h" |
10 #include "android_webview/browser/aw_browser_main_parts.h" | 11 #include "android_webview/browser/aw_browser_main_parts.h" |
11 #include "android_webview/browser/aw_resource_context.h" | 12 #include "android_webview/browser/aw_resource_context.h" |
12 #include "android_webview/browser/browser_view_renderer.h" | 13 #include "android_webview/browser/browser_view_renderer.h" |
13 #include "android_webview/browser/deferred_gpu_command_service.h" | 14 #include "android_webview/browser/deferred_gpu_command_service.h" |
14 #include "android_webview/browser/net_disk_cache_remover.h" | 15 #include "android_webview/browser/net_disk_cache_remover.h" |
15 #include "android_webview/browser/renderer_host/aw_resource_dispatcher_host_dele
gate.h" | 16 #include "android_webview/browser/renderer_host/aw_resource_dispatcher_host_dele
gate.h" |
16 #include "android_webview/browser/scoped_app_gl_state_restore.h" | 17 #include "android_webview/browser/scoped_app_gl_state_restore.h" |
17 #include "android_webview/browser/shared_renderer_state.h" | 18 #include "android_webview/browser/shared_renderer_state.h" |
(...skipping 165 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
183 render_frame_id))); | 184 render_frame_id))); |
184 return aw_contents; | 185 return aw_contents; |
185 } | 186 } |
186 | 187 |
187 AwContents::AwContents(scoped_ptr<WebContents> web_contents) | 188 AwContents::AwContents(scoped_ptr<WebContents> web_contents) |
188 : browser_view_renderer_( | 189 : browser_view_renderer_( |
189 this, | 190 this, |
190 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::UI), | 191 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::UI), |
191 base::CommandLine::ForCurrentProcess()->HasSwitch( | 192 base::CommandLine::ForCurrentProcess()->HasSwitch( |
192 switches::kDisablePageVisibility)), | 193 switches::kDisablePageVisibility)), |
193 web_contents_(web_contents.Pass()), | 194 web_contents_(std::move(web_contents)), |
194 renderer_manager_key_(GLViewRendererManager::GetInstance()->NullKey()) { | 195 renderer_manager_key_(GLViewRendererManager::GetInstance()->NullKey()) { |
195 base::subtle::NoBarrier_AtomicIncrement(&g_instance_count, 1); | 196 base::subtle::NoBarrier_AtomicIncrement(&g_instance_count, 1); |
196 icon_helper_.reset(new IconHelper(web_contents_.get())); | 197 icon_helper_.reset(new IconHelper(web_contents_.get())); |
197 icon_helper_->SetListener(this); | 198 icon_helper_->SetListener(this); |
198 web_contents_->SetUserData(android_webview::kAwContentsUserDataKey, | 199 web_contents_->SetUserData(android_webview::kAwContentsUserDataKey, |
199 new AwContentsUserData(this)); | 200 new AwContentsUserData(this)); |
200 browser_view_renderer_.RegisterWithWebContents(web_contents_.get()); | 201 browser_view_renderer_.RegisterWithWebContents(web_contents_.get()); |
201 render_view_host_ext_.reset( | 202 render_view_host_ext_.reset( |
202 new AwRenderViewHostExt(this, web_contents_.get())); | 203 new AwRenderViewHostExt(this, web_contents_.get())); |
203 | 204 |
(...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
322 | 323 |
323 static jlong Init(JNIEnv* env, | 324 static jlong Init(JNIEnv* env, |
324 const JavaParamRef<jclass>&, | 325 const JavaParamRef<jclass>&, |
325 const JavaParamRef<jobject>& browser_context) { | 326 const JavaParamRef<jobject>& browser_context) { |
326 // TODO(joth): Use |browser_context| to get the native BrowserContext, rather | 327 // TODO(joth): Use |browser_context| to get the native BrowserContext, rather |
327 // than hard-code the default instance lookup here. | 328 // than hard-code the default instance lookup here. |
328 scoped_ptr<WebContents> web_contents(content::WebContents::Create( | 329 scoped_ptr<WebContents> web_contents(content::WebContents::Create( |
329 content::WebContents::CreateParams(AwBrowserContext::GetDefault()))); | 330 content::WebContents::CreateParams(AwBrowserContext::GetDefault()))); |
330 // Return an 'uninitialized' instance; most work is deferred until the | 331 // Return an 'uninitialized' instance; most work is deferred until the |
331 // subsequent SetJavaPeers() call. | 332 // subsequent SetJavaPeers() call. |
332 return reinterpret_cast<intptr_t>(new AwContents(web_contents.Pass())); | 333 return reinterpret_cast<intptr_t>(new AwContents(std::move(web_contents))); |
333 } | 334 } |
334 | 335 |
335 static void SetForceAuxiliaryBitmapRendering( | 336 static void SetForceAuxiliaryBitmapRendering( |
336 JNIEnv* env, | 337 JNIEnv* env, |
337 const JavaParamRef<jclass>&, | 338 const JavaParamRef<jclass>&, |
338 jboolean force_auxiliary_bitmap_rendering) { | 339 jboolean force_auxiliary_bitmap_rendering) { |
339 g_force_auxiliary_bitmap_rendering = force_auxiliary_bitmap_rendering; | 340 g_force_auxiliary_bitmap_rendering = force_auxiliary_bitmap_rendering; |
340 } | 341 } |
341 | 342 |
342 static void SetAwDrawSWFunctionTable(JNIEnv* env, | 343 static void SetAwDrawSWFunctionTable(JNIEnv* env, |
(...skipping 641 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
984 void AwContents::SetPendingWebContentsForPopup( | 985 void AwContents::SetPendingWebContentsForPopup( |
985 scoped_ptr<content::WebContents> pending) { | 986 scoped_ptr<content::WebContents> pending) { |
986 DCHECK_CURRENTLY_ON(BrowserThread::UI); | 987 DCHECK_CURRENTLY_ON(BrowserThread::UI); |
987 if (pending_contents_.get()) { | 988 if (pending_contents_.get()) { |
988 // TODO(benm): Support holding multiple pop up window requests. | 989 // TODO(benm): Support holding multiple pop up window requests. |
989 LOG(WARNING) << "Blocking popup window creation as an outstanding " | 990 LOG(WARNING) << "Blocking popup window creation as an outstanding " |
990 << "popup window is still pending."; | 991 << "popup window is still pending."; |
991 base::MessageLoop::current()->DeleteSoon(FROM_HERE, pending.release()); | 992 base::MessageLoop::current()->DeleteSoon(FROM_HERE, pending.release()); |
992 return; | 993 return; |
993 } | 994 } |
994 pending_contents_.reset(new AwContents(pending.Pass())); | 995 pending_contents_.reset(new AwContents(std::move(pending))); |
995 // Set dip_scale for pending contents, which is necessary for the later | 996 // Set dip_scale for pending contents, which is necessary for the later |
996 // SynchronousCompositor and InputHandler setup. | 997 // SynchronousCompositor and InputHandler setup. |
997 pending_contents_->SetDipScaleInternal(browser_view_renderer_.dip_scale()); | 998 pending_contents_->SetDipScaleInternal(browser_view_renderer_.dip_scale()); |
998 } | 999 } |
999 | 1000 |
1000 void AwContents::FocusFirstNode(JNIEnv* env, const JavaParamRef<jobject>& obj) { | 1001 void AwContents::FocusFirstNode(JNIEnv* env, const JavaParamRef<jobject>& obj) { |
1001 DCHECK_CURRENTLY_ON(BrowserThread::UI); | 1002 DCHECK_CURRENTLY_ON(BrowserThread::UI); |
1002 web_contents_->FocusThroughTabTraversal(false); | 1003 web_contents_->FocusThroughTabTraversal(false); |
1003 } | 1004 } |
1004 | 1005 |
(...skipping 272 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1277 const JavaParamRef<jobject>& obj) { | 1278 const JavaParamRef<jobject>& obj) { |
1278 web_contents_->ResumeLoadingCreatedWebContents(); | 1279 web_contents_->ResumeLoadingCreatedWebContents(); |
1279 } | 1280 } |
1280 | 1281 |
1281 void SetShouldDownloadFavicons(JNIEnv* env, | 1282 void SetShouldDownloadFavicons(JNIEnv* env, |
1282 const JavaParamRef<jclass>& jclazz) { | 1283 const JavaParamRef<jclass>& jclazz) { |
1283 g_should_download_favicons = true; | 1284 g_should_download_favicons = true; |
1284 } | 1285 } |
1285 | 1286 |
1286 } // namespace android_webview | 1287 } // namespace android_webview |
OLD | NEW |