| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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_frame_impl.h" | 5 #include "content/renderer/render_frame_impl.h" |
| 6 | 6 |
| 7 #include <map> | 7 #include <map> |
| 8 #include <string> | 8 #include <string> |
| 9 #include <utility> | 9 #include <utility> |
| 10 #include <vector> | 10 #include <vector> |
| (...skipping 1611 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1622 IPC_MESSAGE_HANDLER(FrameMsg_SerializeAsMHTML, OnSerializeAsMHTML) | 1622 IPC_MESSAGE_HANDLER(FrameMsg_SerializeAsMHTML, OnSerializeAsMHTML) |
| 1623 IPC_MESSAGE_HANDLER(FrameMsg_Find, OnFind) | 1623 IPC_MESSAGE_HANDLER(FrameMsg_Find, OnFind) |
| 1624 IPC_MESSAGE_HANDLER(FrameMsg_ClearActiveFindMatch, OnClearActiveFindMatch) | 1624 IPC_MESSAGE_HANDLER(FrameMsg_ClearActiveFindMatch, OnClearActiveFindMatch) |
| 1625 IPC_MESSAGE_HANDLER(FrameMsg_StopFinding, OnStopFinding) | 1625 IPC_MESSAGE_HANDLER(FrameMsg_StopFinding, OnStopFinding) |
| 1626 IPC_MESSAGE_HANDLER(FrameMsg_EnableViewSourceMode, OnEnableViewSourceMode) | 1626 IPC_MESSAGE_HANDLER(FrameMsg_EnableViewSourceMode, OnEnableViewSourceMode) |
| 1627 IPC_MESSAGE_HANDLER(FrameMsg_SuppressFurtherDialogs, | 1627 IPC_MESSAGE_HANDLER(FrameMsg_SuppressFurtherDialogs, |
| 1628 OnSuppressFurtherDialogs) | 1628 OnSuppressFurtherDialogs) |
| 1629 IPC_MESSAGE_HANDLER(FrameMsg_SetHasReceivedUserGesture, | 1629 IPC_MESSAGE_HANDLER(FrameMsg_SetHasReceivedUserGesture, |
| 1630 OnSetHasReceivedUserGesture) | 1630 OnSetHasReceivedUserGesture) |
| 1631 IPC_MESSAGE_HANDLER(FrameMsg_RunFileChooserResponse, OnFileChooserResponse) | 1631 IPC_MESSAGE_HANDLER(FrameMsg_RunFileChooserResponse, OnFileChooserResponse) |
| 1632 IPC_MESSAGE_HANDLER(FrameMsg_ClearFocusedElement, OnClearFocusedElement) |
| 1632 #if defined(OS_ANDROID) | 1633 #if defined(OS_ANDROID) |
| 1633 IPC_MESSAGE_HANDLER(FrameMsg_ActivateNearestFindResult, | 1634 IPC_MESSAGE_HANDLER(FrameMsg_ActivateNearestFindResult, |
| 1634 OnActivateNearestFindResult) | 1635 OnActivateNearestFindResult) |
| 1635 IPC_MESSAGE_HANDLER(FrameMsg_GetNearestFindResult, | 1636 IPC_MESSAGE_HANDLER(FrameMsg_GetNearestFindResult, |
| 1636 OnGetNearestFindResult) | 1637 OnGetNearestFindResult) |
| 1637 IPC_MESSAGE_HANDLER(FrameMsg_FindMatchRects, OnFindMatchRects) | 1638 IPC_MESSAGE_HANDLER(FrameMsg_FindMatchRects, OnFindMatchRects) |
| 1638 #endif | 1639 #endif |
| 1639 | 1640 |
| 1640 #if defined(USE_EXTERNAL_POPUP_MENU) | 1641 #if defined(USE_EXTERNAL_POPUP_MENU) |
| 1641 #if defined(OS_MACOSX) | 1642 #if defined(OS_MACOSX) |
| (...skipping 3354 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4996 Send(new FrameHostMsg_DidChangeLoadProgress(routing_id_, load_progress)); | 4997 Send(new FrameHostMsg_DidChangeLoadProgress(routing_id_, load_progress)); |
| 4997 } | 4998 } |
| 4998 | 4999 |
| 4999 void RenderFrameImpl::HandleWebAccessibilityEvent( | 5000 void RenderFrameImpl::HandleWebAccessibilityEvent( |
| 5000 const blink::WebAXObject& obj, blink::WebAXEvent event) { | 5001 const blink::WebAXObject& obj, blink::WebAXEvent event) { |
| 5001 if (render_accessibility_) | 5002 if (render_accessibility_) |
| 5002 render_accessibility_->HandleWebAccessibilityEvent(obj, event); | 5003 render_accessibility_->HandleWebAccessibilityEvent(obj, event); |
| 5003 } | 5004 } |
| 5004 | 5005 |
| 5005 void RenderFrameImpl::FocusedNodeChanged(const WebNode& node) { | 5006 void RenderFrameImpl::FocusedNodeChanged(const WebNode& node) { |
| 5007 bool is_editable = false; |
| 5008 gfx::Rect node_bounds; |
| 5009 if (!node.isNull() && node.isElementNode()) { |
| 5010 WebElement element = const_cast<WebNode&>(node).to<WebElement>(); |
| 5011 blink::WebRect rect = element.boundsInViewport(); |
| 5012 GetRenderWidget()->convertViewportToWindow(&rect); |
| 5013 is_editable = element.isEditable(); |
| 5014 node_bounds = gfx::Rect(rect); |
| 5015 } |
| 5016 Send(new FrameHostMsg_FocusedNodeChanged(routing_id_, is_editable, |
| 5017 node_bounds)); |
| 5018 |
| 5006 for (auto& observer : observers_) | 5019 for (auto& observer : observers_) |
| 5007 observer.FocusedNodeChanged(node); | 5020 observer.FocusedNodeChanged(node); |
| 5008 } | 5021 } |
| 5009 | 5022 |
| 5010 void RenderFrameImpl::FocusedNodeChangedForAccessibility(const WebNode& node) { | 5023 void RenderFrameImpl::FocusedNodeChangedForAccessibility(const WebNode& node) { |
| 5011 if (render_accessibility()) | 5024 if (render_accessibility()) |
| 5012 render_accessibility()->AccessibilityFocusedNodeChanged(node); | 5025 render_accessibility()->AccessibilityFocusedNodeChanged(node); |
| 5013 } | 5026 } |
| 5014 | 5027 |
| 5015 // PlzNavigate | 5028 // PlzNavigate |
| (...skipping 544 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5560 } | 5573 } |
| 5561 file_chooser_completions_.pop_front(); | 5574 file_chooser_completions_.pop_front(); |
| 5562 | 5575 |
| 5563 // If there are more pending file chooser requests, schedule one now. | 5576 // If there are more pending file chooser requests, schedule one now. |
| 5564 if (!file_chooser_completions_.empty()) { | 5577 if (!file_chooser_completions_.empty()) { |
| 5565 Send(new FrameHostMsg_RunFileChooser( | 5578 Send(new FrameHostMsg_RunFileChooser( |
| 5566 routing_id_, file_chooser_completions_.front()->params)); | 5579 routing_id_, file_chooser_completions_.front()->params)); |
| 5567 } | 5580 } |
| 5568 } | 5581 } |
| 5569 | 5582 |
| 5583 void RenderFrameImpl::OnClearFocusedElement() { |
| 5584 // TODO(ekaramad): Should we add a method to WebLocalFrame instead and avoid |
| 5585 // calling this on the WebView? |
| 5586 if (auto* webview = render_view_->GetWebView()) |
| 5587 webview->clearFocusedElement(); |
| 5588 } |
| 5589 |
| 5570 #if defined(OS_ANDROID) | 5590 #if defined(OS_ANDROID) |
| 5571 void RenderFrameImpl::OnActivateNearestFindResult(int request_id, | 5591 void RenderFrameImpl::OnActivateNearestFindResult(int request_id, |
| 5572 float x, | 5592 float x, |
| 5573 float y) { | 5593 float y) { |
| 5574 WebRect selection_rect; | 5594 WebRect selection_rect; |
| 5575 int ordinal = | 5595 int ordinal = |
| 5576 frame_->selectNearestFindMatch(WebFloatPoint(x, y), &selection_rect); | 5596 frame_->selectNearestFindMatch(WebFloatPoint(x, y), &selection_rect); |
| 5577 if (ordinal == -1) { | 5597 if (ordinal == -1) { |
| 5578 // Something went wrong, so send a no-op reply (force the frame to report | 5598 // Something went wrong, so send a no-op reply (force the frame to report |
| 5579 // the current match count) in case the host is waiting for a response due | 5599 // the current match count) in case the host is waiting for a response due |
| (...skipping 1059 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6639 // event target. Potentially a Pepper plugin will receive the event. | 6659 // event target. Potentially a Pepper plugin will receive the event. |
| 6640 // In order to tell whether a plugin gets the last mouse event and which it | 6660 // In order to tell whether a plugin gets the last mouse event and which it |
| 6641 // is, we set |pepper_last_mouse_event_target_| to null here. If a plugin gets | 6661 // is, we set |pepper_last_mouse_event_target_| to null here. If a plugin gets |
| 6642 // the event, it will notify us via DidReceiveMouseEvent() and set itself as | 6662 // the event, it will notify us via DidReceiveMouseEvent() and set itself as |
| 6643 // |pepper_last_mouse_event_target_|. | 6663 // |pepper_last_mouse_event_target_|. |
| 6644 pepper_last_mouse_event_target_ = nullptr; | 6664 pepper_last_mouse_event_target_ = nullptr; |
| 6645 #endif | 6665 #endif |
| 6646 } | 6666 } |
| 6647 | 6667 |
| 6648 } // namespace content | 6668 } // namespace content |
| OLD | NEW |