| 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 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 68 #include "content/common/view_messages.h" | 68 #include "content/common/view_messages.h" |
| 69 #include "content/public/common/associated_interface_provider.h" | 69 #include "content/public/common/associated_interface_provider.h" |
| 70 #include "content/public/common/bindings_policy.h" | 70 #include "content/public/common/bindings_policy.h" |
| 71 #include "content/public/common/browser_side_navigation_policy.h" | 71 #include "content/public/common/browser_side_navigation_policy.h" |
| 72 #include "content/public/common/content_constants.h" | 72 #include "content/public/common/content_constants.h" |
| 73 #include "content/public/common/content_features.h" | 73 #include "content/public/common/content_features.h" |
| 74 #include "content/public/common/content_switches.h" | 74 #include "content/public/common/content_switches.h" |
| 75 #include "content/public/common/context_menu_params.h" | 75 #include "content/public/common/context_menu_params.h" |
| 76 #include "content/public/common/file_chooser_file_info.h" | 76 #include "content/public/common/file_chooser_file_info.h" |
| 77 #include "content/public/common/file_chooser_params.h" | 77 #include "content/public/common/file_chooser_params.h" |
| 78 #include "content/public/common/form_field_data.h" |
| 78 #include "content/public/common/isolated_world_ids.h" | 79 #include "content/public/common/isolated_world_ids.h" |
| 79 #include "content/public/common/page_state.h" | 80 #include "content/public/common/page_state.h" |
| 80 #include "content/public/common/resource_response.h" | 81 #include "content/public/common/resource_response.h" |
| 81 #include "content/public/common/service_manager_connection.h" | 82 #include "content/public/common/service_manager_connection.h" |
| 82 #include "content/public/common/service_names.h" | 83 #include "content/public/common/service_names.h" |
| 83 #include "content/public/common/url_constants.h" | 84 #include "content/public/common/url_constants.h" |
| 84 #include "content/public/common/url_utils.h" | 85 #include "content/public/common/url_utils.h" |
| 85 #include "content/public/renderer/browser_plugin_delegate.h" | 86 #include "content/public/renderer/browser_plugin_delegate.h" |
| 86 #include "content/public/renderer/content_renderer_client.h" | 87 #include "content/public/renderer/content_renderer_client.h" |
| 87 #include "content/public/renderer/context_menu_client.h" | 88 #include "content/public/renderer/context_menu_client.h" |
| (...skipping 1491 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1579 IPC_MESSAGE_HANDLER(FrameMsg_JavaScriptExecuteRequestForTests, | 1580 IPC_MESSAGE_HANDLER(FrameMsg_JavaScriptExecuteRequestForTests, |
| 1580 OnJavaScriptExecuteRequestForTests) | 1581 OnJavaScriptExecuteRequestForTests) |
| 1581 IPC_MESSAGE_HANDLER(FrameMsg_JavaScriptExecuteRequestInIsolatedWorld, | 1582 IPC_MESSAGE_HANDLER(FrameMsg_JavaScriptExecuteRequestInIsolatedWorld, |
| 1582 OnJavaScriptExecuteRequestInIsolatedWorld) | 1583 OnJavaScriptExecuteRequestInIsolatedWorld) |
| 1583 IPC_MESSAGE_HANDLER(FrameMsg_VisualStateRequest, | 1584 IPC_MESSAGE_HANDLER(FrameMsg_VisualStateRequest, |
| 1584 OnVisualStateRequest) | 1585 OnVisualStateRequest) |
| 1585 IPC_MESSAGE_HANDLER(FrameMsg_Reload, OnReload) | 1586 IPC_MESSAGE_HANDLER(FrameMsg_Reload, OnReload) |
| 1586 IPC_MESSAGE_HANDLER(FrameMsg_ReloadLoFiImages, OnReloadLoFiImages) | 1587 IPC_MESSAGE_HANDLER(FrameMsg_ReloadLoFiImages, OnReloadLoFiImages) |
| 1587 IPC_MESSAGE_HANDLER(FrameMsg_TextSurroundingSelectionRequest, | 1588 IPC_MESSAGE_HANDLER(FrameMsg_TextSurroundingSelectionRequest, |
| 1588 OnTextSurroundingSelectionRequest) | 1589 OnTextSurroundingSelectionRequest) |
| 1590 IPC_MESSAGE_HANDLER(FrameMsg_FocusedFormFieldDataRequest, |
| 1591 OnFocusedFormFieldDataRequest) |
| 1589 IPC_MESSAGE_HANDLER(FrameMsg_SetAccessibilityMode, | 1592 IPC_MESSAGE_HANDLER(FrameMsg_SetAccessibilityMode, |
| 1590 OnSetAccessibilityMode) | 1593 OnSetAccessibilityMode) |
| 1591 IPC_MESSAGE_HANDLER(AccessibilityMsg_SnapshotTree, | 1594 IPC_MESSAGE_HANDLER(AccessibilityMsg_SnapshotTree, |
| 1592 OnSnapshotAccessibilityTree) | 1595 OnSnapshotAccessibilityTree) |
| 1593 IPC_MESSAGE_HANDLER(FrameMsg_UpdateOpener, OnUpdateOpener) | 1596 IPC_MESSAGE_HANDLER(FrameMsg_UpdateOpener, OnUpdateOpener) |
| 1594 IPC_MESSAGE_HANDLER(FrameMsg_CommitNavigation, OnCommitNavigation) | 1597 IPC_MESSAGE_HANDLER(FrameMsg_CommitNavigation, OnCommitNavigation) |
| 1595 IPC_MESSAGE_HANDLER(FrameMsg_DidUpdateSandboxFlags, OnDidUpdateSandboxFlags) | 1598 IPC_MESSAGE_HANDLER(FrameMsg_DidUpdateSandboxFlags, OnDidUpdateSandboxFlags) |
| 1596 IPC_MESSAGE_HANDLER(FrameMsg_SetFrameOwnerProperties, | 1599 IPC_MESSAGE_HANDLER(FrameMsg_SetFrameOwnerProperties, |
| 1597 OnSetFrameOwnerProperties) | 1600 OnSetFrameOwnerProperties) |
| 1598 IPC_MESSAGE_HANDLER(FrameMsg_AdvanceFocus, OnAdvanceFocus) | 1601 IPC_MESSAGE_HANDLER(FrameMsg_AdvanceFocus, OnAdvanceFocus) |
| (...skipping 710 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2309 return; | 2312 return; |
| 2310 } | 2313 } |
| 2311 | 2314 |
| 2312 Send(new FrameHostMsg_TextSurroundingSelectionResponse( | 2315 Send(new FrameHostMsg_TextSurroundingSelectionResponse( |
| 2313 routing_id_, | 2316 routing_id_, |
| 2314 surroundingText.textContent(), | 2317 surroundingText.textContent(), |
| 2315 surroundingText.startOffsetInTextContent(), | 2318 surroundingText.startOffsetInTextContent(), |
| 2316 surroundingText.endOffsetInTextContent())); | 2319 surroundingText.endOffsetInTextContent())); |
| 2317 } | 2320 } |
| 2318 | 2321 |
| 2322 void RenderFrameImpl::OnFocusedFormFieldDataRequest(int request_id) { |
| 2323 DCHECK(frame_); |
| 2324 |
| 2325 // In case of early return, the IPC response message is always needed in |
| 2326 // order to avoid leaks in the browser for unacknowledged requests. |
| 2327 if (frame_ != render_view_->GetWebView()->focusedFrame() || |
| 2328 frame_->document().focusedElement().isNull()) { |
| 2329 Send(new FrameHostMsg_FocusedFormFieldDataResponse(routing_id_, request_id, |
| 2330 FormFieldData())); |
| 2331 return; |
| 2332 } |
| 2333 |
| 2334 WebElement element = frame_->document().focusedElement(); |
| 2335 |
| 2336 DCHECK(GetRenderWidget()->GetWebWidget()); |
| 2337 blink::WebTextInputInfo info = |
| 2338 GetRenderWidget()->GetWebWidget()->textInputInfo(); |
| 2339 FormFieldData field; |
| 2340 field.text = info.value.utf8(); |
| 2341 field.placeholder = element.getAttribute("placeholder").utf8(); |
| 2342 field.text_input_type = GetRenderWidget()->GetTextInputType(); |
| 2343 |
| 2344 Send(new FrameHostMsg_FocusedFormFieldDataResponse(routing_id_, request_id, |
| 2345 field)); |
| 2346 } |
| 2347 |
| 2319 bool RenderFrameImpl::RunJavaScriptMessage(JavaScriptMessageType type, | 2348 bool RenderFrameImpl::RunJavaScriptMessage(JavaScriptMessageType type, |
| 2320 const base::string16& message, | 2349 const base::string16& message, |
| 2321 const base::string16& default_value, | 2350 const base::string16& default_value, |
| 2322 const GURL& frame_url, | 2351 const GURL& frame_url, |
| 2323 base::string16* result) { | 2352 base::string16* result) { |
| 2324 // Don't allow further dialogs if we are waiting to swap out, since the | 2353 // Don't allow further dialogs if we are waiting to swap out, since the |
| 2325 // ScopedPageLoadDeferrer in our stack prevents it. | 2354 // ScopedPageLoadDeferrer in our stack prevents it. |
| 2326 if (suppress_further_dialogs_) | 2355 if (suppress_further_dialogs_) |
| 2327 return false; | 2356 return false; |
| 2328 | 2357 |
| (...skipping 4284 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6613 // event target. Potentially a Pepper plugin will receive the event. | 6642 // event target. Potentially a Pepper plugin will receive the event. |
| 6614 // In order to tell whether a plugin gets the last mouse event and which it | 6643 // In order to tell whether a plugin gets the last mouse event and which it |
| 6615 // is, we set |pepper_last_mouse_event_target_| to null here. If a plugin gets | 6644 // is, we set |pepper_last_mouse_event_target_| to null here. If a plugin gets |
| 6616 // the event, it will notify us via DidReceiveMouseEvent() and set itself as | 6645 // the event, it will notify us via DidReceiveMouseEvent() and set itself as |
| 6617 // |pepper_last_mouse_event_target_|. | 6646 // |pepper_last_mouse_event_target_|. |
| 6618 pepper_last_mouse_event_target_ = nullptr; | 6647 pepper_last_mouse_event_target_ = nullptr; |
| 6619 #endif | 6648 #endif |
| 6620 } | 6649 } |
| 6621 | 6650 |
| 6622 } // namespace content | 6651 } // namespace content |
| OLD | NEW |