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/browser_view_renderer.h" | 8 #include "android_webview/browser/browser_view_renderer.h" |
9 #include "android_webview/browser/scoped_allow_wait_for_legacy_web_view_api.h" | 9 #include "android_webview/browser/scoped_allow_wait_for_legacy_web_view_api.h" |
10 #include "android_webview/common/aw_switches.h" | 10 #include "android_webview/common/aw_switches.h" |
(...skipping 17 matching lines...) Expand all Loading... |
28 #include "components/external_video_surface/browser/android/external_video_surfa
ce_container_impl.h" | 28 #include "components/external_video_surface/browser/android/external_video_surfa
ce_container_impl.h" |
29 #include "content/public/browser/android/browser_media_player_manager_register.h
" | 29 #include "content/public/browser/android/browser_media_player_manager_register.h
" |
30 #include "content/public/browser/browser_main_runner.h" | 30 #include "content/public/browser/browser_main_runner.h" |
31 #include "content/public/browser/browser_thread.h" | 31 #include "content/public/browser/browser_thread.h" |
32 #include "content/public/common/content_descriptors.h" | 32 #include "content/public/common/content_descriptors.h" |
33 #include "content/public/common/content_switches.h" | 33 #include "content/public/common/content_switches.h" |
34 #include "gin/public/isolate_holder.h" | 34 #include "gin/public/isolate_holder.h" |
35 #include "gpu/command_buffer/client/gl_in_process_context.h" | 35 #include "gpu/command_buffer/client/gl_in_process_context.h" |
36 #include "gpu/command_buffer/service/gpu_switches.h" | 36 #include "gpu/command_buffer/service/gpu_switches.h" |
37 #include "media/base/media_switches.h" | 37 #include "media/base/media_switches.h" |
| 38 #include "ui/events/gesture_detection/gesture_configuration.h" |
38 | 39 |
39 namespace android_webview { | 40 namespace android_webview { |
40 | 41 |
41 namespace { | 42 namespace { |
42 | 43 |
43 // TODO(boliu): Remove this global Allow once the underlying issues are | 44 // TODO(boliu): Remove this global Allow once the underlying issues are |
44 // resolved - http://crbug.com/240453. See AwMainDelegate::RunProcess below. | 45 // resolved - http://crbug.com/240453. See AwMainDelegate::RunProcess below. |
45 base::LazyInstance<scoped_ptr<ScopedAllowWaitForLegacyWebViewApi> > | 46 base::LazyInstance<scoped_ptr<ScopedAllowWaitForLegacyWebViewApi> > |
46 g_allow_wait_in_ui_thread = LAZY_INSTANCE_INITIALIZER; | 47 g_allow_wait_in_ui_thread = LAZY_INSTANCE_INITIALIZER; |
47 | 48 |
48 } | 49 } |
49 | 50 |
50 AwMainDelegate::AwMainDelegate() { | 51 AwMainDelegate::AwMainDelegate() { |
51 } | 52 } |
52 | 53 |
53 AwMainDelegate::~AwMainDelegate() { | 54 AwMainDelegate::~AwMainDelegate() { |
54 } | 55 } |
55 | 56 |
56 bool AwMainDelegate::BasicStartupComplete(int* exit_code) { | 57 bool AwMainDelegate::BasicStartupComplete(int* exit_code) { |
57 content::SetContentClient(&content_client_); | 58 content::SetContentClient(&content_client_); |
58 | 59 |
59 content::RegisterMediaUrlInterceptor(new AwMediaUrlInterceptor()); | 60 content::RegisterMediaUrlInterceptor(new AwMediaUrlInterceptor()); |
60 | 61 |
61 BrowserViewRenderer::CalculateTileMemoryPolicy(); | 62 BrowserViewRenderer::CalculateTileMemoryPolicy(); |
62 | 63 |
| 64 // Android WebView apps can override WebView#computeScroll to achieve custom |
| 65 // scroll/fling. As a result, the animations may not be ticked. This will |
| 66 // confuse the tap suppression controller. So just disable it for WebView. |
| 67 ui::GestureConfiguration::GetInstance() |
| 68 ->set_fling_touchscreen_tap_suppression_enabled(false); |
| 69 |
63 base::CommandLine* cl = base::CommandLine::ForCurrentProcess(); | 70 base::CommandLine* cl = base::CommandLine::ForCurrentProcess(); |
64 cl->AppendSwitch(switches::kUseIpcCommandBuffer); | 71 cl->AppendSwitch(switches::kUseIpcCommandBuffer); |
65 cl->AppendSwitch(cc::switches::kEnableBeginFrameScheduling); | 72 cl->AppendSwitch(cc::switches::kEnableBeginFrameScheduling); |
66 | 73 |
67 // WebView uses the Android system's scrollbars and overscroll glow. | 74 // WebView uses the Android system's scrollbars and overscroll glow. |
68 cl->AppendSwitch(switches::kDisableOverscrollEdgeEffect); | 75 cl->AppendSwitch(switches::kDisableOverscrollEdgeEffect); |
69 | 76 |
70 // Pull-to-refresh should never be a default WebView action. | 77 // Pull-to-refresh should never be a default WebView action. |
71 cl->AppendSwitch(switches::kDisablePullToRefreshEffect); | 78 cl->AppendSwitch(switches::kDisablePullToRefreshEffect); |
72 | 79 |
(...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
202 #if defined(VIDEO_HOLE) | 209 #if defined(VIDEO_HOLE) |
203 content::ExternalVideoSurfaceContainer* | 210 content::ExternalVideoSurfaceContainer* |
204 AwMainDelegate::CreateExternalVideoSurfaceContainer( | 211 AwMainDelegate::CreateExternalVideoSurfaceContainer( |
205 content::WebContents* web_contents) { | 212 content::WebContents* web_contents) { |
206 return external_video_surface::ExternalVideoSurfaceContainerImpl::Create( | 213 return external_video_surface::ExternalVideoSurfaceContainerImpl::Create( |
207 web_contents); | 214 web_contents); |
208 } | 215 } |
209 #endif | 216 #endif |
210 | 217 |
211 } // namespace android_webview | 218 } // namespace android_webview |
OLD | NEW |