Chromium Code Reviews| Index: content/renderer/render_widget.cc |
| diff --git a/content/renderer/render_widget.cc b/content/renderer/render_widget.cc |
| index 4cd7315e2ade000bba6091586185d14bd33d3b50..68cf594e0894715b5c87f2e5b329fde9c8f61d18 100644 |
| --- a/content/renderer/render_widget.cc |
| +++ b/content/renderer/render_widget.cc |
| @@ -84,6 +84,7 @@ |
| #if defined(OS_ANDROID) |
| #include <android/keycodes.h> |
| +#include "base/time/time.h" |
| #endif |
| #if defined(OS_POSIX) |
| @@ -199,6 +200,12 @@ ui::TextInputMode ConvertWebTextInputMode(blink::WebTextInputMode mode) { |
| namespace content { |
| +#if defined(OS_ANDROID) |
| +// Delay between tapping in content and launching the associated android intent. |
| +// Used to allow users see what has been recognized as content. |
| +const size_t kContentIntentDelayMilliseconds = 700; |
|
dcheng
2016/11/04 21:00:02
constexpr base::TimeDelta kContentIntentDelay = ba
wjmaclean
2016/11/07 15:57:27
Done.
|
| +#endif |
| + |
| // RenderWidget --------------------------------------------------------------- |
| RenderWidget::RenderWidget(CompositorDependencies* compositor_deps, |
| @@ -242,6 +249,7 @@ RenderWidget::RenderWidget(CompositorDependencies* compositor_deps, |
| frame_swap_message_queue_(new FrameSwapMessageQueue()), |
| resizing_mode_selector_(new ResizingModeSelector()), |
| has_host_context_menu_location_(false), |
| + has_added_input_handler_(false), |
| has_focus_(false), |
| #if defined(OS_MACOSX) |
| text_input_client_observer_(new TextInputClientObserver(this)), |
| @@ -1115,6 +1123,28 @@ void RenderWidget::initializeLayerTreeView() { |
| compositor_->SetNeverVisible(); |
| StartCompositor(); |
| + |
| + bool use_threaded_event_handling = true; |
| +#if defined(OS_MACOSX) |
| + // Disable threaded event handling if content is not handling the elastic |
| + // overscroll effect. This includes the cases where the elastic overscroll |
| + // effect is being handled by Blink (because of command line flags) and older |
| + // operating system versions which do not have an elastic overscroll effect |
| + // (SnowLeopard, which has Aqua scrollbars which need synchronous updates). |
| + use_threaded_event_handling = compositor_deps_->IsElasticOverscrollEnabled(); |
| +#endif |
| + if (!use_threaded_event_handling) |
| + return; |
| + |
| + RenderThreadImpl* render_thread = RenderThreadImpl::current(); |
| + // render_thread may be NULL in tests. |
| + InputHandlerManager* input_handler_manager = |
| + render_thread ? render_thread->input_handler_manager() : NULL; |
| + if (input_handler_manager) { |
| + input_handler_manager->AddInputHandler( |
| + routing_id_, compositor()->GetInputHandler(), AsWeakPtr(), true); |
|
lfg
2016/11/04 17:22:05
We were using webkit_preferences_.enable_scroll_an
wjmaclean
2016/11/04 17:27:51
I'll plumb that through from RenderViewImpl in the
|
| + has_added_input_handler_ = true; |
| + } |
| } |
| void RenderWidget::WillCloseLayerTreeView() { |
| @@ -1605,6 +1635,19 @@ void RenderWidget::OnRequestTextInputStateUpdate() { |
| UpdateSelectionBounds(); |
| UpdateTextInputState(ShowIme::HIDE_IME, ChangeSource::FROM_IME); |
| } |
| + |
| +void RenderWidget::scheduleContentIntentForRenderView( |
| + const blink::WebURL& intent, |
| + bool is_main_frame, |
| + size_t expected_content_intent_id) { |
| + // Introduce a short delay so that the user can notice the content. |
| + base::ThreadTaskRunnerHandle::Get()->PostDelayedTask( |
| + FROM_HERE, |
| + base::Bind(&RenderWidget::LaunchAndroidContentIntent, |
| + static_cast<RenderWidget*>(this)->AsWeakPtr(), |
|
dcheng
2016/11/04 21:00:02
Why do we need to do this cast?
wjmaclean
2016/11/07 15:57:27
We don't ... stale cruft. Fixed.
|
| + intent, expected_content_intent_id, is_main_frame), |
| + base::TimeDelta::FromMilliseconds(kContentIntentDelayMilliseconds)); |
| +} |
| #endif |
| void RenderWidget::OnRequestCompositionUpdate(bool immediate_request, |