| 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 1565 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1576 IPC_MESSAGE_HANDLER(FrameMsg_SerializeAsMHTML, OnSerializeAsMHTML) | 1576 IPC_MESSAGE_HANDLER(FrameMsg_SerializeAsMHTML, OnSerializeAsMHTML) |
| 1577 IPC_MESSAGE_HANDLER(FrameMsg_Find, OnFind) | 1577 IPC_MESSAGE_HANDLER(FrameMsg_Find, OnFind) |
| 1578 IPC_MESSAGE_HANDLER(FrameMsg_ClearActiveFindMatch, OnClearActiveFindMatch) | 1578 IPC_MESSAGE_HANDLER(FrameMsg_ClearActiveFindMatch, OnClearActiveFindMatch) |
| 1579 IPC_MESSAGE_HANDLER(FrameMsg_StopFinding, OnStopFinding) | 1579 IPC_MESSAGE_HANDLER(FrameMsg_StopFinding, OnStopFinding) |
| 1580 IPC_MESSAGE_HANDLER(FrameMsg_EnableViewSourceMode, OnEnableViewSourceMode) | 1580 IPC_MESSAGE_HANDLER(FrameMsg_EnableViewSourceMode, OnEnableViewSourceMode) |
| 1581 IPC_MESSAGE_HANDLER(FrameMsg_SuppressFurtherDialogs, | 1581 IPC_MESSAGE_HANDLER(FrameMsg_SuppressFurtherDialogs, |
| 1582 OnSuppressFurtherDialogs) | 1582 OnSuppressFurtherDialogs) |
| 1583 IPC_MESSAGE_HANDLER(FrameMsg_SetHasReceivedUserGesture, | 1583 IPC_MESSAGE_HANDLER(FrameMsg_SetHasReceivedUserGesture, |
| 1584 OnSetHasReceivedUserGesture) | 1584 OnSetHasReceivedUserGesture) |
| 1585 IPC_MESSAGE_HANDLER(FrameMsg_RunFileChooserResponse, OnFileChooserResponse) | 1585 IPC_MESSAGE_HANDLER(FrameMsg_RunFileChooserResponse, OnFileChooserResponse) |
| 1586 IPC_MESSAGE_HANDLER(FrameMsg_ClearFocusedElement, OnClearFocusedElement) |
| 1586 #if defined(OS_ANDROID) | 1587 #if defined(OS_ANDROID) |
| 1587 IPC_MESSAGE_HANDLER(FrameMsg_ActivateNearestFindResult, | 1588 IPC_MESSAGE_HANDLER(FrameMsg_ActivateNearestFindResult, |
| 1588 OnActivateNearestFindResult) | 1589 OnActivateNearestFindResult) |
| 1589 IPC_MESSAGE_HANDLER(FrameMsg_GetNearestFindResult, | 1590 IPC_MESSAGE_HANDLER(FrameMsg_GetNearestFindResult, |
| 1590 OnGetNearestFindResult) | 1591 OnGetNearestFindResult) |
| 1591 IPC_MESSAGE_HANDLER(FrameMsg_FindMatchRects, OnFindMatchRects) | 1592 IPC_MESSAGE_HANDLER(FrameMsg_FindMatchRects, OnFindMatchRects) |
| 1592 #endif | 1593 #endif |
| 1593 | 1594 |
| 1594 #if defined(USE_EXTERNAL_POPUP_MENU) | 1595 #if defined(USE_EXTERNAL_POPUP_MENU) |
| 1595 #if defined(OS_MACOSX) | 1596 #if defined(OS_MACOSX) |
| (...skipping 3443 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5039 Send(new FrameHostMsg_DidChangeLoadProgress(routing_id_, load_progress)); | 5040 Send(new FrameHostMsg_DidChangeLoadProgress(routing_id_, load_progress)); |
| 5040 } | 5041 } |
| 5041 | 5042 |
| 5042 void RenderFrameImpl::HandleWebAccessibilityEvent( | 5043 void RenderFrameImpl::HandleWebAccessibilityEvent( |
| 5043 const blink::WebAXObject& obj, blink::WebAXEvent event) { | 5044 const blink::WebAXObject& obj, blink::WebAXEvent event) { |
| 5044 if (render_accessibility_) | 5045 if (render_accessibility_) |
| 5045 render_accessibility_->HandleWebAccessibilityEvent(obj, event); | 5046 render_accessibility_->HandleWebAccessibilityEvent(obj, event); |
| 5046 } | 5047 } |
| 5047 | 5048 |
| 5048 void RenderFrameImpl::FocusedNodeChanged(const WebNode& node) { | 5049 void RenderFrameImpl::FocusedNodeChanged(const WebNode& node) { |
| 5050 bool is_editable = false; |
| 5051 gfx::Rect node_bounds; |
| 5052 if (!node.isNull() && node.isElementNode()) { |
| 5053 WebElement element = const_cast<WebNode&>(node).to<WebElement>(); |
| 5054 blink::WebRect rect = element.boundsInViewport(); |
| 5055 GetRenderWidget()->convertViewportToWindow(&rect); |
| 5056 is_editable = element.isEditable(); |
| 5057 node_bounds = gfx::Rect(rect); |
| 5058 } |
| 5059 Send(new FrameHostMsg_FocusedNodeChanged(routing_id_, is_editable, |
| 5060 node_bounds)); |
| 5061 |
| 5049 for (auto& observer : observers_) | 5062 for (auto& observer : observers_) |
| 5050 observer.FocusedNodeChanged(node); | 5063 observer.FocusedNodeChanged(node); |
| 5051 } | 5064 } |
| 5052 | 5065 |
| 5053 void RenderFrameImpl::FocusedNodeChangedForAccessibility(const WebNode& node) { | 5066 void RenderFrameImpl::FocusedNodeChangedForAccessibility(const WebNode& node) { |
| 5054 if (render_accessibility()) | 5067 if (render_accessibility()) |
| 5055 render_accessibility()->AccessibilityFocusedNodeChanged(node); | 5068 render_accessibility()->AccessibilityFocusedNodeChanged(node); |
| 5056 } | 5069 } |
| 5057 | 5070 |
| 5058 // PlzNavigate | 5071 // PlzNavigate |
| (...skipping 549 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5608 } | 5621 } |
| 5609 file_chooser_completions_.pop_front(); | 5622 file_chooser_completions_.pop_front(); |
| 5610 | 5623 |
| 5611 // If there are more pending file chooser requests, schedule one now. | 5624 // If there are more pending file chooser requests, schedule one now. |
| 5612 if (!file_chooser_completions_.empty()) { | 5625 if (!file_chooser_completions_.empty()) { |
| 5613 Send(new FrameHostMsg_RunFileChooser( | 5626 Send(new FrameHostMsg_RunFileChooser( |
| 5614 routing_id_, file_chooser_completions_.front()->params)); | 5627 routing_id_, file_chooser_completions_.front()->params)); |
| 5615 } | 5628 } |
| 5616 } | 5629 } |
| 5617 | 5630 |
| 5631 void RenderFrameImpl::OnClearFocusedElement() { |
| 5632 // TODO(ekaramad): Should we add a method to WebLocalFrame instead and avoid |
| 5633 // calling this on the WebView? |
| 5634 if (auto* webview = render_view_->GetWebView()) |
| 5635 webview->clearFocusedElement(); |
| 5636 } |
| 5637 |
| 5618 #if defined(OS_ANDROID) | 5638 #if defined(OS_ANDROID) |
| 5619 void RenderFrameImpl::OnActivateNearestFindResult(int request_id, | 5639 void RenderFrameImpl::OnActivateNearestFindResult(int request_id, |
| 5620 float x, | 5640 float x, |
| 5621 float y) { | 5641 float y) { |
| 5622 WebRect selection_rect; | 5642 WebRect selection_rect; |
| 5623 int ordinal = | 5643 int ordinal = |
| 5624 frame_->selectNearestFindMatch(WebFloatPoint(x, y), &selection_rect); | 5644 frame_->selectNearestFindMatch(WebFloatPoint(x, y), &selection_rect); |
| 5625 if (ordinal == -1) { | 5645 if (ordinal == -1) { |
| 5626 // Something went wrong, so send a no-op reply (force the frame to report | 5646 // Something went wrong, so send a no-op reply (force the frame to report |
| 5627 // the current match count) in case the host is waiting for a response due | 5647 // the current match count) in case the host is waiting for a response due |
| (...skipping 1099 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6727 // event target. Potentially a Pepper plugin will receive the event. | 6747 // event target. Potentially a Pepper plugin will receive the event. |
| 6728 // In order to tell whether a plugin gets the last mouse event and which it | 6748 // In order to tell whether a plugin gets the last mouse event and which it |
| 6729 // is, we set |pepper_last_mouse_event_target_| to null here. If a plugin gets | 6749 // is, we set |pepper_last_mouse_event_target_| to null here. If a plugin gets |
| 6730 // the event, it will notify us via DidReceiveMouseEvent() and set itself as | 6750 // the event, it will notify us via DidReceiveMouseEvent() and set itself as |
| 6731 // |pepper_last_mouse_event_target_|. | 6751 // |pepper_last_mouse_event_target_|. |
| 6732 pepper_last_mouse_event_target_ = nullptr; | 6752 pepper_last_mouse_event_target_ = nullptr; |
| 6733 #endif | 6753 #endif |
| 6734 } | 6754 } |
| 6735 | 6755 |
| 6736 } // namespace content | 6756 } // namespace content |
| OLD | NEW |