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 15 matching lines...) Expand all Loading... |
26 #include "build/build_config.h" | 26 #include "build/build_config.h" |
27 #include "cc/animation/animation_host.h" | 27 #include "cc/animation/animation_host.h" |
28 #include "cc/input/touch_action.h" | 28 #include "cc/input/touch_action.h" |
29 #include "cc/output/compositor_frame_sink.h" | 29 #include "cc/output/compositor_frame_sink.h" |
30 #include "cc/output/copy_output_request.h" | 30 #include "cc/output/copy_output_request.h" |
31 #include "cc/scheduler/begin_frame_source.h" | 31 #include "cc/scheduler/begin_frame_source.h" |
32 #include "cc/trees/layer_tree_host.h" | 32 #include "cc/trees/layer_tree_host.h" |
33 #include "content/common/content_switches_internal.h" | 33 #include "content/common/content_switches_internal.h" |
34 #include "content/common/drag_event_source_info.h" | 34 #include "content/common/drag_event_source_info.h" |
35 #include "content/common/drag_messages.h" | 35 #include "content/common/drag_messages.h" |
| 36 #include "content/common/frame_messages.h" |
36 #include "content/common/input/synthetic_gesture_packet.h" | 37 #include "content/common/input/synthetic_gesture_packet.h" |
37 #include "content/common/input_messages.h" | 38 #include "content/common/input_messages.h" |
38 #include "content/common/render_message_filter.mojom.h" | 39 #include "content/common/render_message_filter.mojom.h" |
39 #include "content/common/swapped_out_messages.h" | 40 #include "content/common/swapped_out_messages.h" |
40 #include "content/common/text_input_state.h" | 41 #include "content/common/text_input_state.h" |
41 #include "content/common/view_messages.h" | 42 #include "content/common/view_messages.h" |
42 #include "content/public/common/content_client.h" | 43 #include "content/public/common/content_client.h" |
43 #include "content/public/common/content_features.h" | 44 #include "content/public/common/content_features.h" |
44 #include "content/public/common/content_switches.h" | 45 #include "content/public/common/content_switches.h" |
45 #include "content/public/common/context_menu_params.h" | 46 #include "content/public/common/context_menu_params.h" |
(...skipping 562 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
608 IPC_MESSAGE_HANDLER(InputMsg_ImeSetComposition, OnImeSetComposition) | 609 IPC_MESSAGE_HANDLER(InputMsg_ImeSetComposition, OnImeSetComposition) |
609 IPC_MESSAGE_HANDLER(InputMsg_ImeCommitText, OnImeCommitText) | 610 IPC_MESSAGE_HANDLER(InputMsg_ImeCommitText, OnImeCommitText) |
610 IPC_MESSAGE_HANDLER(InputMsg_ImeFinishComposingText, | 611 IPC_MESSAGE_HANDLER(InputMsg_ImeFinishComposingText, |
611 OnImeFinishComposingText) | 612 OnImeFinishComposingText) |
612 IPC_MESSAGE_HANDLER(InputMsg_MouseCaptureLost, OnMouseCaptureLost) | 613 IPC_MESSAGE_HANDLER(InputMsg_MouseCaptureLost, OnMouseCaptureLost) |
613 IPC_MESSAGE_HANDLER(InputMsg_SetEditCommandsForNextKeyEvent, | 614 IPC_MESSAGE_HANDLER(InputMsg_SetEditCommandsForNextKeyEvent, |
614 OnSetEditCommandsForNextKeyEvent) | 615 OnSetEditCommandsForNextKeyEvent) |
615 IPC_MESSAGE_HANDLER(InputMsg_SetFocus, OnSetFocus) | 616 IPC_MESSAGE_HANDLER(InputMsg_SetFocus, OnSetFocus) |
616 IPC_MESSAGE_HANDLER(InputMsg_SyntheticGestureCompleted, | 617 IPC_MESSAGE_HANDLER(InputMsg_SyntheticGestureCompleted, |
617 OnSyntheticGestureCompleted) | 618 OnSyntheticGestureCompleted) |
| 619 IPC_MESSAGE_HANDLER(FrameMsg_ShowContextMenu, OnShowContextMenu) |
618 IPC_MESSAGE_HANDLER(ViewMsg_Close, OnClose) | 620 IPC_MESSAGE_HANDLER(ViewMsg_Close, OnClose) |
619 IPC_MESSAGE_HANDLER(ViewMsg_Resize, OnResize) | 621 IPC_MESSAGE_HANDLER(ViewMsg_Resize, OnResize) |
620 IPC_MESSAGE_HANDLER(ViewMsg_EnableDeviceEmulation, | 622 IPC_MESSAGE_HANDLER(ViewMsg_EnableDeviceEmulation, |
621 OnEnableDeviceEmulation) | 623 OnEnableDeviceEmulation) |
622 IPC_MESSAGE_HANDLER(ViewMsg_DisableDeviceEmulation, | 624 IPC_MESSAGE_HANDLER(ViewMsg_DisableDeviceEmulation, |
623 OnDisableDeviceEmulation) | 625 OnDisableDeviceEmulation) |
624 IPC_MESSAGE_HANDLER(ViewMsg_WasHidden, OnWasHidden) | 626 IPC_MESSAGE_HANDLER(ViewMsg_WasHidden, OnWasHidden) |
625 IPC_MESSAGE_HANDLER(ViewMsg_WasShown, OnWasShown) | 627 IPC_MESSAGE_HANDLER(ViewMsg_WasShown, OnWasShown) |
626 IPC_MESSAGE_HANDLER(ViewMsg_Repaint, OnRepaint) | 628 IPC_MESSAGE_HANDLER(ViewMsg_Repaint, OnRepaint) |
627 IPC_MESSAGE_HANDLER(ViewMsg_SetTextDirection, OnSetTextDirection) | 629 IPC_MESSAGE_HANDLER(ViewMsg_SetTextDirection, OnSetTextDirection) |
(...skipping 950 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1578 pending_window_rect_count_++; | 1580 pending_window_rect_count_++; |
1579 | 1581 |
1580 // Popups don't get size updates back from the browser so just store the set | 1582 // Popups don't get size updates back from the browser so just store the set |
1581 // values. | 1583 // values. |
1582 if (popup_type_ != blink::kWebPopupTypeNone) { | 1584 if (popup_type_ != blink::kWebPopupTypeNone) { |
1583 window_screen_rect_ = rect; | 1585 window_screen_rect_ = rect; |
1584 view_screen_rect_ = rect; | 1586 view_screen_rect_ = rect; |
1585 } | 1587 } |
1586 } | 1588 } |
1587 | 1589 |
| 1590 void RenderWidget::OnShowContextMenu(ui::MenuSourceType source_type, |
| 1591 const gfx::Point& location) { |
| 1592 input_handler_->set_context_menu_source_type(source_type); |
| 1593 has_host_context_menu_location_ = true; |
| 1594 host_context_menu_location_ = location; |
| 1595 if (GetWebWidget()) |
| 1596 GetWebWidget()->ShowContextMenu(); |
| 1597 has_host_context_menu_location_ = false; |
| 1598 } |
| 1599 |
1588 void RenderWidget::OnImeSetComposition( | 1600 void RenderWidget::OnImeSetComposition( |
1589 const base::string16& text, | 1601 const base::string16& text, |
1590 const std::vector<WebCompositionUnderline>& underlines, | 1602 const std::vector<WebCompositionUnderline>& underlines, |
1591 const gfx::Range& replacement_range, | 1603 const gfx::Range& replacement_range, |
1592 int selection_start, int selection_end) { | 1604 int selection_start, int selection_end) { |
1593 if (!ShouldHandleImeEvents()) | 1605 if (!ShouldHandleImeEvents()) |
1594 return; | 1606 return; |
1595 | 1607 |
1596 #if BUILDFLAG(ENABLE_PLUGINS) | 1608 #if BUILDFLAG(ENABLE_PLUGINS) |
1597 if (focused_pepper_plugin_) { | 1609 if (focused_pepper_plugin_) { |
(...skipping 742 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2340 // browser side (https://crbug.com/669219). | 2352 // browser side (https://crbug.com/669219). |
2341 // If there is no WebFrameWidget, then there will be no | 2353 // If there is no WebFrameWidget, then there will be no |
2342 // InputMethodControllers for a WebLocalFrame. | 2354 // InputMethodControllers for a WebLocalFrame. |
2343 return nullptr; | 2355 return nullptr; |
2344 } | 2356 } |
2345 return static_cast<blink::WebFrameWidget*>(GetWebWidget()) | 2357 return static_cast<blink::WebFrameWidget*>(GetWebWidget()) |
2346 ->GetActiveWebInputMethodController(); | 2358 ->GetActiveWebInputMethodController(); |
2347 } | 2359 } |
2348 | 2360 |
2349 } // namespace content | 2361 } // namespace content |
OLD | NEW |