| 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/renderer/render_view_impl.h" | 5 #include "content/renderer/render_view_impl.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 #include <cmath> | 8 #include <cmath> |
| 9 #include <memory> | 9 #include <memory> |
| 10 | 10 |
| (...skipping 1282 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1293 | 1293 |
| 1294 // IPC::Listener implementation ---------------------------------------------- | 1294 // IPC::Listener implementation ---------------------------------------------- |
| 1295 | 1295 |
| 1296 bool RenderViewImpl::OnMessageReceived(const IPC::Message& message) { | 1296 bool RenderViewImpl::OnMessageReceived(const IPC::Message& message) { |
| 1297 WebFrame* main_frame = webview() ? webview()->mainFrame() : NULL; | 1297 WebFrame* main_frame = webview() ? webview()->mainFrame() : NULL; |
| 1298 if (main_frame && main_frame->isWebLocalFrame()) | 1298 if (main_frame && main_frame->isWebLocalFrame()) |
| 1299 GetContentClient()->SetActiveURL(main_frame->document().url()); | 1299 GetContentClient()->SetActiveURL(main_frame->document().url()); |
| 1300 | 1300 |
| 1301 // Input IPC messages must not be processed if the RenderView is in | 1301 // Input IPC messages must not be processed if the RenderView is in |
| 1302 // swapped out state. | 1302 // swapped out state. |
| 1303 if (is_swapped_out_ && IPC_MESSAGE_ID_CLASS(message.type()) == InputMsgStart) | 1303 if (is_swapped_out_ && |
| 1304 IPC_MESSAGE_ID_CLASS(message.type()) == InputMsgStart) { |
| 1305 // TODO(dtapuska): Remove this histogram once we have seen that it actually |
| 1306 // produces results true. See crbug.com/615090 |
| 1307 UMA_HISTOGRAM_BOOLEAN("Event.RenderView.DiscardInput", true); |
| 1308 IPC_BEGIN_MESSAGE_MAP(RenderViewImpl, message) |
| 1309 IPC_MESSAGE_HANDLER(InputMsg_HandleInputEvent, OnDiscardInputEvent) |
| 1310 IPC_END_MESSAGE_MAP() |
| 1304 return false; | 1311 return false; |
| 1312 } |
| 1305 | 1313 |
| 1306 for (auto& observer : observers_) { | 1314 for (auto& observer : observers_) { |
| 1307 if (observer.OnMessageReceived(message)) | 1315 if (observer.OnMessageReceived(message)) |
| 1308 return true; | 1316 return true; |
| 1309 } | 1317 } |
| 1310 | 1318 |
| 1311 bool handled = true; | 1319 bool handled = true; |
| 1312 IPC_BEGIN_MESSAGE_MAP(RenderViewImpl, message) | 1320 IPC_BEGIN_MESSAGE_MAP(RenderViewImpl, message) |
| 1313 IPC_MESSAGE_HANDLER(InputMsg_ExecuteEditCommand, OnExecuteEditCommand) | 1321 IPC_MESSAGE_HANDLER(InputMsg_ExecuteEditCommand, OnExecuteEditCommand) |
| 1314 IPC_MESSAGE_HANDLER(InputMsg_MoveCaret, OnMoveCaret) | 1322 IPC_MESSAGE_HANDLER(InputMsg_MoveCaret, OnMoveCaret) |
| (...skipping 1715 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3030 return; | 3038 return; |
| 3031 if (IsUseZoomForDSFEnabled()) { | 3039 if (IsUseZoomForDSFEnabled()) { |
| 3032 webview()->setZoomFactorForDeviceScaleFactor(device_scale_factor_); | 3040 webview()->setZoomFactorForDeviceScaleFactor(device_scale_factor_); |
| 3033 } else { | 3041 } else { |
| 3034 webview()->setDeviceScaleFactor(device_scale_factor_); | 3042 webview()->setDeviceScaleFactor(device_scale_factor_); |
| 3035 } | 3043 } |
| 3036 webview()->settings()->setPreferCompositingToLCDTextEnabled( | 3044 webview()->settings()->setPreferCompositingToLCDTextEnabled( |
| 3037 PreferCompositingToLCDText(compositor_deps_, device_scale_factor_)); | 3045 PreferCompositingToLCDText(compositor_deps_, device_scale_factor_)); |
| 3038 } | 3046 } |
| 3039 | 3047 |
| 3048 void RenderViewImpl::OnDiscardInputEvent( |
| 3049 const blink::WebInputEvent* input_event, |
| 3050 const ui::LatencyInfo& latency_info, |
| 3051 InputEventDispatchType dispatch_type) { |
| 3052 if (!input_event || (dispatch_type != DISPATCH_TYPE_BLOCKING && |
| 3053 dispatch_type != DISPATCH_TYPE_BLOCKING_NOTIFY_MAIN)) { |
| 3054 return; |
| 3055 } |
| 3056 |
| 3057 if (dispatch_type == DISPATCH_TYPE_BLOCKING_NOTIFY_MAIN) { |
| 3058 NotifyInputEventHandled(input_event->type, |
| 3059 INPUT_EVENT_ACK_STATE_NOT_CONSUMED); |
| 3060 } |
| 3061 |
| 3062 std::unique_ptr<InputEventAck> ack( |
| 3063 new InputEventAck(input_event->type, INPUT_EVENT_ACK_STATE_NOT_CONSUMED)); |
| 3064 OnInputEventAck(std::move(ack)); |
| 3065 } |
| 3066 |
| 3040 } // namespace content | 3067 } // namespace content |
| OLD | NEW |