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 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
94 #include "content/renderer/pepper/pepper_plugin_delegate_impl.h" | 94 #include "content/renderer/pepper/pepper_plugin_delegate_impl.h" |
95 #include "content/renderer/plugin_channel_host.h" | 95 #include "content/renderer/plugin_channel_host.h" |
96 #include "content/renderer/render_process.h" | 96 #include "content/renderer/render_process.h" |
97 #include "content/renderer/render_thread_impl.h" | 97 #include "content/renderer/render_thread_impl.h" |
98 #include "content/renderer/render_view_impl_params.h" | 98 #include "content/renderer/render_view_impl_params.h" |
99 #include "content/renderer/render_view_mouse_lock_dispatcher.h" | 99 #include "content/renderer/render_view_mouse_lock_dispatcher.h" |
100 #include "content/renderer/render_widget_fullscreen_pepper.h" | 100 #include "content/renderer/render_widget_fullscreen_pepper.h" |
101 #include "content/renderer/renderer_accessibility.h" | 101 #include "content/renderer/renderer_accessibility.h" |
102 #include "content/renderer/renderer_accessibility_complete.h" | 102 #include "content/renderer/renderer_accessibility_complete.h" |
103 #include "content/renderer/renderer_accessibility_focus_only.h" | 103 #include "content/renderer/renderer_accessibility_focus_only.h" |
| 104 #include "content/renderer/renderer_date_time_picker.h" |
104 #include "content/renderer/renderer_webapplicationcachehost_impl.h" | 105 #include "content/renderer/renderer_webapplicationcachehost_impl.h" |
105 #include "content/renderer/renderer_webcolorchooser_impl.h" | 106 #include "content/renderer/renderer_webcolorchooser_impl.h" |
106 #include "content/renderer/speech_recognition_dispatcher.h" | 107 #include "content/renderer/speech_recognition_dispatcher.h" |
107 #include "content/renderer/text_input_client_observer.h" | 108 #include "content/renderer/text_input_client_observer.h" |
108 #include "content/renderer/v8_value_converter_impl.h" | 109 #include "content/renderer/v8_value_converter_impl.h" |
109 #include "content/renderer/web_intents_host.h" | 110 #include "content/renderer/web_intents_host.h" |
110 #include "content/renderer/web_ui_extension.h" | 111 #include "content/renderer/web_ui_extension.h" |
111 #include "content/renderer/web_ui_extension_data.h" | 112 #include "content/renderer/web_ui_extension_data.h" |
112 #include "content/renderer/webplugin_delegate_proxy.h" | 113 #include "content/renderer/webplugin_delegate_proxy.h" |
113 #include "content/renderer/websharedworker_proxy.h" | 114 #include "content/renderer/websharedworker_proxy.h" |
114 #include "media/base/filter_collection.h" | 115 #include "media/base/filter_collection.h" |
115 #include "media/base/media_switches.h" | 116 #include "media/base/media_switches.h" |
116 #include "media/base/message_loop_factory.h" | 117 #include "media/base/message_loop_factory.h" |
117 #include "media/filters/audio_renderer_impl.h" | 118 #include "media/filters/audio_renderer_impl.h" |
118 #include "media/filters/gpu_video_decoder.h" | 119 #include "media/filters/gpu_video_decoder.h" |
119 #include "net/base/data_url.h" | 120 #include "net/base/data_url.h" |
120 #include "net/base/escape.h" | 121 #include "net/base/escape.h" |
121 #include "net/base/net_errors.h" | 122 #include "net/base/net_errors.h" |
122 #include "net/base/registry_controlled_domains/registry_controlled_domain.h" | 123 #include "net/base/registry_controlled_domains/registry_controlled_domain.h" |
123 #include "net/http/http_util.h" | 124 #include "net/http/http_util.h" |
124 #include "third_party/WebKit/Source/Platform/chromium/public/WebCompositorOutput
Surface.h" | 125 #include "third_party/WebKit/Source/Platform/chromium/public/WebCompositorOutput
Surface.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 789 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
929 IPC_MESSAGE_HANDLER(ViewMsg_ReloadFrame, OnReloadFrame) | 932 IPC_MESSAGE_HANDLER(ViewMsg_ReloadFrame, OnReloadFrame) |
930 IPC_MESSAGE_HANDLER(ViewMsg_Undo, OnUndo) | 933 IPC_MESSAGE_HANDLER(ViewMsg_Undo, OnUndo) |
931 IPC_MESSAGE_HANDLER(ViewMsg_Redo, OnRedo) | 934 IPC_MESSAGE_HANDLER(ViewMsg_Redo, OnRedo) |
932 IPC_MESSAGE_HANDLER(ViewMsg_Cut, OnCut) | 935 IPC_MESSAGE_HANDLER(ViewMsg_Cut, OnCut) |
933 IPC_MESSAGE_HANDLER(ViewMsg_Copy, OnCopy) | 936 IPC_MESSAGE_HANDLER(ViewMsg_Copy, OnCopy) |
934 IPC_MESSAGE_HANDLER(ViewMsg_Paste, OnPaste) | 937 IPC_MESSAGE_HANDLER(ViewMsg_Paste, OnPaste) |
935 IPC_MESSAGE_HANDLER(ViewMsg_PasteAndMatchStyle, OnPasteAndMatchStyle) | 938 IPC_MESSAGE_HANDLER(ViewMsg_PasteAndMatchStyle, OnPasteAndMatchStyle) |
936 IPC_MESSAGE_HANDLER(ViewMsg_Replace, OnReplace) | 939 IPC_MESSAGE_HANDLER(ViewMsg_Replace, OnReplace) |
937 IPC_MESSAGE_HANDLER(ViewMsg_Delete, OnDelete) | 940 IPC_MESSAGE_HANDLER(ViewMsg_Delete, OnDelete) |
938 IPC_MESSAGE_HANDLER(ViewMsg_SelectAll, OnSelectAll) | 941 IPC_MESSAGE_HANDLER(ViewMsg_SelectAll, OnSelectAll) |
939 IPC_MESSAGE_HANDLER(ViewMsg_ReplaceAll, OnReplaceAll) | |
940 IPC_MESSAGE_HANDLER(ViewMsg_Unselect, OnUnselect) | 942 IPC_MESSAGE_HANDLER(ViewMsg_Unselect, OnUnselect) |
941 IPC_MESSAGE_HANDLER(ViewMsg_SetEditableSelectionOffsets, | 943 IPC_MESSAGE_HANDLER(ViewMsg_SetEditableSelectionOffsets, |
942 OnSetEditableSelectionOffsets) | 944 OnSetEditableSelectionOffsets) |
943 IPC_MESSAGE_HANDLER(ViewMsg_SetCompositionFromExistingText, | 945 IPC_MESSAGE_HANDLER(ViewMsg_SetCompositionFromExistingText, |
944 OnSetCompositionFromExistingText) | 946 OnSetCompositionFromExistingText) |
945 IPC_MESSAGE_HANDLER(ViewMsg_ExtendSelectionAndDelete, | 947 IPC_MESSAGE_HANDLER(ViewMsg_ExtendSelectionAndDelete, |
946 OnExtendSelectionAndDelete) | 948 OnExtendSelectionAndDelete) |
947 IPC_MESSAGE_HANDLER(ViewMsg_SelectRange, OnSelectRange) | 949 IPC_MESSAGE_HANDLER(ViewMsg_SelectRange, OnSelectRange) |
948 IPC_MESSAGE_HANDLER(ViewMsg_CopyImageAt, OnCopyImageAt) | 950 IPC_MESSAGE_HANDLER(ViewMsg_CopyImageAt, OnCopyImageAt) |
949 IPC_MESSAGE_HANDLER(ViewMsg_ExecuteEditCommand, OnExecuteEditCommand) | 951 IPC_MESSAGE_HANDLER(ViewMsg_ExecuteEditCommand, OnExecuteEditCommand) |
(...skipping 400 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1350 } | 1352 } |
1351 | 1353 |
1352 void RenderViewImpl::OnSelectAll() { | 1354 void RenderViewImpl::OnSelectAll() { |
1353 if (!webview()) | 1355 if (!webview()) |
1354 return; | 1356 return; |
1355 | 1357 |
1356 webview()->focusedFrame()->executeCommand( | 1358 webview()->focusedFrame()->executeCommand( |
1357 WebString::fromUTF8("SelectAll")); | 1359 WebString::fromUTF8("SelectAll")); |
1358 } | 1360 } |
1359 | 1361 |
1360 void RenderViewImpl::OnReplaceAll(const string16& text) { | |
1361 WebNode node = GetFocusedNode(); | |
1362 if (node.isNull() || !IsEditableNode(node)) | |
1363 return; | |
1364 | |
1365 OnSelectAll(); | |
1366 OnReplace(text); | |
1367 } | |
1368 | |
1369 void RenderViewImpl::OnUnselect() { | 1362 void RenderViewImpl::OnUnselect() { |
1370 if (!webview()) | 1363 if (!webview()) |
1371 return; | 1364 return; |
1372 | 1365 |
1373 webview()->focusedFrame()->executeCommand(WebString::fromUTF8("Unselect")); | 1366 webview()->focusedFrame()->executeCommand(WebString::fromUTF8("Unselect")); |
1374 } | 1367 } |
1375 | 1368 |
1376 void RenderViewImpl::OnSetEditableSelectionOffsets(int start, int end) { | 1369 void RenderViewImpl::OnSetEditableSelectionOffsets(int start, int end) { |
1377 webview()->setEditableSelectionOffsets(start, end); | 1370 webview()->setEditableSelectionOffsets(start, end); |
1378 } | 1371 } |
(...skipping 3215 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4594 } | 4587 } |
4595 | 4588 |
4596 void RenderViewImpl::SyncSelectionIfRequired() { | 4589 void RenderViewImpl::SyncSelectionIfRequired() { |
4597 WebFrame* frame = webview()->focusedFrame(); | 4590 WebFrame* frame = webview()->focusedFrame(); |
4598 if (!frame) | 4591 if (!frame) |
4599 return; | 4592 return; |
4600 | 4593 |
4601 string16 text; | 4594 string16 text; |
4602 size_t offset; | 4595 size_t offset; |
4603 ui::Range range; | 4596 ui::Range range; |
4604 | |
4605 if (pepper_helper_->IsPluginFocused()) { | 4597 if (pepper_helper_->IsPluginFocused()) { |
4606 pepper_helper_->GetSurroundingText(&text, &range); | 4598 pepper_helper_->GetSurroundingText(&text, &range); |
4607 offset = 0; // Pepper API does not support offset reporting. | 4599 offset = 0; // Pepper API does not support offset reporting. |
4608 // TODO(kinaba): cut as needed. | 4600 // TODO(kinaba): cut as needed. |
4609 } else { | 4601 } else { |
4610 size_t location, length; | 4602 size_t location, length; |
4611 if (!webview()->caretOrSelectionRange(&location, &length)) | 4603 if (!webview()->caretOrSelectionRange(&location, &length)) |
4612 return; | 4604 return; |
4613 | 4605 |
4614 range = ui::Range(location, location + length); | 4606 range = ui::Range(location, location + length); |
(...skipping 1694 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6309 size_t request_id) { | 6301 size_t request_id) { |
6310 if (request_id != expected_content_intent_id_) | 6302 if (request_id != expected_content_intent_id_) |
6311 return; | 6303 return; |
6312 | 6304 |
6313 // Remove the content highlighting if any. | 6305 // Remove the content highlighting if any. |
6314 scheduleComposite(); | 6306 scheduleComposite(); |
6315 | 6307 |
6316 if (!intent.is_empty()) | 6308 if (!intent.is_empty()) |
6317 Send(new ViewHostMsg_StartContentIntent(routing_id_, intent)); | 6309 Send(new ViewHostMsg_StartContentIntent(routing_id_, intent)); |
6318 } | 6310 } |
| 6311 |
| 6312 bool RenderViewImpl::openDateTimeChooser( |
| 6313 const WebKit::WebDateTimeChooserParams& params, |
| 6314 WebKit::WebDateTimeChooserCompletion* completion) { |
| 6315 date_time_picker_client_.reset( |
| 6316 new RendererDateTimePicker(this, params, completion)); |
| 6317 return date_time_picker_client_->Open(); |
| 6318 } |
| 6319 |
6319 #endif // defined(OS_ANDROID) | 6320 #endif // defined(OS_ANDROID) |
6320 | 6321 |
6321 void RenderViewImpl::OnAsyncFileOpened( | 6322 void RenderViewImpl::OnAsyncFileOpened( |
6322 base::PlatformFileError error_code, | 6323 base::PlatformFileError error_code, |
6323 IPC::PlatformFileForTransit file_for_transit, | 6324 IPC::PlatformFileForTransit file_for_transit, |
6324 int message_id) { | 6325 int message_id) { |
6325 pepper_helper_->OnAsyncFileOpened( | 6326 pepper_helper_->OnAsyncFileOpened( |
6326 error_code, | 6327 error_code, |
6327 IPC::PlatformFileForTransitToPlatformFile(file_for_transit), | 6328 IPC::PlatformFileForTransitToPlatformFile(file_for_transit), |
6328 message_id); | 6329 message_id); |
(...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6481 } | 6482 } |
6482 #endif | 6483 #endif |
6483 | 6484 |
6484 void RenderViewImpl::OnReleaseDisambiguationPopupDIB( | 6485 void RenderViewImpl::OnReleaseDisambiguationPopupDIB( |
6485 TransportDIB::Handle dib_handle) { | 6486 TransportDIB::Handle dib_handle) { |
6486 TransportDIB* dib = TransportDIB::CreateWithHandle(dib_handle); | 6487 TransportDIB* dib = TransportDIB::CreateWithHandle(dib_handle); |
6487 RenderProcess::current()->ReleaseTransportDIB(dib); | 6488 RenderProcess::current()->ReleaseTransportDIB(dib); |
6488 } | 6489 } |
6489 | 6490 |
6490 } // namespace content | 6491 } // namespace content |
OLD | NEW |