| 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 491 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 502 IPC_MESSAGE_HANDLER(ViewMsg_EnableDeviceEmulation, | 502 IPC_MESSAGE_HANDLER(ViewMsg_EnableDeviceEmulation, |
| 503 OnEnableDeviceEmulation) | 503 OnEnableDeviceEmulation) |
| 504 IPC_MESSAGE_HANDLER(ViewMsg_DisableDeviceEmulation, | 504 IPC_MESSAGE_HANDLER(ViewMsg_DisableDeviceEmulation, |
| 505 OnDisableDeviceEmulation) | 505 OnDisableDeviceEmulation) |
| 506 IPC_MESSAGE_HANDLER(ViewMsg_WasHidden, OnWasHidden) | 506 IPC_MESSAGE_HANDLER(ViewMsg_WasHidden, OnWasHidden) |
| 507 IPC_MESSAGE_HANDLER(ViewMsg_WasShown, OnWasShown) | 507 IPC_MESSAGE_HANDLER(ViewMsg_WasShown, OnWasShown) |
| 508 IPC_MESSAGE_HANDLER(ViewMsg_Repaint, OnRepaint) | 508 IPC_MESSAGE_HANDLER(ViewMsg_Repaint, OnRepaint) |
| 509 IPC_MESSAGE_HANDLER(ViewMsg_SetTextDirection, OnSetTextDirection) | 509 IPC_MESSAGE_HANDLER(ViewMsg_SetTextDirection, OnSetTextDirection) |
| 510 IPC_MESSAGE_HANDLER(ViewMsg_Move_ACK, OnRequestMoveAck) | 510 IPC_MESSAGE_HANDLER(ViewMsg_Move_ACK, OnRequestMoveAck) |
| 511 IPC_MESSAGE_HANDLER(ViewMsg_UpdateScreenRects, OnUpdateScreenRects) | 511 IPC_MESSAGE_HANDLER(ViewMsg_UpdateScreenRects, OnUpdateScreenRects) |
| 512 IPC_MESSAGE_HANDLER(ViewMsg_SetFrameSinkId, OnSetFrameSinkId) | |
| 513 IPC_MESSAGE_HANDLER(ViewMsg_WaitForNextFrameForTests, | 512 IPC_MESSAGE_HANDLER(ViewMsg_WaitForNextFrameForTests, |
| 514 OnWaitNextFrameForTests) | 513 OnWaitNextFrameForTests) |
| 515 IPC_MESSAGE_HANDLER(InputMsg_RequestCompositionUpdate, | 514 IPC_MESSAGE_HANDLER(InputMsg_RequestCompositionUpdate, |
| 516 OnRequestCompositionUpdate) | 515 OnRequestCompositionUpdate) |
| 517 #if defined(OS_ANDROID) | 516 #if defined(OS_ANDROID) |
| 518 IPC_MESSAGE_HANDLER(InputMsg_ImeEventAck, OnImeEventAck) | 517 IPC_MESSAGE_HANDLER(InputMsg_ImeEventAck, OnImeEventAck) |
| 519 IPC_MESSAGE_HANDLER(InputMsg_RequestTextInputStateUpdate, | 518 IPC_MESSAGE_HANDLER(InputMsg_RequestTextInputStateUpdate, |
| 520 OnRequestTextInputStateUpdate) | 519 OnRequestTextInputStateUpdate) |
| 521 #endif | 520 #endif |
| 522 IPC_MESSAGE_HANDLER(ViewMsg_HandleCompositorProto, OnHandleCompositorProto) | 521 IPC_MESSAGE_HANDLER(ViewMsg_HandleCompositorProto, OnHandleCompositorProto) |
| (...skipping 585 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1108 compositor_deps_); | 1107 compositor_deps_); |
| 1109 compositor_->setViewportSize(physical_backing_size_); | 1108 compositor_->setViewportSize(physical_backing_size_); |
| 1110 OnDeviceScaleFactorChanged(); | 1109 OnDeviceScaleFactorChanged(); |
| 1111 compositor_->SetDeviceColorSpace(screen_info_.icc_profile.GetColorSpace()); | 1110 compositor_->SetDeviceColorSpace(screen_info_.icc_profile.GetColorSpace()); |
| 1112 // For background pages and certain tests, we don't want to trigger | 1111 // For background pages and certain tests, we don't want to trigger |
| 1113 // CompositorFrameSink creation. | 1112 // CompositorFrameSink creation. |
| 1114 if (compositor_never_visible_ || !RenderThreadImpl::current()) | 1113 if (compositor_never_visible_ || !RenderThreadImpl::current()) |
| 1115 compositor_->SetNeverVisible(); | 1114 compositor_->SetNeverVisible(); |
| 1116 | 1115 |
| 1117 StartCompositor(); | 1116 StartCompositor(); |
| 1117 DCHECK_NE(MSG_ROUTING_NONE, routing_id_); |
| 1118 compositor_->SetFrameSinkId( |
| 1119 cc::FrameSinkId(RenderThread::Get()->GetClientId(), routing_id_)); |
| 1118 } | 1120 } |
| 1119 | 1121 |
| 1120 void RenderWidget::WillCloseLayerTreeView() { | 1122 void RenderWidget::WillCloseLayerTreeView() { |
| 1121 if (host_closing_) | 1123 if (host_closing_) |
| 1122 return; | 1124 return; |
| 1123 | 1125 |
| 1124 // Prevent new compositors or output surfaces from being created. | 1126 // Prevent new compositors or output surfaces from being created. |
| 1125 host_closing_ = true; | 1127 host_closing_ = true; |
| 1126 | 1128 |
| 1127 // Always send this notification to prevent new layer tree views from | 1129 // Always send this notification to prevent new layer tree views from |
| (...skipping 374 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1502 } | 1504 } |
| 1503 | 1505 |
| 1504 void RenderWidget::OnUpdateWindowScreenRect( | 1506 void RenderWidget::OnUpdateWindowScreenRect( |
| 1505 const gfx::Rect& window_screen_rect) { | 1507 const gfx::Rect& window_screen_rect) { |
| 1506 if (screen_metrics_emulator_) | 1508 if (screen_metrics_emulator_) |
| 1507 screen_metrics_emulator_->OnUpdateWindowScreenRect(window_screen_rect); | 1509 screen_metrics_emulator_->OnUpdateWindowScreenRect(window_screen_rect); |
| 1508 else | 1510 else |
| 1509 window_screen_rect_ = window_screen_rect; | 1511 window_screen_rect_ = window_screen_rect; |
| 1510 } | 1512 } |
| 1511 | 1513 |
| 1512 void RenderWidget::OnSetFrameSinkId(const cc::FrameSinkId& frame_sink_id) { | |
| 1513 if (compositor_) | |
| 1514 compositor_->SetFrameSinkId(frame_sink_id); | |
| 1515 } | |
| 1516 | |
| 1517 void RenderWidget::OnHandleCompositorProto(const std::vector<uint8_t>& proto) { | 1514 void RenderWidget::OnHandleCompositorProto(const std::vector<uint8_t>& proto) { |
| 1518 if (compositor_) | 1515 if (compositor_) |
| 1519 compositor_->OnHandleCompositorProto(proto); | 1516 compositor_->OnHandleCompositorProto(proto); |
| 1520 } | 1517 } |
| 1521 | 1518 |
| 1522 void RenderWidget::showImeIfNeeded() { | 1519 void RenderWidget::showImeIfNeeded() { |
| 1523 #if defined(OS_ANDROID) || defined(USE_AURA) | 1520 #if defined(OS_ANDROID) || defined(USE_AURA) |
| 1524 UpdateTextInputState(ShowIme::IF_NEEDED, ChangeSource::FROM_NON_IME); | 1521 UpdateTextInputState(ShowIme::IF_NEEDED, ChangeSource::FROM_NON_IME); |
| 1525 #endif | 1522 #endif |
| 1526 | 1523 |
| (...skipping 540 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2067 bool RenderWidget::isPointerLocked() { | 2064 bool RenderWidget::isPointerLocked() { |
| 2068 return mouse_lock_dispatcher_->IsMouseLockedTo( | 2065 return mouse_lock_dispatcher_->IsMouseLockedTo( |
| 2069 webwidget_mouse_lock_target_.get()); | 2066 webwidget_mouse_lock_target_.get()); |
| 2070 } | 2067 } |
| 2071 | 2068 |
| 2072 blink::WebWidget* RenderWidget::GetWebWidget() const { | 2069 blink::WebWidget* RenderWidget::GetWebWidget() const { |
| 2073 return webwidget_internal_; | 2070 return webwidget_internal_; |
| 2074 } | 2071 } |
| 2075 | 2072 |
| 2076 } // namespace content | 2073 } // namespace content |
| OLD | NEW |