| 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_widget.h" | 5 #include "content/renderer/render_widget.h" |
| 6 | 6 |
| 7 #include <memory> | 7 #include <memory> |
| 8 #include <utility> | 8 #include <utility> |
| 9 | 9 |
| 10 #include "base/auto_reset.h" | 10 #include "base/auto_reset.h" |
| (...skipping 483 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 494 IPC_MESSAGE_HANDLER(ViewMsg_EnableDeviceEmulation, | 494 IPC_MESSAGE_HANDLER(ViewMsg_EnableDeviceEmulation, |
| 495 OnEnableDeviceEmulation) | 495 OnEnableDeviceEmulation) |
| 496 IPC_MESSAGE_HANDLER(ViewMsg_DisableDeviceEmulation, | 496 IPC_MESSAGE_HANDLER(ViewMsg_DisableDeviceEmulation, |
| 497 OnDisableDeviceEmulation) | 497 OnDisableDeviceEmulation) |
| 498 IPC_MESSAGE_HANDLER(ViewMsg_WasHidden, OnWasHidden) | 498 IPC_MESSAGE_HANDLER(ViewMsg_WasHidden, OnWasHidden) |
| 499 IPC_MESSAGE_HANDLER(ViewMsg_WasShown, OnWasShown) | 499 IPC_MESSAGE_HANDLER(ViewMsg_WasShown, OnWasShown) |
| 500 IPC_MESSAGE_HANDLER(ViewMsg_Repaint, OnRepaint) | 500 IPC_MESSAGE_HANDLER(ViewMsg_Repaint, OnRepaint) |
| 501 IPC_MESSAGE_HANDLER(ViewMsg_SetTextDirection, OnSetTextDirection) | 501 IPC_MESSAGE_HANDLER(ViewMsg_SetTextDirection, OnSetTextDirection) |
| 502 IPC_MESSAGE_HANDLER(ViewMsg_Move_ACK, OnRequestMoveAck) | 502 IPC_MESSAGE_HANDLER(ViewMsg_Move_ACK, OnRequestMoveAck) |
| 503 IPC_MESSAGE_HANDLER(ViewMsg_UpdateScreenRects, OnUpdateScreenRects) | 503 IPC_MESSAGE_HANDLER(ViewMsg_UpdateScreenRects, OnUpdateScreenRects) |
| 504 IPC_MESSAGE_HANDLER(ViewMsg_SetFrameSinkId, OnSetFrameSinkId) | |
| 505 IPC_MESSAGE_HANDLER(ViewMsg_WaitForNextFrameForTests, | 504 IPC_MESSAGE_HANDLER(ViewMsg_WaitForNextFrameForTests, |
| 506 OnWaitNextFrameForTests) | 505 OnWaitNextFrameForTests) |
| 507 IPC_MESSAGE_HANDLER(InputMsg_RequestCompositionUpdate, | 506 IPC_MESSAGE_HANDLER(InputMsg_RequestCompositionUpdate, |
| 508 OnRequestCompositionUpdate) | 507 OnRequestCompositionUpdate) |
| 509 #if defined(OS_ANDROID) | 508 #if defined(OS_ANDROID) |
| 510 IPC_MESSAGE_HANDLER(InputMsg_ImeEventAck, OnImeEventAck) | 509 IPC_MESSAGE_HANDLER(InputMsg_ImeEventAck, OnImeEventAck) |
| 511 IPC_MESSAGE_HANDLER(InputMsg_RequestTextInputStateUpdate, | 510 IPC_MESSAGE_HANDLER(InputMsg_RequestTextInputStateUpdate, |
| 512 OnRequestTextInputStateUpdate) | 511 OnRequestTextInputStateUpdate) |
| 513 IPC_MESSAGE_HANDLER(InputMsg_ImeBatchEdit, | 512 IPC_MESSAGE_HANDLER(InputMsg_ImeBatchEdit, |
| 514 OnImeBatchEdit) | 513 OnImeBatchEdit) |
| (...skipping 592 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1107 compositor_deps_); | 1106 compositor_deps_); |
| 1108 compositor_->setViewportSize(physical_backing_size_); | 1107 compositor_->setViewportSize(physical_backing_size_); |
| 1109 OnDeviceScaleFactorChanged(); | 1108 OnDeviceScaleFactorChanged(); |
| 1110 compositor_->SetDeviceColorSpace(screen_info_.icc_profile.GetColorSpace()); | 1109 compositor_->SetDeviceColorSpace(screen_info_.icc_profile.GetColorSpace()); |
| 1111 // For background pages and certain tests, we don't want to trigger | 1110 // For background pages and certain tests, we don't want to trigger |
| 1112 // CompositorFrameSink creation. | 1111 // CompositorFrameSink creation. |
| 1113 if (compositor_never_visible_ || !RenderThreadImpl::current()) | 1112 if (compositor_never_visible_ || !RenderThreadImpl::current()) |
| 1114 compositor_->SetNeverVisible(); | 1113 compositor_->SetNeverVisible(); |
| 1115 | 1114 |
| 1116 StartCompositor(); | 1115 StartCompositor(); |
| 1116 DCHECK_NE(MSG_ROUTING_NONE, routing_id_); |
| 1117 compositor_->SetFrameSinkId( |
| 1118 cc::FrameSinkId(RenderThread::Get()->GetClientId(), routing_id_)); |
| 1117 } | 1119 } |
| 1118 | 1120 |
| 1119 void RenderWidget::WillCloseLayerTreeView() { | 1121 void RenderWidget::WillCloseLayerTreeView() { |
| 1120 if (host_closing_) | 1122 if (host_closing_) |
| 1121 return; | 1123 return; |
| 1122 | 1124 |
| 1123 // Prevent new compositors or output surfaces from being created. | 1125 // Prevent new compositors or output surfaces from being created. |
| 1124 host_closing_ = true; | 1126 host_closing_ = true; |
| 1125 | 1127 |
| 1126 // Always send this notification to prevent new layer tree views from | 1128 // Always send this notification to prevent new layer tree views from |
| (...skipping 374 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1501 } | 1503 } |
| 1502 | 1504 |
| 1503 void RenderWidget::OnUpdateWindowScreenRect( | 1505 void RenderWidget::OnUpdateWindowScreenRect( |
| 1504 const gfx::Rect& window_screen_rect) { | 1506 const gfx::Rect& window_screen_rect) { |
| 1505 if (screen_metrics_emulator_) | 1507 if (screen_metrics_emulator_) |
| 1506 screen_metrics_emulator_->OnUpdateWindowScreenRect(window_screen_rect); | 1508 screen_metrics_emulator_->OnUpdateWindowScreenRect(window_screen_rect); |
| 1507 else | 1509 else |
| 1508 window_screen_rect_ = window_screen_rect; | 1510 window_screen_rect_ = window_screen_rect; |
| 1509 } | 1511 } |
| 1510 | 1512 |
| 1511 void RenderWidget::OnSetFrameSinkId(const cc::FrameSinkId& frame_sink_id) { | |
| 1512 if (compositor_) | |
| 1513 compositor_->SetFrameSinkId(frame_sink_id); | |
| 1514 } | |
| 1515 | |
| 1516 void RenderWidget::OnHandleCompositorProto(const std::vector<uint8_t>& proto) { | 1513 void RenderWidget::OnHandleCompositorProto(const std::vector<uint8_t>& proto) { |
| 1517 if (compositor_) | 1514 if (compositor_) |
| 1518 compositor_->OnHandleCompositorProto(proto); | 1515 compositor_->OnHandleCompositorProto(proto); |
| 1519 } | 1516 } |
| 1520 | 1517 |
| 1521 void RenderWidget::showImeIfNeeded() { | 1518 void RenderWidget::showImeIfNeeded() { |
| 1522 OnShowImeIfNeeded(); | 1519 OnShowImeIfNeeded(); |
| 1523 } | 1520 } |
| 1524 | 1521 |
| 1525 ui::TextInputType RenderWidget::GetTextInputType() { | 1522 ui::TextInputType RenderWidget::GetTextInputType() { |
| (...skipping 562 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2088 bool RenderWidget::isPointerLocked() { | 2085 bool RenderWidget::isPointerLocked() { |
| 2089 return mouse_lock_dispatcher_->IsMouseLockedTo( | 2086 return mouse_lock_dispatcher_->IsMouseLockedTo( |
| 2090 webwidget_mouse_lock_target_.get()); | 2087 webwidget_mouse_lock_target_.get()); |
| 2091 } | 2088 } |
| 2092 | 2089 |
| 2093 blink::WebWidget* RenderWidget::GetWebWidget() const { | 2090 blink::WebWidget* RenderWidget::GetWebWidget() const { |
| 2094 return webwidget_internal_; | 2091 return webwidget_internal_; |
| 2095 } | 2092 } |
| 2096 | 2093 |
| 2097 } // namespace content | 2094 } // namespace content |
| OLD | NEW |