| 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 <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/browser_view_renderer.h" | 10 #include "android_webview/browser/browser_view_renderer.h" |
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 56 | 56 |
| 57 AwMainDelegate::AwMainDelegate() { | 57 AwMainDelegate::AwMainDelegate() { |
| 58 } | 58 } |
| 59 | 59 |
| 60 AwMainDelegate::~AwMainDelegate() { | 60 AwMainDelegate::~AwMainDelegate() { |
| 61 } | 61 } |
| 62 | 62 |
| 63 bool AwMainDelegate::BasicStartupComplete(int* exit_code) { | 63 bool AwMainDelegate::BasicStartupComplete(int* exit_code) { |
| 64 content::SetContentClient(&content_client_); | 64 content::SetContentClient(&content_client_); |
| 65 | 65 |
| 66 content::RegisterMediaUrlInterceptor(new AwMediaUrlInterceptor()); | |
| 67 | |
| 68 BrowserViewRenderer::CalculateTileMemoryPolicy(); | |
| 69 | |
| 70 // WebView apps can override WebView#computeScroll to achieve custom | |
| 71 // scroll/fling. As a result, fling animations may not be ticked, potentially | |
| 72 // confusing the tap suppression controller. Simply disable it for WebView. | |
| 73 ui::GestureConfiguration::GetInstance() | |
| 74 ->set_fling_touchscreen_tap_suppression_enabled(false); | |
| 75 | |
| 76 base::CommandLine* cl = base::CommandLine::ForCurrentProcess(); | 66 base::CommandLine* cl = base::CommandLine::ForCurrentProcess(); |
| 77 cl->AppendSwitch(cc::switches::kEnableBeginFrameScheduling); | 67 cl->AppendSwitch(cc::switches::kEnableBeginFrameScheduling); |
| 78 | 68 |
| 79 // WebView uses the Android system's scrollbars and overscroll glow. | 69 // WebView uses the Android system's scrollbars and overscroll glow. |
| 80 cl->AppendSwitch(switches::kDisableOverscrollEdgeEffect); | 70 cl->AppendSwitch(switches::kDisableOverscrollEdgeEffect); |
| 81 | 71 |
| 82 // Pull-to-refresh should never be a default WebView action. | 72 // Pull-to-refresh should never be a default WebView action. |
| 83 cl->AppendSwitch(switches::kDisablePullToRefreshEffect); | 73 cl->AppendSwitch(switches::kDisablePullToRefreshEffect); |
| 84 | 74 |
| 85 // Not yet supported in single-process mode. | 75 // Not yet supported in single-process mode. |
| (...skipping 27 matching lines...) Expand all Loading... |
| 113 // http://crbug.com/479767 | 103 // http://crbug.com/479767 |
| 114 cl->AppendSwitch(switches::kEnableAggressiveDOMStorageFlushing); | 104 cl->AppendSwitch(switches::kEnableAggressiveDOMStorageFlushing); |
| 115 | 105 |
| 116 // Webview does not currently support the Presentation API, see | 106 // Webview does not currently support the Presentation API, see |
| 117 // https://crbug.com/521319 | 107 // https://crbug.com/521319 |
| 118 cl->AppendSwitch(switches::kDisablePresentationAPI); | 108 cl->AppendSwitch(switches::kDisablePresentationAPI); |
| 119 | 109 |
| 120 if (cl->GetSwitchValueASCII(switches::kProcessType).empty()) { | 110 if (cl->GetSwitchValueASCII(switches::kProcessType).empty()) { |
| 121 // Browser process (no type specified). | 111 // Browser process (no type specified). |
| 122 | 112 |
| 113 content::RegisterMediaUrlInterceptor(new AwMediaUrlInterceptor()); |
| 114 BrowserViewRenderer::CalculateTileMemoryPolicy(); |
| 115 // WebView apps can override WebView#computeScroll to achieve custom |
| 116 // scroll/fling. As a result, fling animations may not be ticked, |
| 117 // potentially |
| 118 // confusing the tap suppression controller. Simply disable it for WebView |
| 119 ui::GestureConfiguration::GetInstance() |
| 120 ->set_fling_touchscreen_tap_suppression_enabled(false); |
| 121 |
| 123 base::android::RegisterApkAssetWithGlobalDescriptors( | 122 base::android::RegisterApkAssetWithGlobalDescriptors( |
| 124 kV8NativesDataDescriptor, | 123 kV8NativesDataDescriptor, |
| 125 gin::V8Initializer::GetNativesFilePath().AsUTF8Unsafe()); | 124 gin::V8Initializer::GetNativesFilePath().AsUTF8Unsafe()); |
| 126 base::android::RegisterApkAssetWithGlobalDescriptors( | 125 base::android::RegisterApkAssetWithGlobalDescriptors( |
| 127 kV8SnapshotDataDescriptor32, | 126 kV8SnapshotDataDescriptor32, |
| 128 gin::V8Initializer::GetSnapshotFilePath(true).AsUTF8Unsafe()); | 127 gin::V8Initializer::GetSnapshotFilePath(true).AsUTF8Unsafe()); |
| 129 base::android::RegisterApkAssetWithGlobalDescriptors( | 128 base::android::RegisterApkAssetWithGlobalDescriptors( |
| 130 kV8SnapshotDataDescriptor64, | 129 kV8SnapshotDataDescriptor64, |
| 131 gin::V8Initializer::GetSnapshotFilePath(false).AsUTF8Unsafe()); | 130 gin::V8Initializer::GetSnapshotFilePath(false).AsUTF8Unsafe()); |
| 132 } | 131 } |
| (...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 259 #if defined(VIDEO_HOLE) | 258 #if defined(VIDEO_HOLE) |
| 260 content::ExternalVideoSurfaceContainer* | 259 content::ExternalVideoSurfaceContainer* |
| 261 AwMainDelegate::CreateExternalVideoSurfaceContainer( | 260 AwMainDelegate::CreateExternalVideoSurfaceContainer( |
| 262 content::WebContents* web_contents) { | 261 content::WebContents* web_contents) { |
| 263 return external_video_surface::ExternalVideoSurfaceContainerImpl::Create( | 262 return external_video_surface::ExternalVideoSurfaceContainerImpl::Create( |
| 264 web_contents); | 263 web_contents); |
| 265 } | 264 } |
| 266 #endif | 265 #endif |
| 267 | 266 |
| 268 } // namespace android_webview | 267 } // namespace android_webview |
| OLD | NEW |