| 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/lib/main/aw_main_delegate.h" | 5 #include "android_webview/lib/main/aw_main_delegate.h" |
| 6 | 6 |
| 7 #include "android_webview/browser/aw_content_browser_client.h" | 7 #include "android_webview/browser/aw_content_browser_client.h" |
| 8 #include "android_webview/browser/in_process_renderer/in_process_renderer_client
.h" | |
| 9 #include "android_webview/browser/scoped_allow_wait_for_legacy_web_view_api.h" | 8 #include "android_webview/browser/scoped_allow_wait_for_legacy_web_view_api.h" |
| 10 #include "android_webview/common/aw_switches.h" | 9 #include "android_webview/common/aw_switches.h" |
| 11 #include "android_webview/lib/aw_browser_dependency_factory_impl.h" | 10 #include "android_webview/lib/aw_browser_dependency_factory_impl.h" |
| 12 #include "android_webview/native/aw_geolocation_permission_context.h" | 11 #include "android_webview/native/aw_geolocation_permission_context.h" |
| 13 #include "android_webview/native/aw_quota_manager_bridge_impl.h" | 12 #include "android_webview/native/aw_quota_manager_bridge_impl.h" |
| 14 #include "android_webview/native/aw_web_contents_view_delegate.h" | 13 #include "android_webview/native/aw_web_contents_view_delegate.h" |
| 15 #include "android_webview/renderer/aw_content_renderer_client.h" | 14 #include "android_webview/renderer/aw_content_renderer_client.h" |
| 16 #include "base/command_line.h" | 15 #include "base/command_line.h" |
| 17 #include "base/lazy_instance.h" | 16 #include "base/lazy_instance.h" |
| 18 #include "base/logging.h" | 17 #include "base/logging.h" |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 53 content::SetContentClient(&content_client_); | 52 content::SetContentClient(&content_client_); |
| 54 | 53 |
| 55 webkit::gpu::WebGraphicsContext3DInProcessCommandBufferImpl | 54 webkit::gpu::WebGraphicsContext3DInProcessCommandBufferImpl |
| 56 ::EnableVirtualizedContext(); | 55 ::EnableVirtualizedContext(); |
| 57 | 56 |
| 58 CommandLine* cl = CommandLine::ForCurrentProcess(); | 57 CommandLine* cl = CommandLine::ForCurrentProcess(); |
| 59 if (UIAndRendererCompositorThreadsNotMerged()) { | 58 if (UIAndRendererCompositorThreadsNotMerged()) { |
| 60 cl->AppendSwitch(cc::switches::kEnableCompositorFrameMessage); | 59 cl->AppendSwitch(cc::switches::kEnableCompositorFrameMessage); |
| 61 cl->AppendSwitch(switches::kEnableWebViewSynchronousAPIs); | 60 cl->AppendSwitch(switches::kEnableWebViewSynchronousAPIs); |
| 62 } else { | 61 } else { |
| 63 cl->AppendSwitch(switches::kEnableSynchronousRendererCompositor); | |
| 64 cl->AppendSwitch(switches::kEnableBeginFrameScheduling); | 62 cl->AppendSwitch(switches::kEnableBeginFrameScheduling); |
| 65 } | 63 } |
| 66 | 64 |
| 67 // WebView uses the existing Android View edge effect for overscroll glow. | 65 // WebView uses the existing Android View edge effect for overscroll glow. |
| 68 cl->AppendSwitch(switches::kDisableOverscrollEdgeEffect); | 66 cl->AppendSwitch(switches::kDisableOverscrollEdgeEffect); |
| 69 | 67 |
| 70 return false; | 68 return false; |
| 71 } | 69 } |
| 72 | 70 |
| 73 void AwMainDelegate::PreSandboxStartup() { | 71 void AwMainDelegate::PreSandboxStartup() { |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 116 } | 114 } |
| 117 | 115 |
| 118 content::ContentBrowserClient* | 116 content::ContentBrowserClient* |
| 119 AwMainDelegate::CreateContentBrowserClient() { | 117 AwMainDelegate::CreateContentBrowserClient() { |
| 120 content_browser_client_.reset(new AwContentBrowserClient(this)); | 118 content_browser_client_.reset(new AwContentBrowserClient(this)); |
| 121 return content_browser_client_.get(); | 119 return content_browser_client_.get(); |
| 122 } | 120 } |
| 123 | 121 |
| 124 content::ContentRendererClient* | 122 content::ContentRendererClient* |
| 125 AwMainDelegate::CreateContentRendererClient() { | 123 AwMainDelegate::CreateContentRendererClient() { |
| 126 // None of this makes sense for multiprocess. | 124 content_renderer_client_.reset(new AwContentRendererClient()); |
| 127 DCHECK(CommandLine::ForCurrentProcess()->HasSwitch(switches::kSingleProcess)); | |
| 128 // During transition period allow running in either threading mode; eventually | |
| 129 // only the compositor/UI thread merge mode will be supported. | |
| 130 const bool no_merge_threads = UIAndRendererCompositorThreadsNotMerged(); | |
| 131 content_renderer_client_.reset( | |
| 132 no_merge_threads ? new AwContentRendererClient() : | |
| 133 new InProcessRendererClient()); | |
| 134 return content_renderer_client_.get(); | 125 return content_renderer_client_.get(); |
| 135 } | 126 } |
| 136 | 127 |
| 137 AwQuotaManagerBridge* AwMainDelegate::CreateAwQuotaManagerBridge( | 128 AwQuotaManagerBridge* AwMainDelegate::CreateAwQuotaManagerBridge( |
| 138 AwBrowserContext* browser_context) { | 129 AwBrowserContext* browser_context) { |
| 139 return new AwQuotaManagerBridgeImpl(browser_context); | 130 return new AwQuotaManagerBridgeImpl(browser_context); |
| 140 } | 131 } |
| 141 | 132 |
| 142 content::GeolocationPermissionContext* | 133 content::GeolocationPermissionContext* |
| 143 AwMainDelegate::CreateGeolocationPermission( | 134 AwMainDelegate::CreateGeolocationPermission( |
| 144 AwBrowserContext* browser_context) { | 135 AwBrowserContext* browser_context) { |
| 145 return AwGeolocationPermissionContext::Create(browser_context); | 136 return AwGeolocationPermissionContext::Create(browser_context); |
| 146 } | 137 } |
| 147 | 138 |
| 148 content::WebContentsViewDelegate* AwMainDelegate::CreateViewDelegate( | 139 content::WebContentsViewDelegate* AwMainDelegate::CreateViewDelegate( |
| 149 content::WebContents* web_contents) { | 140 content::WebContents* web_contents) { |
| 150 return AwWebContentsViewDelegate::Create(web_contents); | 141 return AwWebContentsViewDelegate::Create(web_contents); |
| 151 } | 142 } |
| 152 | 143 |
| 153 } // namespace android_webview | 144 } // namespace android_webview |
| OLD | NEW |