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 #include <utility> | 10 #include <utility> |
(...skipping 1120 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1131 // If the mouse is locked, only the current owner of the mouse lock can | 1131 // If the mouse is locked, only the current owner of the mouse lock can |
1132 // process mouse events. | 1132 // process mouse events. |
1133 return mouse_lock_dispatcher_->WillHandleMouseEvent(event); | 1133 return mouse_lock_dispatcher_->WillHandleMouseEvent(event); |
1134 } | 1134 } |
1135 | 1135 |
1136 // IPC::Listener implementation ---------------------------------------------- | 1136 // IPC::Listener implementation ---------------------------------------------- |
1137 | 1137 |
1138 bool RenderViewImpl::OnMessageReceived(const IPC::Message& message) { | 1138 bool RenderViewImpl::OnMessageReceived(const IPC::Message& message) { |
1139 WebFrame* main_frame = webview() ? webview()->MainFrame() : NULL; | 1139 WebFrame* main_frame = webview() ? webview()->MainFrame() : NULL; |
1140 if (main_frame && main_frame->IsWebLocalFrame()) | 1140 if (main_frame && main_frame->IsWebLocalFrame()) |
1141 GetContentClient()->SetActiveURL(main_frame->GetDocument().Url()); | 1141 GetContentClient()->SetActiveURL( |
| 1142 main_frame->ToWebLocalFrame()->GetDocument().Url()); |
1142 | 1143 |
1143 // Input IPC messages must not be processed if the RenderView is in | 1144 // Input IPC messages must not be processed if the RenderView is in |
1144 // swapped out state. | 1145 // swapped out state. |
1145 if (is_swapped_out_ && | 1146 if (is_swapped_out_ && |
1146 IPC_MESSAGE_ID_CLASS(message.type()) == InputMsgStart) { | 1147 IPC_MESSAGE_ID_CLASS(message.type()) == InputMsgStart) { |
1147 // TODO(dtapuska): Remove this histogram once we have seen that it actually | 1148 // TODO(dtapuska): Remove this histogram once we have seen that it actually |
1148 // produces results true. See crbug.com/615090 | 1149 // produces results true. See crbug.com/615090 |
1149 UMA_HISTOGRAM_BOOLEAN("Event.RenderView.DiscardInput", true); | 1150 UMA_HISTOGRAM_BOOLEAN("Event.RenderView.DiscardInput", true); |
1150 IPC_BEGIN_MESSAGE_MAP(RenderViewImpl, message) | 1151 IPC_BEGIN_MESSAGE_MAP(RenderViewImpl, message) |
1151 IPC_MESSAGE_HANDLER(InputMsg_HandleInputEvent, OnDiscardInputEvent) | 1152 IPC_MESSAGE_HANDLER(InputMsg_HandleInputEvent, OnDiscardInputEvent) |
(...skipping 1079 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2231 // This IPC only updates the screen info on RenderViews that have a remote | 2232 // This IPC only updates the screen info on RenderViews that have a remote |
2232 // main frame. For local main frames, the ScreenInfo is updated in | 2233 // main frame. For local main frames, the ScreenInfo is updated in |
2233 // ViewMsg_Resize. | 2234 // ViewMsg_Resize. |
2234 if (!main_render_frame_) | 2235 if (!main_render_frame_) |
2235 screen_info_ = screen_info; | 2236 screen_info_ = screen_info; |
2236 } | 2237 } |
2237 | 2238 |
2238 GURL RenderViewImpl::GetURLForGraphicsContext3D() { | 2239 GURL RenderViewImpl::GetURLForGraphicsContext3D() { |
2239 DCHECK(webview()); | 2240 DCHECK(webview()); |
2240 if (webview()->MainFrame()->IsWebLocalFrame()) | 2241 if (webview()->MainFrame()->IsWebLocalFrame()) |
2241 return GURL(webview()->MainFrame()->GetDocument().Url()); | 2242 return GURL(webview()->MainFrame()->ToWebLocalFrame()->GetDocument().Url()); |
2242 else | 2243 else |
2243 return GURL("chrome://gpu/RenderViewImpl::CreateGraphicsContext3D"); | 2244 return GURL("chrome://gpu/RenderViewImpl::CreateGraphicsContext3D"); |
2244 } | 2245 } |
2245 | 2246 |
2246 void RenderViewImpl::OnSetFocus(bool enable) { | 2247 void RenderViewImpl::OnSetFocus(bool enable) { |
2247 // This message must always be received when the main frame is a | 2248 // This message must always be received when the main frame is a |
2248 // WebLocalFrame. | 2249 // WebLocalFrame. |
2249 CHECK(webview()->MainFrame()->IsWebLocalFrame()); | 2250 CHECK(webview()->MainFrame()->IsWebLocalFrame()); |
2250 SetFocus(enable); | 2251 SetFocus(enable); |
2251 } | 2252 } |
(...skipping 313 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2565 std::move(callback).Run(INPUT_EVENT_ACK_STATE_NOT_CONSUMED, latency_info, | 2566 std::move(callback).Run(INPUT_EVENT_ACK_STATE_NOT_CONSUMED, latency_info, |
2566 nullptr); | 2567 nullptr); |
2567 return; | 2568 return; |
2568 } | 2569 } |
2569 idle_user_detector_->ActivityDetected(); | 2570 idle_user_detector_->ActivityDetected(); |
2570 RenderWidget::HandleInputEvent(input_event, latency_info, | 2571 RenderWidget::HandleInputEvent(input_event, latency_info, |
2571 std::move(callback)); | 2572 std::move(callback)); |
2572 } | 2573 } |
2573 | 2574 |
2574 } // namespace content | 2575 } // namespace content |
OLD | NEW |