Chromium Code Reviews| 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 1564 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1575 IPC_MESSAGE_HANDLER(FrameMsg_SerializeAsMHTML, OnSerializeAsMHTML) | 1575 IPC_MESSAGE_HANDLER(FrameMsg_SerializeAsMHTML, OnSerializeAsMHTML) |
| 1576 IPC_MESSAGE_HANDLER(FrameMsg_Find, OnFind) | 1576 IPC_MESSAGE_HANDLER(FrameMsg_Find, OnFind) |
| 1577 IPC_MESSAGE_HANDLER(FrameMsg_ClearActiveFindMatch, OnClearActiveFindMatch) | 1577 IPC_MESSAGE_HANDLER(FrameMsg_ClearActiveFindMatch, OnClearActiveFindMatch) |
| 1578 IPC_MESSAGE_HANDLER(FrameMsg_StopFinding, OnStopFinding) | 1578 IPC_MESSAGE_HANDLER(FrameMsg_StopFinding, OnStopFinding) |
| 1579 IPC_MESSAGE_HANDLER(FrameMsg_EnableViewSourceMode, OnEnableViewSourceMode) | 1579 IPC_MESSAGE_HANDLER(FrameMsg_EnableViewSourceMode, OnEnableViewSourceMode) |
| 1580 IPC_MESSAGE_HANDLER(FrameMsg_SuppressFurtherDialogs, | 1580 IPC_MESSAGE_HANDLER(FrameMsg_SuppressFurtherDialogs, |
| 1581 OnSuppressFurtherDialogs) | 1581 OnSuppressFurtherDialogs) |
| 1582 IPC_MESSAGE_HANDLER(FrameMsg_SetHasReceivedUserGesture, | 1582 IPC_MESSAGE_HANDLER(FrameMsg_SetHasReceivedUserGesture, |
| 1583 OnSetHasReceivedUserGesture) | 1583 OnSetHasReceivedUserGesture) |
| 1584 IPC_MESSAGE_HANDLER(FrameMsg_RunFileChooserResponse, OnFileChooserResponse) | 1584 IPC_MESSAGE_HANDLER(FrameMsg_RunFileChooserResponse, OnFileChooserResponse) |
| 1585 IPC_MESSAGE_HANDLER(FrameMsg_ClearFocusedElement, OnClearFocusedElement) | |
| 1585 #if defined(OS_ANDROID) | 1586 #if defined(OS_ANDROID) |
| 1586 IPC_MESSAGE_HANDLER(FrameMsg_ActivateNearestFindResult, | 1587 IPC_MESSAGE_HANDLER(FrameMsg_ActivateNearestFindResult, |
| 1587 OnActivateNearestFindResult) | 1588 OnActivateNearestFindResult) |
| 1588 IPC_MESSAGE_HANDLER(FrameMsg_GetNearestFindResult, | 1589 IPC_MESSAGE_HANDLER(FrameMsg_GetNearestFindResult, |
| 1589 OnGetNearestFindResult) | 1590 OnGetNearestFindResult) |
| 1590 IPC_MESSAGE_HANDLER(FrameMsg_FindMatchRects, OnFindMatchRects) | 1591 IPC_MESSAGE_HANDLER(FrameMsg_FindMatchRects, OnFindMatchRects) |
| 1591 #endif | 1592 #endif |
| 1592 | 1593 |
| 1593 #if defined(USE_EXTERNAL_POPUP_MENU) | 1594 #if defined(USE_EXTERNAL_POPUP_MENU) |
| 1594 #if defined(OS_MACOSX) | 1595 #if defined(OS_MACOSX) |
| (...skipping 3396 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 4991 Send(new FrameHostMsg_DidChangeLoadProgress(routing_id_, load_progress)); | 4992 Send(new FrameHostMsg_DidChangeLoadProgress(routing_id_, load_progress)); |
| 4992 } | 4993 } |
| 4993 | 4994 |
| 4994 void RenderFrameImpl::HandleWebAccessibilityEvent( | 4995 void RenderFrameImpl::HandleWebAccessibilityEvent( |
| 4995 const blink::WebAXObject& obj, blink::WebAXEvent event) { | 4996 const blink::WebAXObject& obj, blink::WebAXEvent event) { |
| 4996 if (render_accessibility_) | 4997 if (render_accessibility_) |
| 4997 render_accessibility_->HandleWebAccessibilityEvent(obj, event); | 4998 render_accessibility_->HandleWebAccessibilityEvent(obj, event); |
| 4998 } | 4999 } |
| 4999 | 5000 |
| 5000 void RenderFrameImpl::FocusedNodeChanged(const WebNode& node) { | 5001 void RenderFrameImpl::FocusedNodeChanged(const WebNode& node) { |
| 5002 gfx::Rect node_bounds; | |
| 5003 bool is_editable = false; | |
| 5004 if (!node.isNull() && node.isElementNode()) { | |
| 5005 WebElement element = const_cast<WebNode&>(node).to<WebElement>(); | |
| 5006 blink::WebRect rect = element.boundsInViewport(); | |
| 5007 GetRenderWidget()->convertViewportToWindow(&rect); | |
| 5008 node_bounds = gfx::Rect(rect); | |
| 5009 is_editable = element.isEditable(); | |
| 5010 } | |
| 5011 Send(new FrameHostMsg_FocusedNodeChanged(GetRoutingID(), is_editable, | |
| 5012 node_bounds)); | |
| 5013 | |
| 5001 for (auto& observer : observers_) | 5014 for (auto& observer : observers_) |
| 5002 observer.FocusedNodeChanged(node); | 5015 observer.FocusedNodeChanged(node); |
| 5003 } | 5016 } |
| 5004 | 5017 |
| 5005 void RenderFrameImpl::FocusedNodeChangedForAccessibility(const WebNode& node) { | 5018 void RenderFrameImpl::FocusedNodeChangedForAccessibility(const WebNode& node) { |
| 5006 if (render_accessibility()) | 5019 if (render_accessibility()) |
| 5007 render_accessibility()->AccessibilityFocusedNodeChanged(node); | 5020 render_accessibility()->AccessibilityFocusedNodeChanged(node); |
| 5008 } | 5021 } |
| 5009 | 5022 |
| 5010 // PlzNavigate | 5023 // PlzNavigate |
| (...skipping 549 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): The focused element might have changed to an element in | |
| 5585 // another frame from the same renderer process. Should we avoid clearing the | |
| 5586 // element if it is not in this frame? If not maybe handle this in | |
| 5587 // RenderViewImpl? | |
|
ncarter (slow)
2016/12/16 19:17:21
What is the concern here? Do you think we might ha
EhsanK
2016/12/20 16:39:11
My concern was that we end up calling webview->cle
| |
| 5588 if (auto* webview = render_view_->GetWebView()) | |
| 5589 webview->clearFocusedElement(); | |
| 5590 } | |
| 5591 | |
| 5570 #if defined(OS_ANDROID) | 5592 #if defined(OS_ANDROID) |
| 5571 void RenderFrameImpl::OnActivateNearestFindResult(int request_id, | 5593 void RenderFrameImpl::OnActivateNearestFindResult(int request_id, |
| 5572 float x, | 5594 float x, |
| 5573 float y) { | 5595 float y) { |
| 5574 WebRect selection_rect; | 5596 WebRect selection_rect; |
| 5575 int ordinal = | 5597 int ordinal = |
| 5576 frame_->selectNearestFindMatch(WebFloatPoint(x, y), &selection_rect); | 5598 frame_->selectNearestFindMatch(WebFloatPoint(x, y), &selection_rect); |
| 5577 if (ordinal == -1) { | 5599 if (ordinal == -1) { |
| 5578 // Something went wrong, so send a no-op reply (force the frame to report | 5600 // 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 | 5601 // the current match count) in case the host is waiting for a response due |
| (...skipping 1096 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 6676 // event target. Potentially a Pepper plugin will receive the event. | 6698 // event target. Potentially a Pepper plugin will receive the event. |
| 6677 // In order to tell whether a plugin gets the last mouse event and which it | 6699 // In order to tell whether a plugin gets the last mouse event and which it |
| 6678 // is, we set |pepper_last_mouse_event_target_| to null here. If a plugin gets | 6700 // is, we set |pepper_last_mouse_event_target_| to null here. If a plugin gets |
| 6679 // the event, it will notify us via DidReceiveMouseEvent() and set itself as | 6701 // the event, it will notify us via DidReceiveMouseEvent() and set itself as |
| 6680 // |pepper_last_mouse_event_target_|. | 6702 // |pepper_last_mouse_event_target_|. |
| 6681 pepper_last_mouse_event_target_ = nullptr; | 6703 pepper_last_mouse_event_target_ = nullptr; |
| 6682 #endif | 6704 #endif |
| 6683 } | 6705 } |
| 6684 | 6706 |
| 6685 } // namespace content | 6707 } // namespace content |
| OLD | NEW |