| 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 "base/auto_reset.h" | 7 #include "base/auto_reset.h" |
| 8 #include "base/bind.h" | 8 #include "base/bind.h" |
| 9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
| 10 #include "base/logging.h" | 10 #include "base/logging.h" |
| (...skipping 645 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 656 IPC_BEGIN_MESSAGE_MAP(RenderWidget, message) | 656 IPC_BEGIN_MESSAGE_MAP(RenderWidget, message) |
| 657 IPC_MESSAGE_HANDLER(InputMsg_HandleInputEvent, OnHandleInputEvent) | 657 IPC_MESSAGE_HANDLER(InputMsg_HandleInputEvent, OnHandleInputEvent) |
| 658 IPC_MESSAGE_HANDLER(InputMsg_CursorVisibilityChange, | 658 IPC_MESSAGE_HANDLER(InputMsg_CursorVisibilityChange, |
| 659 OnCursorVisibilityChange) | 659 OnCursorVisibilityChange) |
| 660 IPC_MESSAGE_HANDLER(InputMsg_ImeSetComposition, OnImeSetComposition) | 660 IPC_MESSAGE_HANDLER(InputMsg_ImeSetComposition, OnImeSetComposition) |
| 661 IPC_MESSAGE_HANDLER(InputMsg_ImeConfirmComposition, OnImeConfirmComposition) | 661 IPC_MESSAGE_HANDLER(InputMsg_ImeConfirmComposition, OnImeConfirmComposition) |
| 662 IPC_MESSAGE_HANDLER(InputMsg_MouseCaptureLost, OnMouseCaptureLost) | 662 IPC_MESSAGE_HANDLER(InputMsg_MouseCaptureLost, OnMouseCaptureLost) |
| 663 IPC_MESSAGE_HANDLER(InputMsg_SetFocus, OnSetFocus) | 663 IPC_MESSAGE_HANDLER(InputMsg_SetFocus, OnSetFocus) |
| 664 IPC_MESSAGE_HANDLER(InputMsg_SyntheticGestureCompleted, | 664 IPC_MESSAGE_HANDLER(InputMsg_SyntheticGestureCompleted, |
| 665 OnSyntheticGestureCompleted) | 665 OnSyntheticGestureCompleted) |
| 666 #if defined(OS_MACOSX) |
| 667 IPC_MESSAGE_HANDLER(InputMsg_SelectWordIfAnyAtCoordinates, |
| 668 OnSelectWordIfAnyAtCoordinates) |
| 669 #endif |
| 666 IPC_MESSAGE_HANDLER(ViewMsg_Close, OnClose) | 670 IPC_MESSAGE_HANDLER(ViewMsg_Close, OnClose) |
| 667 IPC_MESSAGE_HANDLER(ViewMsg_Resize, OnResize) | 671 IPC_MESSAGE_HANDLER(ViewMsg_Resize, OnResize) |
| 668 IPC_MESSAGE_HANDLER(ViewMsg_EnableDeviceEmulation, | 672 IPC_MESSAGE_HANDLER(ViewMsg_EnableDeviceEmulation, |
| 669 OnEnableDeviceEmulation) | 673 OnEnableDeviceEmulation) |
| 670 IPC_MESSAGE_HANDLER(ViewMsg_DisableDeviceEmulation, | 674 IPC_MESSAGE_HANDLER(ViewMsg_DisableDeviceEmulation, |
| 671 OnDisableDeviceEmulation) | 675 OnDisableDeviceEmulation) |
| 672 IPC_MESSAGE_HANDLER(ViewMsg_ColorProfile, OnColorProfile) | 676 IPC_MESSAGE_HANDLER(ViewMsg_ColorProfile, OnColorProfile) |
| 673 IPC_MESSAGE_HANDLER(ViewMsg_ChangeResizeRect, OnChangeResizeRect) | 677 IPC_MESSAGE_HANDLER(ViewMsg_ChangeResizeRect, OnChangeResizeRect) |
| 674 IPC_MESSAGE_HANDLER(ViewMsg_WasHidden, OnWasHidden) | 678 IPC_MESSAGE_HANDLER(ViewMsg_WasHidden, OnWasHidden) |
| 675 IPC_MESSAGE_HANDLER(ViewMsg_WasShown, OnWasShown) | 679 IPC_MESSAGE_HANDLER(ViewMsg_WasShown, OnWasShown) |
| (...skipping 871 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1547 compositor_->SetNeedsRedrawRect(gfx::Rect(size_to_paint)); | 1551 compositor_->SetNeedsRedrawRect(gfx::Rect(size_to_paint)); |
| 1548 } | 1552 } |
| 1549 | 1553 |
| 1550 void RenderWidget::OnSyntheticGestureCompleted() { | 1554 void RenderWidget::OnSyntheticGestureCompleted() { |
| 1551 DCHECK(!pending_synthetic_gesture_callbacks_.empty()); | 1555 DCHECK(!pending_synthetic_gesture_callbacks_.empty()); |
| 1552 | 1556 |
| 1553 pending_synthetic_gesture_callbacks_.front().Run(); | 1557 pending_synthetic_gesture_callbacks_.front().Run(); |
| 1554 pending_synthetic_gesture_callbacks_.pop(); | 1558 pending_synthetic_gesture_callbacks_.pop(); |
| 1555 } | 1559 } |
| 1556 | 1560 |
| 1561 void RenderWidget::OnSelectWordIfAnyAtCoordinates(float x, float y) { |
| 1562 input_handler_.set_handling_input_event(true); |
| 1563 if (!webwidget_) |
| 1564 return; |
| 1565 |
| 1566 // Send a response if a word has been selected. |
| 1567 if (webwidget_->selectWordIfAnyAtCoordinates(x, y)) |
| 1568 Send(new InputHostMsg_DidSelectWordAtCoordinates(routing_id())); |
| 1569 input_handler_.set_handling_input_event(false); |
| 1570 } |
| 1571 |
| 1557 void RenderWidget::OnSetTextDirection(WebTextDirection direction) { | 1572 void RenderWidget::OnSetTextDirection(WebTextDirection direction) { |
| 1558 if (!webwidget_) | 1573 if (!webwidget_) |
| 1559 return; | 1574 return; |
| 1560 webwidget_->setTextDirection(direction); | 1575 webwidget_->setTextDirection(direction); |
| 1561 } | 1576 } |
| 1562 | 1577 |
| 1563 void RenderWidget::OnUpdateScreenRects(const gfx::Rect& view_screen_rect, | 1578 void RenderWidget::OnUpdateScreenRects(const gfx::Rect& view_screen_rect, |
| 1564 const gfx::Rect& window_screen_rect) { | 1579 const gfx::Rect& window_screen_rect) { |
| 1565 if (screen_metrics_emulator_) { | 1580 if (screen_metrics_emulator_) { |
| 1566 screen_metrics_emulator_->OnUpdateScreenRectsMessage( | 1581 screen_metrics_emulator_->OnUpdateScreenRectsMessage( |
| (...skipping 579 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2146 void RenderWidget::RegisterVideoHoleFrame(RenderFrameImpl* frame) { | 2161 void RenderWidget::RegisterVideoHoleFrame(RenderFrameImpl* frame) { |
| 2147 video_hole_frames_.AddObserver(frame); | 2162 video_hole_frames_.AddObserver(frame); |
| 2148 } | 2163 } |
| 2149 | 2164 |
| 2150 void RenderWidget::UnregisterVideoHoleFrame(RenderFrameImpl* frame) { | 2165 void RenderWidget::UnregisterVideoHoleFrame(RenderFrameImpl* frame) { |
| 2151 video_hole_frames_.RemoveObserver(frame); | 2166 video_hole_frames_.RemoveObserver(frame); |
| 2152 } | 2167 } |
| 2153 #endif // defined(VIDEO_HOLE) | 2168 #endif // defined(VIDEO_HOLE) |
| 2154 | 2169 |
| 2155 } // namespace content | 2170 } // namespace content |
| OLD | NEW |