Chromium Code Reviews| 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/aw_main_delegate.h" |
| 6 | 6 |
| 7 #include <memory> | 7 #include <memory> |
| 8 | 8 |
| 9 #include "android_webview/browser/aw_content_browser_client.h" | 9 #include "android_webview/browser/aw_content_browser_client.h" |
| 10 #include "android_webview/browser/aw_media_url_interceptor.h" | 10 #include "android_webview/browser/aw_media_url_interceptor.h" |
| 11 #include "android_webview/browser/aw_safe_browsing_config_helper.h" | 11 #include "android_webview/browser/aw_safe_browsing_config_helper.h" |
| 12 #include "android_webview/browser/browser_view_renderer.h" | 12 #include "android_webview/browser/browser_view_renderer.h" |
| 13 #include "android_webview/browser/command_line_helper.h" | 13 #include "android_webview/browser/command_line_helper.h" |
| 14 #include "android_webview/browser/deferred_gpu_command_service.h" | 14 #include "android_webview/browser/deferred_gpu_command_service.h" |
| 15 #include "android_webview/common/aw_descriptors.h" | 15 #include "android_webview/common/aw_descriptors.h" |
| (...skipping 27 matching lines...) Expand all Loading... | |
| 43 #include "gin/v8_initializer.h" | 43 #include "gin/v8_initializer.h" |
| 44 #include "gpu/command_buffer/service/gpu_switches.h" | 44 #include "gpu/command_buffer/service/gpu_switches.h" |
| 45 #include "gpu/ipc/gl_in_process_context.h" | 45 #include "gpu/ipc/gl_in_process_context.h" |
| 46 #include "media/base/media_switches.h" | 46 #include "media/base/media_switches.h" |
| 47 #include "media/media_features.h" | 47 #include "media/media_features.h" |
| 48 #include "ui/base/resource/resource_bundle.h" | 48 #include "ui/base/resource/resource_bundle.h" |
| 49 #include "ui/events/gesture_detection/gesture_configuration.h" | 49 #include "ui/events/gesture_detection/gesture_configuration.h" |
| 50 | 50 |
| 51 namespace android_webview { | 51 namespace android_webview { |
| 52 | 52 |
| 53 AwMainDelegate::AwMainDelegate() { | 53 AwMainDelegate::AwMainDelegate() {} |
| 54 } | |
| 55 | 54 |
| 56 AwMainDelegate::~AwMainDelegate() { | 55 AwMainDelegate::~AwMainDelegate() {} |
| 57 } | |
| 58 | 56 |
| 59 bool AwMainDelegate::BasicStartupComplete(int* exit_code) { | 57 bool AwMainDelegate::BasicStartupComplete(int* exit_code) { |
| 60 content::SetContentClient(&content_client_); | 58 content::SetContentClient(&content_client_); |
| 61 | 59 |
| 62 base::CommandLine* cl = base::CommandLine::ForCurrentProcess(); | 60 base::CommandLine* cl = base::CommandLine::ForCurrentProcess(); |
| 63 | 61 |
| 64 // WebView uses the Android system's scrollbars and overscroll glow. | 62 // WebView uses the Android system's scrollbars and overscroll glow. |
| 65 cl->AppendSwitch(switches::kDisableOverscrollEdgeEffect); | 63 cl->AppendSwitch(switches::kDisableOverscrollEdgeEffect); |
| 66 | 64 |
| 67 // Pull-to-refresh should never be a default WebView action. | 65 // Pull-to-refresh should never be a default WebView action. |
| 68 cl->AppendSwitch(switches::kDisablePullToRefreshEffect); | 66 cl->AppendSwitch(switches::kDisablePullToRefreshEffect); |
| 69 | 67 |
| 70 // Not yet supported in single-process mode. | 68 // Not yet supported in single-process mode. |
| 71 cl->AppendSwitch(switches::kDisableSharedWorkers); | 69 cl->AppendSwitch(switches::kDisableSharedWorkers); |
| 72 | 70 |
| 73 // File system API not supported (requires some new API; internal bug 6930981) | 71 // File system API not supported (requires some new API; internal bug 6930981) |
| 74 cl->AppendSwitch(switches::kDisableFileSystem); | 72 cl->AppendSwitch(switches::kDisableFileSystem); |
| 75 | 73 |
| 76 // Web Notification API and the Push API are not supported (crbug.com/434712) | 74 // Web Notification API and the Push API are not supported (crbug.com/434712) |
| 77 cl->AppendSwitch(switches::kDisableNotifications); | 75 cl->AppendSwitch(switches::kDisableNotifications); |
| 78 | 76 |
| 79 // WebRTC hardware decoding is not supported, internal bug 15075307 | 77 // WebRTC hardware decoding is not supported, internal bug 15075307 |
|
Torne
2017/05/25 17:04:16
It'd look nicer if you just moved the comment insi
Shimi Zhang
2017/05/25 17:40:41
Done.
| |
| 80 #if BUILDFLAG(ENABLE_WEBRTC) | 78 #if BUILDFLAG(ENABLE_WEBRTC) |
| 81 cl->AppendSwitch(switches::kDisableWebRtcHWDecoding); | 79 cl->AppendSwitch(switches::kDisableWebRtcHWDecoding); |
| 82 #endif | 80 #endif |
| 83 | 81 |
| 84 // This is needed for sharing textures across the different GL threads. | 82 // This is needed for sharing textures across the different GL threads. |
| 85 cl->AppendSwitch(switches::kEnableThreadedTextureMailboxes); | 83 cl->AppendSwitch(switches::kEnableThreadedTextureMailboxes); |
| 86 | 84 |
| 87 // WebView does not yet support screen orientation locking. | 85 // WebView does not yet support screen orientation locking. |
| 88 cl->AppendSwitch(switches::kDisableScreenOrientationLock); | 86 cl->AppendSwitch(switches::kDisableScreenOrientationLock); |
| 89 | 87 |
| (...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 232 | 230 |
| 233 return -1; | 231 return -1; |
| 234 } | 232 } |
| 235 | 233 |
| 236 void AwMainDelegate::ProcessExiting(const std::string& process_type) { | 234 void AwMainDelegate::ProcessExiting(const std::string& process_type) { |
| 237 // TODO(torne): Clean up resources when we handle them. | 235 // TODO(torne): Clean up resources when we handle them. |
| 238 | 236 |
| 239 logging::CloseLogFile(); | 237 logging::CloseLogFile(); |
| 240 } | 238 } |
| 241 | 239 |
| 242 content::ContentBrowserClient* | 240 content::ContentBrowserClient* AwMainDelegate::CreateContentBrowserClient() { |
| 243 AwMainDelegate::CreateContentBrowserClient() { | |
| 244 content_browser_client_.reset(new AwContentBrowserClient()); | 241 content_browser_client_.reset(new AwContentBrowserClient()); |
| 245 return content_browser_client_.get(); | 242 return content_browser_client_.get(); |
| 246 } | 243 } |
| 247 | 244 |
| 248 namespace { | 245 namespace { |
| 249 gpu::SyncPointManager* GetSyncPointManager() { | 246 gpu::SyncPointManager* GetSyncPointManager() { |
| 250 DCHECK(DeferredGpuCommandService::GetInstance()); | 247 DCHECK(DeferredGpuCommandService::GetInstance()); |
| 251 return DeferredGpuCommandService::GetInstance()->sync_point_manager(); | 248 return DeferredGpuCommandService::GetInstance()->sync_point_manager(); |
| 252 } | 249 } |
| 253 } // namespace | 250 } // namespace |
| 254 | 251 |
| 255 content::ContentGpuClient* AwMainDelegate::CreateContentGpuClient() { | 252 content::ContentGpuClient* AwMainDelegate::CreateContentGpuClient() { |
| 256 content_gpu_client_.reset( | 253 content_gpu_client_.reset( |
| 257 new AwContentGpuClient(base::Bind(&GetSyncPointManager))); | 254 new AwContentGpuClient(base::Bind(&GetSyncPointManager))); |
| 258 return content_gpu_client_.get(); | 255 return content_gpu_client_.get(); |
| 259 } | 256 } |
| 260 | 257 |
| 261 content::ContentRendererClient* | 258 content::ContentRendererClient* AwMainDelegate::CreateContentRendererClient() { |
| 262 AwMainDelegate::CreateContentRendererClient() { | |
| 263 content_renderer_client_.reset(new AwContentRendererClient()); | 259 content_renderer_client_.reset(new AwContentRendererClient()); |
| 264 return content_renderer_client_.get(); | 260 return content_renderer_client_.get(); |
| 265 } | 261 } |
| 266 | 262 |
| 267 } // namespace android_webview | 263 } // namespace android_webview |
| OLD | NEW |