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 597 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
608 IPC_MESSAGE_HANDLER(InputMsg_ImeSetComposition, OnImeSetComposition) | 608 IPC_MESSAGE_HANDLER(InputMsg_ImeSetComposition, OnImeSetComposition) |
609 IPC_MESSAGE_HANDLER(InputMsg_ImeCommitText, OnImeCommitText) | 609 IPC_MESSAGE_HANDLER(InputMsg_ImeCommitText, OnImeCommitText) |
610 IPC_MESSAGE_HANDLER(InputMsg_ImeFinishComposingText, | 610 IPC_MESSAGE_HANDLER(InputMsg_ImeFinishComposingText, |
611 OnImeFinishComposingText) | 611 OnImeFinishComposingText) |
612 IPC_MESSAGE_HANDLER(InputMsg_MouseCaptureLost, OnMouseCaptureLost) | 612 IPC_MESSAGE_HANDLER(InputMsg_MouseCaptureLost, OnMouseCaptureLost) |
613 IPC_MESSAGE_HANDLER(InputMsg_SetEditCommandsForNextKeyEvent, | 613 IPC_MESSAGE_HANDLER(InputMsg_SetEditCommandsForNextKeyEvent, |
614 OnSetEditCommandsForNextKeyEvent) | 614 OnSetEditCommandsForNextKeyEvent) |
615 IPC_MESSAGE_HANDLER(InputMsg_SetFocus, OnSetFocus) | 615 IPC_MESSAGE_HANDLER(InputMsg_SetFocus, OnSetFocus) |
616 IPC_MESSAGE_HANDLER(InputMsg_SyntheticGestureCompleted, | 616 IPC_MESSAGE_HANDLER(InputMsg_SyntheticGestureCompleted, |
617 OnSyntheticGestureCompleted) | 617 OnSyntheticGestureCompleted) |
| 618 IPC_MESSAGE_HANDLER(ViewMsg_ShowContextMenu, OnShowContextMenu) |
618 IPC_MESSAGE_HANDLER(ViewMsg_Close, OnClose) | 619 IPC_MESSAGE_HANDLER(ViewMsg_Close, OnClose) |
619 IPC_MESSAGE_HANDLER(ViewMsg_Resize, OnResize) | 620 IPC_MESSAGE_HANDLER(ViewMsg_Resize, OnResize) |
620 IPC_MESSAGE_HANDLER(ViewMsg_EnableDeviceEmulation, | 621 IPC_MESSAGE_HANDLER(ViewMsg_EnableDeviceEmulation, |
621 OnEnableDeviceEmulation) | 622 OnEnableDeviceEmulation) |
622 IPC_MESSAGE_HANDLER(ViewMsg_DisableDeviceEmulation, | 623 IPC_MESSAGE_HANDLER(ViewMsg_DisableDeviceEmulation, |
623 OnDisableDeviceEmulation) | 624 OnDisableDeviceEmulation) |
624 IPC_MESSAGE_HANDLER(ViewMsg_WasHidden, OnWasHidden) | 625 IPC_MESSAGE_HANDLER(ViewMsg_WasHidden, OnWasHidden) |
625 IPC_MESSAGE_HANDLER(ViewMsg_WasShown, OnWasShown) | 626 IPC_MESSAGE_HANDLER(ViewMsg_WasShown, OnWasShown) |
626 IPC_MESSAGE_HANDLER(ViewMsg_Repaint, OnRepaint) | 627 IPC_MESSAGE_HANDLER(ViewMsg_Repaint, OnRepaint) |
627 IPC_MESSAGE_HANDLER(ViewMsg_SetTextDirection, OnSetTextDirection) | 628 IPC_MESSAGE_HANDLER(ViewMsg_SetTextDirection, OnSetTextDirection) |
(...skipping 951 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1579 pending_window_rect_count_++; | 1580 pending_window_rect_count_++; |
1580 | 1581 |
1581 // 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 |
1582 // values. | 1583 // values. |
1583 if (popup_type_ != blink::kWebPopupTypeNone) { | 1584 if (popup_type_ != blink::kWebPopupTypeNone) { |
1584 window_screen_rect_ = rect; | 1585 window_screen_rect_ = rect; |
1585 view_screen_rect_ = rect; | 1586 view_screen_rect_ = rect; |
1586 } | 1587 } |
1587 } | 1588 } |
1588 | 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 static_cast<blink::WebMenuSourceType>(source_type)); |
| 1598 } |
| 1599 has_host_context_menu_location_ = false; |
| 1600 } |
| 1601 |
1589 void RenderWidget::OnImeSetComposition( | 1602 void RenderWidget::OnImeSetComposition( |
1590 const base::string16& text, | 1603 const base::string16& text, |
1591 const std::vector<WebCompositionUnderline>& underlines, | 1604 const std::vector<WebCompositionUnderline>& underlines, |
1592 const gfx::Range& replacement_range, | 1605 const gfx::Range& replacement_range, |
1593 int selection_start, int selection_end) { | 1606 int selection_start, int selection_end) { |
1594 if (!ShouldHandleImeEvents()) | 1607 if (!ShouldHandleImeEvents()) |
1595 return; | 1608 return; |
1596 | 1609 |
1597 #if BUILDFLAG(ENABLE_PLUGINS) | 1610 #if BUILDFLAG(ENABLE_PLUGINS) |
1598 if (focused_pepper_plugin_) { | 1611 if (focused_pepper_plugin_) { |
(...skipping 742 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2341 // browser side (https://crbug.com/669219). | 2354 // browser side (https://crbug.com/669219). |
2342 // If there is no WebFrameWidget, then there will be no | 2355 // If there is no WebFrameWidget, then there will be no |
2343 // InputMethodControllers for a WebLocalFrame. | 2356 // InputMethodControllers for a WebLocalFrame. |
2344 return nullptr; | 2357 return nullptr; |
2345 } | 2358 } |
2346 return static_cast<blink::WebFrameWidget*>(GetWebWidget()) | 2359 return static_cast<blink::WebFrameWidget*>(GetWebWidget()) |
2347 ->GetActiveWebInputMethodController(); | 2360 ->GetActiveWebInputMethodController(); |
2348 } | 2361 } |
2349 | 2362 |
2350 } // namespace content | 2363 } // namespace content |
OLD | NEW |