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 "content/browser/renderer_host/render_widget_host_impl.h" | 5 #include "content/browser/renderer_host/render_widget_host_impl.h" |
6 | 6 |
7 #include <math.h> | 7 #include <math.h> |
8 #include <set> | 8 #include <set> |
9 #include <utility> | 9 #include <utility> |
10 | 10 |
(...skipping 844 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
855 CreateRWHLatencyInfoIfNotExist(&ui_latency, mouse_event.type); | 855 CreateRWHLatencyInfoIfNotExist(&ui_latency, mouse_event.type); |
856 | 856 |
857 for (size_t i = 0; i < mouse_event_callbacks_.size(); ++i) { | 857 for (size_t i = 0; i < mouse_event_callbacks_.size(); ++i) { |
858 if (mouse_event_callbacks_[i].Run(mouse_event)) | 858 if (mouse_event_callbacks_[i].Run(mouse_event)) |
859 return; | 859 return; |
860 } | 860 } |
861 | 861 |
862 if (IgnoreInputEvents()) | 862 if (IgnoreInputEvents()) |
863 return; | 863 return; |
864 | 864 |
865 if (!intercepting_mouse_callback_.is_null()) { | |
jdduke (slow)
2014/08/15 16:49:48
Can you not use the existing AddMouseEventCallback
pfeldman
2014/08/15 19:32:33
I can. Was not expecting things to be so simple. T
| |
866 intercepting_mouse_callback_.Run(mouse_event); | |
867 return; | |
868 } | |
869 | |
865 if (touch_emulator_ && touch_emulator_->HandleMouseEvent(mouse_event)) | 870 if (touch_emulator_ && touch_emulator_->HandleMouseEvent(mouse_event)) |
866 return; | 871 return; |
867 | 872 |
868 input_router_->SendMouseEvent(MouseEventWithLatencyInfo(mouse_event, | 873 input_router_->SendMouseEvent(MouseEventWithLatencyInfo(mouse_event, |
869 latency_info)); | 874 latency_info)); |
870 } | 875 } |
871 | 876 |
872 void RenderWidgetHostImpl::OnPointerEventActivate() { | 877 void RenderWidgetHostImpl::OnPointerEventActivate() { |
873 } | 878 } |
874 | 879 |
(...skipping 741 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1616 if (enabled) { | 1621 if (enabled) { |
1617 if (!touch_emulator_) | 1622 if (!touch_emulator_) |
1618 touch_emulator_.reset(new TouchEmulator(this)); | 1623 touch_emulator_.reset(new TouchEmulator(this)); |
1619 touch_emulator_->Enable(allow_pinch); | 1624 touch_emulator_->Enable(allow_pinch); |
1620 } else { | 1625 } else { |
1621 if (touch_emulator_) | 1626 if (touch_emulator_) |
1622 touch_emulator_->Disable(); | 1627 touch_emulator_->Disable(); |
1623 } | 1628 } |
1624 } | 1629 } |
1625 | 1630 |
1631 void RenderWidgetHostImpl::SetInterceptingMouseCallback( | |
1632 const InterceptingMouseCallback& callback) { | |
1633 intercepting_mouse_callback_ = callback; | |
1634 } | |
1635 | |
1626 void RenderWidgetHostImpl::OnTextInputStateChanged( | 1636 void RenderWidgetHostImpl::OnTextInputStateChanged( |
1627 const ViewHostMsg_TextInputState_Params& params) { | 1637 const ViewHostMsg_TextInputState_Params& params) { |
1628 if (view_) | 1638 if (view_) |
1629 view_->TextInputStateChanged(params); | 1639 view_->TextInputStateChanged(params); |
1630 } | 1640 } |
1631 | 1641 |
1632 #if defined(OS_MACOSX) || defined(USE_AURA) | 1642 #if defined(OS_MACOSX) || defined(USE_AURA) |
1633 void RenderWidgetHostImpl::OnImeCompositionRangeChanged( | 1643 void RenderWidgetHostImpl::OnImeCompositionRangeChanged( |
1634 const gfx::Range& range, | 1644 const gfx::Range& range, |
1635 const std::vector<gfx::Rect>& character_bounds) { | 1645 const std::vector<gfx::Rect>& character_bounds) { |
(...skipping 693 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2329 } | 2339 } |
2330 #endif | 2340 #endif |
2331 | 2341 |
2332 SkColorType RenderWidgetHostImpl::PreferredReadbackFormat() { | 2342 SkColorType RenderWidgetHostImpl::PreferredReadbackFormat() { |
2333 if (view_) | 2343 if (view_) |
2334 return view_->PreferredReadbackFormat(); | 2344 return view_->PreferredReadbackFormat(); |
2335 return kN32_SkColorType; | 2345 return kN32_SkColorType; |
2336 } | 2346 } |
2337 | 2347 |
2338 } // namespace content | 2348 } // namespace content |
OLD | NEW |