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 3412 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 5007 Send(new FrameHostMsg_DidChangeLoadProgress(routing_id_, load_progress)); | 5008 Send(new FrameHostMsg_DidChangeLoadProgress(routing_id_, load_progress)); |
| 5008 } | 5009 } |
| 5009 | 5010 |
| 5010 void RenderFrameImpl::HandleWebAccessibilityEvent( | 5011 void RenderFrameImpl::HandleWebAccessibilityEvent( |
| 5011 const blink::WebAXObject& obj, blink::WebAXEvent event) { | 5012 const blink::WebAXObject& obj, blink::WebAXEvent event) { |
| 5012 if (render_accessibility_) | 5013 if (render_accessibility_) |
| 5013 render_accessibility_->HandleWebAccessibilityEvent(obj, event); | 5014 render_accessibility_->HandleWebAccessibilityEvent(obj, event); |
| 5014 } | 5015 } |
| 5015 | 5016 |
| 5016 void RenderFrameImpl::FocusedNodeChanged(const WebNode& node) { | 5017 void RenderFrameImpl::FocusedNodeChanged(const WebNode& node) { |
| 5018 gfx::Rect node_bounds; | |
| 5019 bool is_editable = false; | |
| 5020 if (!node.isNull() && node.isElementNode()) { | |
| 5021 WebElement element = const_cast<WebNode&>(node).to<WebElement>(); | |
| 5022 blink::WebRect rect = element.boundsInViewport(); | |
| 5023 GetRenderWidget()->convertViewportToWindow(&rect); | |
| 5024 node_bounds = gfx::Rect(rect); | |
| 5025 is_editable = element.isEditable(); | |
|
nasko
2016/12/21 16:28:36
very minor nit: since is_editable is the first par
EhsanK
2016/12/21 16:37:06
Acknowledged.
| |
| 5026 } | |
| 5027 Send(new FrameHostMsg_FocusedNodeChanged(GetRoutingID(), is_editable, | |
|
nasko
2016/12/21 16:28:36
Just routing_id_ as the rest of the Send() methods
EhsanK
2016/12/21 16:37:06
Acknowledged.
| |
| 5028 node_bounds)); | |
| 5029 | |
| 5017 for (auto& observer : observers_) | 5030 for (auto& observer : observers_) |
| 5018 observer.FocusedNodeChanged(node); | 5031 observer.FocusedNodeChanged(node); |
| 5019 } | 5032 } |
| 5020 | 5033 |
| 5021 void RenderFrameImpl::FocusedNodeChangedForAccessibility(const WebNode& node) { | 5034 void RenderFrameImpl::FocusedNodeChangedForAccessibility(const WebNode& node) { |
| 5022 if (render_accessibility()) | 5035 if (render_accessibility()) |
| 5023 render_accessibility()->AccessibilityFocusedNodeChanged(node); | 5036 render_accessibility()->AccessibilityFocusedNodeChanged(node); |
| 5024 } | 5037 } |
| 5025 | 5038 |
| 5026 // PlzNavigate | 5039 // PlzNavigate |
| (...skipping 549 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 5576 } | 5589 } |
| 5577 file_chooser_completions_.pop_front(); | 5590 file_chooser_completions_.pop_front(); |
| 5578 | 5591 |
| 5579 // If there are more pending file chooser requests, schedule one now. | 5592 // If there are more pending file chooser requests, schedule one now. |
| 5580 if (!file_chooser_completions_.empty()) { | 5593 if (!file_chooser_completions_.empty()) { |
| 5581 Send(new FrameHostMsg_RunFileChooser( | 5594 Send(new FrameHostMsg_RunFileChooser( |
| 5582 routing_id_, file_chooser_completions_.front()->params)); | 5595 routing_id_, file_chooser_completions_.front()->params)); |
| 5583 } | 5596 } |
| 5584 } | 5597 } |
| 5585 | 5598 |
| 5599 void RenderFrameImpl::OnClearFocusedElement() { | |
| 5600 // TODO(ekaramad): Should we add a method to WebLocalFrame instead and avoid | |
| 5601 // calling this on the WebView? | |
| 5602 if (auto* webview = render_view_->GetWebView()) | |
| 5603 webview->clearFocusedElement(); | |
| 5604 } | |
| 5605 | |
| 5586 #if defined(OS_ANDROID) | 5606 #if defined(OS_ANDROID) |
| 5587 void RenderFrameImpl::OnActivateNearestFindResult(int request_id, | 5607 void RenderFrameImpl::OnActivateNearestFindResult(int request_id, |
| 5588 float x, | 5608 float x, |
| 5589 float y) { | 5609 float y) { |
| 5590 WebRect selection_rect; | 5610 WebRect selection_rect; |
| 5591 int ordinal = | 5611 int ordinal = |
| 5592 frame_->selectNearestFindMatch(WebFloatPoint(x, y), &selection_rect); | 5612 frame_->selectNearestFindMatch(WebFloatPoint(x, y), &selection_rect); |
| 5593 if (ordinal == -1) { | 5613 if (ordinal == -1) { |
| 5594 // Something went wrong, so send a no-op reply (force the frame to report | 5614 // Something went wrong, so send a no-op reply (force the frame to report |
| 5595 // the current match count) in case the host is waiting for a response due | 5615 // 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... | |
| 6692 // event target. Potentially a Pepper plugin will receive the event. | 6712 // event target. Potentially a Pepper plugin will receive the event. |
| 6693 // In order to tell whether a plugin gets the last mouse event and which it | 6713 // In order to tell whether a plugin gets the last mouse event and which it |
| 6694 // is, we set |pepper_last_mouse_event_target_| to null here. If a plugin gets | 6714 // is, we set |pepper_last_mouse_event_target_| to null here. If a plugin gets |
| 6695 // the event, it will notify us via DidReceiveMouseEvent() and set itself as | 6715 // the event, it will notify us via DidReceiveMouseEvent() and set itself as |
| 6696 // |pepper_last_mouse_event_target_|. | 6716 // |pepper_last_mouse_event_target_|. |
| 6697 pepper_last_mouse_event_target_ = nullptr; | 6717 pepper_last_mouse_event_target_ = nullptr; |
| 6698 #endif | 6718 #endif |
| 6699 } | 6719 } |
| 6700 | 6720 |
| 6701 } // namespace content | 6721 } // namespace content |
| OLD | NEW |