| 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 275 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 286 if (!rvh) { | 286 if (!rvh) { |
| 287 hosts->Add(widget); | 287 hosts->Add(widget); |
| 288 continue; | 288 continue; |
| 289 } | 289 } |
| 290 | 290 |
| 291 // For RenderViewHosts, add only active ones. | 291 // For RenderViewHosts, add only active ones. |
| 292 if (static_cast<RenderViewHostImpl*>(rvh)->is_active()) | 292 if (static_cast<RenderViewHostImpl*>(rvh)->is_active()) |
| 293 hosts->Add(widget); | 293 hosts->Add(widget); |
| 294 } | 294 } |
| 295 | 295 |
| 296 return hosts.Pass(); | 296 return std::move(hosts); |
| 297 } | 297 } |
| 298 | 298 |
| 299 // static | 299 // static |
| 300 scoped_ptr<RenderWidgetHostIterator> | 300 scoped_ptr<RenderWidgetHostIterator> |
| 301 RenderWidgetHostImpl::GetAllRenderWidgetHosts() { | 301 RenderWidgetHostImpl::GetAllRenderWidgetHosts() { |
| 302 scoped_ptr<RenderWidgetHostIteratorImpl> hosts( | 302 scoped_ptr<RenderWidgetHostIteratorImpl> hosts( |
| 303 new RenderWidgetHostIteratorImpl()); | 303 new RenderWidgetHostIteratorImpl()); |
| 304 for (auto& it : g_routing_id_widget_map.Get()) | 304 for (auto& it : g_routing_id_widget_map.Get()) |
| 305 hosts->Add(it.second); | 305 hosts->Add(it.second); |
| 306 | 306 |
| 307 return hosts.Pass(); | 307 return std::move(hosts); |
| 308 } | 308 } |
| 309 | 309 |
| 310 // static | 310 // static |
| 311 RenderWidgetHostImpl* RenderWidgetHostImpl::From(RenderWidgetHost* rwh) { | 311 RenderWidgetHostImpl* RenderWidgetHostImpl::From(RenderWidgetHost* rwh) { |
| 312 return static_cast<RenderWidgetHostImpl*>(rwh); | 312 return static_cast<RenderWidgetHostImpl*>(rwh); |
| 313 } | 313 } |
| 314 | 314 |
| 315 void RenderWidgetHostImpl::SetView(RenderWidgetHostViewBase* view) { | 315 void RenderWidgetHostImpl::SetView(RenderWidgetHostViewBase* view) { |
| 316 if (view) | 316 if (view) |
| 317 view_ = view->GetWeakPtr(); | 317 view_ = view->GetWeakPtr(); |
| (...skipping 860 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1178 key_event_with_latency.event.isBrowserShortcut = is_shortcut; | 1178 key_event_with_latency.event.isBrowserShortcut = is_shortcut; |
| 1179 latency_tracker_.OnInputEvent(key_event, &key_event_with_latency.latency); | 1179 latency_tracker_.OnInputEvent(key_event, &key_event_with_latency.latency); |
| 1180 input_router_->SendKeyboardEvent(key_event_with_latency); | 1180 input_router_->SendKeyboardEvent(key_event_with_latency); |
| 1181 } | 1181 } |
| 1182 | 1182 |
| 1183 void RenderWidgetHostImpl::QueueSyntheticGesture( | 1183 void RenderWidgetHostImpl::QueueSyntheticGesture( |
| 1184 scoped_ptr<SyntheticGesture> synthetic_gesture, | 1184 scoped_ptr<SyntheticGesture> synthetic_gesture, |
| 1185 const base::Callback<void(SyntheticGesture::Result)>& on_complete) { | 1185 const base::Callback<void(SyntheticGesture::Result)>& on_complete) { |
| 1186 if (!synthetic_gesture_controller_ && view_) { | 1186 if (!synthetic_gesture_controller_ && view_) { |
| 1187 synthetic_gesture_controller_.reset( | 1187 synthetic_gesture_controller_.reset( |
| 1188 new SyntheticGestureController( | 1188 new SyntheticGestureController(view_->CreateSyntheticGestureTarget())); |
| 1189 view_->CreateSyntheticGestureTarget().Pass())); | |
| 1190 } | 1189 } |
| 1191 if (synthetic_gesture_controller_) { | 1190 if (synthetic_gesture_controller_) { |
| 1192 synthetic_gesture_controller_->QueueSyntheticGesture( | 1191 synthetic_gesture_controller_->QueueSyntheticGesture( |
| 1193 synthetic_gesture.Pass(), on_complete); | 1192 std::move(synthetic_gesture), on_complete); |
| 1194 } | 1193 } |
| 1195 } | 1194 } |
| 1196 | 1195 |
| 1197 void RenderWidgetHostImpl::SetCursor(const WebCursor& cursor) { | 1196 void RenderWidgetHostImpl::SetCursor(const WebCursor& cursor) { |
| 1198 if (!view_) | 1197 if (!view_) |
| 1199 return; | 1198 return; |
| 1200 view_->UpdateCursor(cursor); | 1199 view_->UpdateCursor(cursor); |
| 1201 } | 1200 } |
| 1202 | 1201 |
| 1203 void RenderWidgetHostImpl::ShowContextMenuAtPoint(const gfx::Point& point) { | 1202 void RenderWidgetHostImpl::ShowContextMenuAtPoint(const gfx::Point& point) { |
| (...skipping 376 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1580 } | 1579 } |
| 1581 | 1580 |
| 1582 latency_tracker_.OnSwapCompositorFrame(&frame->metadata.latency_info); | 1581 latency_tracker_.OnSwapCompositorFrame(&frame->metadata.latency_info); |
| 1583 | 1582 |
| 1584 bool is_mobile_optimized = IsMobileOptimizedFrame(frame->metadata); | 1583 bool is_mobile_optimized = IsMobileOptimizedFrame(frame->metadata); |
| 1585 input_router_->NotifySiteIsMobileOptimized(is_mobile_optimized); | 1584 input_router_->NotifySiteIsMobileOptimized(is_mobile_optimized); |
| 1586 if (touch_emulator_) | 1585 if (touch_emulator_) |
| 1587 touch_emulator_->SetDoubleTapSupportForPageEnabled(!is_mobile_optimized); | 1586 touch_emulator_->SetDoubleTapSupportForPageEnabled(!is_mobile_optimized); |
| 1588 | 1587 |
| 1589 if (view_) { | 1588 if (view_) { |
| 1590 view_->OnSwapCompositorFrame(output_surface_id, frame.Pass()); | 1589 view_->OnSwapCompositorFrame(output_surface_id, std::move(frame)); |
| 1591 view_->DidReceiveRendererFrame(); | 1590 view_->DidReceiveRendererFrame(); |
| 1592 } else { | 1591 } else { |
| 1593 cc::CompositorFrameAck ack; | 1592 cc::CompositorFrameAck ack; |
| 1594 if (frame->gl_frame_data) { | 1593 if (frame->gl_frame_data) { |
| 1595 ack.gl_frame_data = frame->gl_frame_data.Pass(); | 1594 ack.gl_frame_data = std::move(frame->gl_frame_data); |
| 1596 ack.gl_frame_data->sync_token.Clear(); | 1595 ack.gl_frame_data->sync_token.Clear(); |
| 1597 } else if (frame->delegated_frame_data) { | 1596 } else if (frame->delegated_frame_data) { |
| 1598 cc::TransferableResource::ReturnResources( | 1597 cc::TransferableResource::ReturnResources( |
| 1599 frame->delegated_frame_data->resource_list, | 1598 frame->delegated_frame_data->resource_list, |
| 1600 &ack.resources); | 1599 &ack.resources); |
| 1601 } | 1600 } |
| 1602 SendSwapCompositorFrameAck(routing_id_, output_surface_id, | 1601 SendSwapCompositorFrameAck(routing_id_, output_surface_id, |
| 1603 process_->GetID(), ack); | 1602 process_->GetID(), ack); |
| 1604 } | 1603 } |
| 1605 | 1604 |
| (...skipping 639 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2245 } | 2244 } |
| 2246 | 2245 |
| 2247 #if defined(OS_WIN) | 2246 #if defined(OS_WIN) |
| 2248 gfx::NativeViewAccessible | 2247 gfx::NativeViewAccessible |
| 2249 RenderWidgetHostImpl::GetParentNativeViewAccessible() { | 2248 RenderWidgetHostImpl::GetParentNativeViewAccessible() { |
| 2250 return delegate_ ? delegate_->GetParentNativeViewAccessible() : NULL; | 2249 return delegate_ ? delegate_->GetParentNativeViewAccessible() : NULL; |
| 2251 } | 2250 } |
| 2252 #endif | 2251 #endif |
| 2253 | 2252 |
| 2254 } // namespace content | 2253 } // namespace content |
| OLD | NEW |