| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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_view_impl.h" | 5 #include "content/renderer/render_view_impl.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 #include <cmath> | 8 #include <cmath> |
| 9 | 9 |
| 10 #include "base/bind.h" | 10 #include "base/bind.h" |
| (...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 95 #include "content/renderer/pepper/pepper_plugin_delegate_impl.h" | 95 #include "content/renderer/pepper/pepper_plugin_delegate_impl.h" |
| 96 #include "content/renderer/plugin_channel_host.h" | 96 #include "content/renderer/plugin_channel_host.h" |
| 97 #include "content/renderer/render_process.h" | 97 #include "content/renderer/render_process.h" |
| 98 #include "content/renderer/render_thread_impl.h" | 98 #include "content/renderer/render_thread_impl.h" |
| 99 #include "content/renderer/render_view_impl_params.h" | 99 #include "content/renderer/render_view_impl_params.h" |
| 100 #include "content/renderer/render_view_mouse_lock_dispatcher.h" | 100 #include "content/renderer/render_view_mouse_lock_dispatcher.h" |
| 101 #include "content/renderer/render_widget_fullscreen_pepper.h" | 101 #include "content/renderer/render_widget_fullscreen_pepper.h" |
| 102 #include "content/renderer/renderer_accessibility.h" | 102 #include "content/renderer/renderer_accessibility.h" |
| 103 #include "content/renderer/renderer_accessibility_complete.h" | 103 #include "content/renderer/renderer_accessibility_complete.h" |
| 104 #include "content/renderer/renderer_accessibility_focus_only.h" | 104 #include "content/renderer/renderer_accessibility_focus_only.h" |
| 105 #include "content/renderer/renderer_date_time_picker.h" |
| 105 #include "content/renderer/renderer_webapplicationcachehost_impl.h" | 106 #include "content/renderer/renderer_webapplicationcachehost_impl.h" |
| 106 #include "content/renderer/renderer_webcolorchooser_impl.h" | 107 #include "content/renderer/renderer_webcolorchooser_impl.h" |
| 107 #include "content/renderer/speech_recognition_dispatcher.h" | 108 #include "content/renderer/speech_recognition_dispatcher.h" |
| 108 #include "content/renderer/text_input_client_observer.h" | 109 #include "content/renderer/text_input_client_observer.h" |
| 109 #include "content/renderer/v8_value_converter_impl.h" | 110 #include "content/renderer/v8_value_converter_impl.h" |
| 110 #include "content/renderer/web_intents_host.h" | 111 #include "content/renderer/web_intents_host.h" |
| 111 #include "content/renderer/web_ui_extension.h" | 112 #include "content/renderer/web_ui_extension.h" |
| 112 #include "content/renderer/web_ui_extension_data.h" | 113 #include "content/renderer/web_ui_extension_data.h" |
| 113 #include "content/renderer/webplugin_delegate_proxy.h" | 114 #include "content/renderer/webplugin_delegate_proxy.h" |
| 114 #include "content/renderer/websharedworker_proxy.h" | 115 #include "content/renderer/websharedworker_proxy.h" |
| 115 #include "media/base/filter_collection.h" | 116 #include "media/base/filter_collection.h" |
| 116 #include "media/base/media_switches.h" | 117 #include "media/base/media_switches.h" |
| 117 #include "media/base/message_loop_factory.h" | 118 #include "media/base/message_loop_factory.h" |
| 118 #include "media/filters/audio_renderer_impl.h" | 119 #include "media/filters/audio_renderer_impl.h" |
| 119 #include "media/filters/gpu_video_decoder.h" | 120 #include "media/filters/gpu_video_decoder.h" |
| 120 #include "net/base/data_url.h" | 121 #include "net/base/data_url.h" |
| 121 #include "net/base/escape.h" | 122 #include "net/base/escape.h" |
| 122 #include "net/base/net_errors.h" | 123 #include "net/base/net_errors.h" |
| 123 #include "net/base/registry_controlled_domains/registry_controlled_domain.h" | 124 #include "net/base/registry_controlled_domains/registry_controlled_domain.h" |
| 124 #include "net/http/http_util.h" | 125 #include "net/http/http_util.h" |
| 125 #include "third_party/WebKit/Source/WebKit/chromium/public/WebAccessibilityObjec
t.h" | 126 #include "third_party/WebKit/Source/WebKit/chromium/public/WebAccessibilityObjec
t.h" |
| 126 #include "third_party/WebKit/Source/WebKit/chromium/public/WebColorName.h" | 127 #include "third_party/WebKit/Source/WebKit/chromium/public/WebColorName.h" |
| 127 #include "third_party/WebKit/Source/WebKit/chromium/public/WebDOMEvent.h" | 128 #include "third_party/WebKit/Source/WebKit/chromium/public/WebDOMEvent.h" |
| 128 #include "third_party/WebKit/Source/WebKit/chromium/public/WebDOMMessageEvent.h" | 129 #include "third_party/WebKit/Source/WebKit/chromium/public/WebDOMMessageEvent.h" |
| 129 #include "third_party/WebKit/Source/WebKit/chromium/public/WebDataSource.h" | 130 #include "third_party/WebKit/Source/WebKit/chromium/public/WebDataSource.h" |
| 131 #include "third_party/WebKit/Source/WebKit/chromium/public/WebDateTimeChooserCom
pletion.h" |
| 132 #include "third_party/WebKit/Source/WebKit/chromium/public/WebDateTimeChooserPar
ams.h" |
| 130 #include "third_party/WebKit/Source/WebKit/chromium/public/WebDocument.h" | 133 #include "third_party/WebKit/Source/WebKit/chromium/public/WebDocument.h" |
| 131 #include "third_party/WebKit/Source/WebKit/chromium/public/WebElement.h" | 134 #include "third_party/WebKit/Source/WebKit/chromium/public/WebElement.h" |
| 132 #include "third_party/WebKit/Source/WebKit/chromium/public/WebFileChooserParams.
h" | 135 #include "third_party/WebKit/Source/WebKit/chromium/public/WebFileChooserParams.
h" |
| 133 #include "third_party/WebKit/Source/WebKit/chromium/public/WebFileSystemCallback
s.h" | 136 #include "third_party/WebKit/Source/WebKit/chromium/public/WebFileSystemCallback
s.h" |
| 134 #include "third_party/WebKit/Source/WebKit/chromium/public/WebFindOptions.h" | 137 #include "third_party/WebKit/Source/WebKit/chromium/public/WebFindOptions.h" |
| 135 #include "third_party/WebKit/Source/WebKit/chromium/public/WebFormControlElement
.h" | 138 #include "third_party/WebKit/Source/WebKit/chromium/public/WebFormControlElement
.h" |
| 136 #include "third_party/WebKit/Source/WebKit/chromium/public/WebFormElement.h" | 139 #include "third_party/WebKit/Source/WebKit/chromium/public/WebFormElement.h" |
| 137 #include "third_party/WebKit/Source/WebKit/chromium/public/WebFrame.h" | 140 #include "third_party/WebKit/Source/WebKit/chromium/public/WebFrame.h" |
| 138 #include "third_party/WebKit/Source/WebKit/chromium/public/WebHelperPlugin.h" | 141 #include "third_party/WebKit/Source/WebKit/chromium/public/WebHelperPlugin.h" |
| 139 #include "third_party/WebKit/Source/WebKit/chromium/public/WebHistoryItem.h" | 142 #include "third_party/WebKit/Source/WebKit/chromium/public/WebHistoryItem.h" |
| (...skipping 790 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 930 IPC_MESSAGE_HANDLER(ViewMsg_ReloadFrame, OnReloadFrame) | 933 IPC_MESSAGE_HANDLER(ViewMsg_ReloadFrame, OnReloadFrame) |
| 931 IPC_MESSAGE_HANDLER(ViewMsg_Undo, OnUndo) | 934 IPC_MESSAGE_HANDLER(ViewMsg_Undo, OnUndo) |
| 932 IPC_MESSAGE_HANDLER(ViewMsg_Redo, OnRedo) | 935 IPC_MESSAGE_HANDLER(ViewMsg_Redo, OnRedo) |
| 933 IPC_MESSAGE_HANDLER(ViewMsg_Cut, OnCut) | 936 IPC_MESSAGE_HANDLER(ViewMsg_Cut, OnCut) |
| 934 IPC_MESSAGE_HANDLER(ViewMsg_Copy, OnCopy) | 937 IPC_MESSAGE_HANDLER(ViewMsg_Copy, OnCopy) |
| 935 IPC_MESSAGE_HANDLER(ViewMsg_Paste, OnPaste) | 938 IPC_MESSAGE_HANDLER(ViewMsg_Paste, OnPaste) |
| 936 IPC_MESSAGE_HANDLER(ViewMsg_PasteAndMatchStyle, OnPasteAndMatchStyle) | 939 IPC_MESSAGE_HANDLER(ViewMsg_PasteAndMatchStyle, OnPasteAndMatchStyle) |
| 937 IPC_MESSAGE_HANDLER(ViewMsg_Replace, OnReplace) | 940 IPC_MESSAGE_HANDLER(ViewMsg_Replace, OnReplace) |
| 938 IPC_MESSAGE_HANDLER(ViewMsg_Delete, OnDelete) | 941 IPC_MESSAGE_HANDLER(ViewMsg_Delete, OnDelete) |
| 939 IPC_MESSAGE_HANDLER(ViewMsg_SelectAll, OnSelectAll) | 942 IPC_MESSAGE_HANDLER(ViewMsg_SelectAll, OnSelectAll) |
| 940 IPC_MESSAGE_HANDLER(ViewMsg_ReplaceAll, OnReplaceAll) | |
| 941 IPC_MESSAGE_HANDLER(ViewMsg_Unselect, OnUnselect) | 943 IPC_MESSAGE_HANDLER(ViewMsg_Unselect, OnUnselect) |
| 942 IPC_MESSAGE_HANDLER(ViewMsg_SetEditableSelectionOffsets, | 944 IPC_MESSAGE_HANDLER(ViewMsg_SetEditableSelectionOffsets, |
| 943 OnSetEditableSelectionOffsets) | 945 OnSetEditableSelectionOffsets) |
| 944 IPC_MESSAGE_HANDLER(ViewMsg_SetCompositionFromExistingText, | 946 IPC_MESSAGE_HANDLER(ViewMsg_SetCompositionFromExistingText, |
| 945 OnSetCompositionFromExistingText) | 947 OnSetCompositionFromExistingText) |
| 946 IPC_MESSAGE_HANDLER(ViewMsg_ExtendSelectionAndDelete, | 948 IPC_MESSAGE_HANDLER(ViewMsg_ExtendSelectionAndDelete, |
| 947 OnExtendSelectionAndDelete) | 949 OnExtendSelectionAndDelete) |
| 948 IPC_MESSAGE_HANDLER(ViewMsg_SelectRange, OnSelectRange) | 950 IPC_MESSAGE_HANDLER(ViewMsg_SelectRange, OnSelectRange) |
| 949 IPC_MESSAGE_HANDLER(ViewMsg_CopyImageAt, OnCopyImageAt) | 951 IPC_MESSAGE_HANDLER(ViewMsg_CopyImageAt, OnCopyImageAt) |
| 950 IPC_MESSAGE_HANDLER(ViewMsg_ExecuteEditCommand, OnExecuteEditCommand) | 952 IPC_MESSAGE_HANDLER(ViewMsg_ExecuteEditCommand, OnExecuteEditCommand) |
| (...skipping 409 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1360 } | 1362 } |
| 1361 | 1363 |
| 1362 void RenderViewImpl::OnSelectAll() { | 1364 void RenderViewImpl::OnSelectAll() { |
| 1363 if (!webview()) | 1365 if (!webview()) |
| 1364 return; | 1366 return; |
| 1365 | 1367 |
| 1366 webview()->focusedFrame()->executeCommand( | 1368 webview()->focusedFrame()->executeCommand( |
| 1367 WebString::fromUTF8("SelectAll")); | 1369 WebString::fromUTF8("SelectAll")); |
| 1368 } | 1370 } |
| 1369 | 1371 |
| 1370 void RenderViewImpl::OnReplaceAll(const string16& text) { | |
| 1371 WebNode node = GetFocusedNode(); | |
| 1372 if (node.isNull() || !IsEditableNode(node)) | |
| 1373 return; | |
| 1374 | |
| 1375 OnSelectAll(); | |
| 1376 OnReplace(text); | |
| 1377 } | |
| 1378 | |
| 1379 void RenderViewImpl::OnUnselect() { | 1372 void RenderViewImpl::OnUnselect() { |
| 1380 if (!webview()) | 1373 if (!webview()) |
| 1381 return; | 1374 return; |
| 1382 | 1375 |
| 1383 webview()->focusedFrame()->executeCommand(WebString::fromUTF8("Unselect")); | 1376 webview()->focusedFrame()->executeCommand(WebString::fromUTF8("Unselect")); |
| 1384 } | 1377 } |
| 1385 | 1378 |
| 1386 void RenderViewImpl::OnSetEditableSelectionOffsets(int start, int end) { | 1379 void RenderViewImpl::OnSetEditableSelectionOffsets(int start, int end) { |
| 1387 webview()->setEditableSelectionOffsets(start, end); | 1380 webview()->setEditableSelectionOffsets(start, end); |
| 1388 } | 1381 } |
| (...skipping 3225 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4614 } | 4607 } |
| 4615 | 4608 |
| 4616 void RenderViewImpl::SyncSelectionIfRequired() { | 4609 void RenderViewImpl::SyncSelectionIfRequired() { |
| 4617 WebFrame* frame = webview()->focusedFrame(); | 4610 WebFrame* frame = webview()->focusedFrame(); |
| 4618 if (!frame) | 4611 if (!frame) |
| 4619 return; | 4612 return; |
| 4620 | 4613 |
| 4621 string16 text; | 4614 string16 text; |
| 4622 size_t offset; | 4615 size_t offset; |
| 4623 ui::Range range; | 4616 ui::Range range; |
| 4624 | |
| 4625 if (pepper_helper_->IsPluginFocused()) { | 4617 if (pepper_helper_->IsPluginFocused()) { |
| 4626 pepper_helper_->GetSurroundingText(&text, &range); | 4618 pepper_helper_->GetSurroundingText(&text, &range); |
| 4627 offset = 0; // Pepper API does not support offset reporting. | 4619 offset = 0; // Pepper API does not support offset reporting. |
| 4628 // TODO(kinaba): cut as needed. | 4620 // TODO(kinaba): cut as needed. |
| 4629 } else { | 4621 } else { |
| 4630 size_t location, length; | 4622 size_t location, length; |
| 4631 if (!webview()->caretOrSelectionRange(&location, &length)) | 4623 if (!webview()->caretOrSelectionRange(&location, &length)) |
| 4632 return; | 4624 return; |
| 4633 | 4625 |
| 4634 range = ui::Range(location, location + length); | 4626 range = ui::Range(location, location + length); |
| (...skipping 1695 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6330 size_t request_id) { | 6322 size_t request_id) { |
| 6331 if (request_id != expected_content_intent_id_) | 6323 if (request_id != expected_content_intent_id_) |
| 6332 return; | 6324 return; |
| 6333 | 6325 |
| 6334 // Remove the content highlighting if any. | 6326 // Remove the content highlighting if any. |
| 6335 scheduleComposite(); | 6327 scheduleComposite(); |
| 6336 | 6328 |
| 6337 if (!intent.is_empty()) | 6329 if (!intent.is_empty()) |
| 6338 Send(new ViewHostMsg_StartContentIntent(routing_id_, intent)); | 6330 Send(new ViewHostMsg_StartContentIntent(routing_id_, intent)); |
| 6339 } | 6331 } |
| 6332 |
| 6333 bool RenderViewImpl::openDateTimeChooser( |
| 6334 const WebKit::WebDateTimeChooserParams& params, |
| 6335 WebKit::WebDateTimeChooserCompletion* completion) { |
| 6336 date_time_picker_client_.reset( |
| 6337 new RendererDateTimePicker(this, params, completion)); |
| 6338 return date_time_picker_client_->Open(); |
| 6339 } |
| 6340 |
| 6340 #endif // defined(OS_ANDROID) | 6341 #endif // defined(OS_ANDROID) |
| 6341 | 6342 |
| 6342 void RenderViewImpl::OnAsyncFileOpened( | 6343 void RenderViewImpl::OnAsyncFileOpened( |
| 6343 base::PlatformFileError error_code, | 6344 base::PlatformFileError error_code, |
| 6344 IPC::PlatformFileForTransit file_for_transit, | 6345 IPC::PlatformFileForTransit file_for_transit, |
| 6345 int message_id) { | 6346 int message_id) { |
| 6346 pepper_helper_->OnAsyncFileOpened( | 6347 pepper_helper_->OnAsyncFileOpened( |
| 6347 error_code, | 6348 error_code, |
| 6348 IPC::PlatformFileForTransitToPlatformFile(file_for_transit), | 6349 IPC::PlatformFileForTransitToPlatformFile(file_for_transit), |
| 6349 message_id); | 6350 message_id); |
| (...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6502 } | 6503 } |
| 6503 #endif | 6504 #endif |
| 6504 | 6505 |
| 6505 void RenderViewImpl::OnReleaseDisambiguationPopupDIB( | 6506 void RenderViewImpl::OnReleaseDisambiguationPopupDIB( |
| 6506 TransportDIB::Handle dib_handle) { | 6507 TransportDIB::Handle dib_handle) { |
| 6507 TransportDIB* dib = TransportDIB::CreateWithHandle(dib_handle); | 6508 TransportDIB* dib = TransportDIB::CreateWithHandle(dib_handle); |
| 6508 RenderProcess::current()->ReleaseTransportDIB(dib); | 6509 RenderProcess::current()->ReleaseTransportDIB(dib); |
| 6509 } | 6510 } |
| 6510 | 6511 |
| 6511 } // namespace content | 6512 } // namespace content |
| OLD | NEW |