| 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/url_constants.h" | 83 #include "content/public/common/url_constants.h" |
| 83 #include "content/public/common/url_utils.h" | 84 #include "content/public/common/url_utils.h" |
| 84 #include "content/public/renderer/browser_plugin_delegate.h" | 85 #include "content/public/renderer/browser_plugin_delegate.h" |
| 85 #include "content/public/renderer/content_renderer_client.h" | 86 #include "content/public/renderer/content_renderer_client.h" |
| 86 #include "content/public/renderer/context_menu_client.h" | 87 #include "content/public/renderer/context_menu_client.h" |
| 87 #include "content/public/renderer/document_state.h" | 88 #include "content/public/renderer/document_state.h" |
| (...skipping 1505 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1593 IPC_MESSAGE_HANDLER(FrameMsg_JavaScriptExecuteRequestForTests, | 1594 IPC_MESSAGE_HANDLER(FrameMsg_JavaScriptExecuteRequestForTests, |
| 1594 OnJavaScriptExecuteRequestForTests) | 1595 OnJavaScriptExecuteRequestForTests) |
| 1595 IPC_MESSAGE_HANDLER(FrameMsg_JavaScriptExecuteRequestInIsolatedWorld, | 1596 IPC_MESSAGE_HANDLER(FrameMsg_JavaScriptExecuteRequestInIsolatedWorld, |
| 1596 OnJavaScriptExecuteRequestInIsolatedWorld) | 1597 OnJavaScriptExecuteRequestInIsolatedWorld) |
| 1597 IPC_MESSAGE_HANDLER(FrameMsg_VisualStateRequest, | 1598 IPC_MESSAGE_HANDLER(FrameMsg_VisualStateRequest, |
| 1598 OnVisualStateRequest) | 1599 OnVisualStateRequest) |
| 1599 IPC_MESSAGE_HANDLER(FrameMsg_Reload, OnReload) | 1600 IPC_MESSAGE_HANDLER(FrameMsg_Reload, OnReload) |
| 1600 IPC_MESSAGE_HANDLER(FrameMsg_ReloadLoFiImages, OnReloadLoFiImages) | 1601 IPC_MESSAGE_HANDLER(FrameMsg_ReloadLoFiImages, OnReloadLoFiImages) |
| 1601 IPC_MESSAGE_HANDLER(FrameMsg_TextSurroundingSelectionRequest, | 1602 IPC_MESSAGE_HANDLER(FrameMsg_TextSurroundingSelectionRequest, |
| 1602 OnTextSurroundingSelectionRequest) | 1603 OnTextSurroundingSelectionRequest) |
| 1604 IPC_MESSAGE_HANDLER(FrameMsg_FocusedFormFieldDataRequest, |
| 1605 OnFocusedFormFieldDataRequest) |
| 1603 IPC_MESSAGE_HANDLER(FrameMsg_SetAccessibilityMode, | 1606 IPC_MESSAGE_HANDLER(FrameMsg_SetAccessibilityMode, |
| 1604 OnSetAccessibilityMode) | 1607 OnSetAccessibilityMode) |
| 1605 IPC_MESSAGE_HANDLER(AccessibilityMsg_SnapshotTree, | 1608 IPC_MESSAGE_HANDLER(AccessibilityMsg_SnapshotTree, |
| 1606 OnSnapshotAccessibilityTree) | 1609 OnSnapshotAccessibilityTree) |
| 1607 IPC_MESSAGE_HANDLER(FrameMsg_UpdateOpener, OnUpdateOpener) | 1610 IPC_MESSAGE_HANDLER(FrameMsg_UpdateOpener, OnUpdateOpener) |
| 1608 IPC_MESSAGE_HANDLER(FrameMsg_CommitNavigation, OnCommitNavigation) | 1611 IPC_MESSAGE_HANDLER(FrameMsg_CommitNavigation, OnCommitNavigation) |
| 1609 IPC_MESSAGE_HANDLER(FrameMsg_DidUpdateSandboxFlags, OnDidUpdateSandboxFlags) | 1612 IPC_MESSAGE_HANDLER(FrameMsg_DidUpdateSandboxFlags, OnDidUpdateSandboxFlags) |
| 1610 IPC_MESSAGE_HANDLER(FrameMsg_SetFrameOwnerProperties, | 1613 IPC_MESSAGE_HANDLER(FrameMsg_SetFrameOwnerProperties, |
| 1611 OnSetFrameOwnerProperties) | 1614 OnSetFrameOwnerProperties) |
| 1612 IPC_MESSAGE_HANDLER(FrameMsg_AdvanceFocus, OnAdvanceFocus) | 1615 IPC_MESSAGE_HANDLER(FrameMsg_AdvanceFocus, OnAdvanceFocus) |
| (...skipping 705 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2318 return; | 2321 return; |
| 2319 } | 2322 } |
| 2320 | 2323 |
| 2321 Send(new FrameHostMsg_TextSurroundingSelectionResponse( | 2324 Send(new FrameHostMsg_TextSurroundingSelectionResponse( |
| 2322 routing_id_, | 2325 routing_id_, |
| 2323 surroundingText.textContent(), | 2326 surroundingText.textContent(), |
| 2324 surroundingText.startOffsetInTextContent(), | 2327 surroundingText.startOffsetInTextContent(), |
| 2325 surroundingText.endOffsetInTextContent())); | 2328 surroundingText.endOffsetInTextContent())); |
| 2326 } | 2329 } |
| 2327 | 2330 |
| 2331 void RenderFrameImpl::OnFocusedFormFieldDataRequest(int request_id) { |
| 2332 DCHECK(frame_); |
| 2333 |
| 2334 // In case of early return, the IPC response message is always needed in |
| 2335 // order to avoid leaks in the browser for unacknowledged requests. |
| 2336 if (frame_ != render_view_->GetWebView()->focusedFrame() || |
| 2337 frame_->document().focusedElement().isNull()) { |
| 2338 Send(new FrameHostMsg_FocusedFormFieldDataResponse(routing_id_, request_id, |
| 2339 FormFieldData())); |
| 2340 return; |
| 2341 } |
| 2342 |
| 2343 WebElement element = frame_->document().focusedElement(); |
| 2344 |
| 2345 DCHECK(GetRenderWidget()->GetWebWidget()); |
| 2346 blink::WebTextInputInfo info = |
| 2347 GetRenderWidget()->GetWebWidget()->textInputInfo(); |
| 2348 FormFieldData field; |
| 2349 field.text = info.value.utf8(); |
| 2350 field.placeholder = element.getAttribute("placeholder").utf8(); |
| 2351 field.text_input_type = GetRenderWidget()->GetTextInputType(); |
| 2352 |
| 2353 Send(new FrameHostMsg_FocusedFormFieldDataResponse(routing_id_, request_id, |
| 2354 field)); |
| 2355 } |
| 2356 |
| 2328 bool RenderFrameImpl::RunJavaScriptMessage(JavaScriptMessageType type, | 2357 bool RenderFrameImpl::RunJavaScriptMessage(JavaScriptMessageType type, |
| 2329 const base::string16& message, | 2358 const base::string16& message, |
| 2330 const base::string16& default_value, | 2359 const base::string16& default_value, |
| 2331 const GURL& frame_url, | 2360 const GURL& frame_url, |
| 2332 base::string16* result) { | 2361 base::string16* result) { |
| 2333 // Don't allow further dialogs if we are waiting to swap out, since the | 2362 // Don't allow further dialogs if we are waiting to swap out, since the |
| 2334 // ScopedPageLoadDeferrer in our stack prevents it. | 2363 // ScopedPageLoadDeferrer in our stack prevents it. |
| 2335 if (suppress_further_dialogs_) | 2364 if (suppress_further_dialogs_) |
| 2336 return false; | 2365 return false; |
| 2337 | 2366 |
| (...skipping 4293 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6631 // event target. Potentially a Pepper plugin will receive the event. | 6660 // event target. Potentially a Pepper plugin will receive the event. |
| 6632 // In order to tell whether a plugin gets the last mouse event and which it | 6661 // In order to tell whether a plugin gets the last mouse event and which it |
| 6633 // is, we set |pepper_last_mouse_event_target_| to null here. If a plugin gets | 6662 // is, we set |pepper_last_mouse_event_target_| to null here. If a plugin gets |
| 6634 // the event, it will notify us via DidReceiveMouseEvent() and set itself as | 6663 // the event, it will notify us via DidReceiveMouseEvent() and set itself as |
| 6635 // |pepper_last_mouse_event_target_|. | 6664 // |pepper_last_mouse_event_target_|. |
| 6636 pepper_last_mouse_event_target_ = nullptr; | 6665 pepper_last_mouse_event_target_ = nullptr; |
| 6637 #endif | 6666 #endif |
| 6638 } | 6667 } |
| 6639 | 6668 |
| 6640 } // namespace content | 6669 } // namespace content |
| OLD | NEW |