| 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 #include <string> | 9 #include <string> |
| 10 #include <vector> | 10 #include <vector> |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 49 #include "content/public/common/content_switches.h" | 49 #include "content/public/common/content_switches.h" |
| 50 #include "content/public/common/context_menu_params.h" | 50 #include "content/public/common/context_menu_params.h" |
| 51 #include "content/public/common/file_chooser_params.h" | 51 #include "content/public/common/file_chooser_params.h" |
| 52 #include "content/public/common/selected_file_info.h" | 52 #include "content/public/common/selected_file_info.h" |
| 53 #include "content/public/common/url_constants.h" | 53 #include "content/public/common/url_constants.h" |
| 54 #include "content/public/renderer/content_renderer_client.h" | 54 #include "content/public/renderer/content_renderer_client.h" |
| 55 #include "content/public/renderer/document_state.h" | 55 #include "content/public/renderer/document_state.h" |
| 56 #include "content/public/renderer/navigation_state.h" | 56 #include "content/public/renderer/navigation_state.h" |
| 57 #include "content/public/renderer/render_view_observer.h" | 57 #include "content/public/renderer/render_view_observer.h" |
| 58 #include "content/public/renderer/render_view_visitor.h" | 58 #include "content/public/renderer/render_view_visitor.h" |
| 59 #include "content/renderer/browser_plugin/browser_plugin.h" |
| 59 #include "content/renderer/browser_plugin/browser_plugin_channel_manager.h" | 60 #include "content/renderer/browser_plugin/browser_plugin_channel_manager.h" |
| 61 #include "content/renderer/browser_plugin/browser_plugin_constants.h" |
| 60 #include "content/renderer/browser_plugin/guest_to_embedder_channel.h" | 62 #include "content/renderer/browser_plugin/guest_to_embedder_channel.h" |
| 61 #include "content/renderer/device_orientation_dispatcher.h" | 63 #include "content/renderer/device_orientation_dispatcher.h" |
| 62 #include "content/renderer/devtools_agent.h" | 64 #include "content/renderer/devtools_agent.h" |
| 63 #include "content/renderer/dom_automation_controller.h" | 65 #include "content/renderer/dom_automation_controller.h" |
| 64 #include "content/renderer/dom_storage/webstoragenamespace_impl.h" | 66 #include "content/renderer/dom_storage/webstoragenamespace_impl.h" |
| 65 #include "content/renderer/external_popup_menu.h" | 67 #include "content/renderer/external_popup_menu.h" |
| 66 #include "content/renderer/geolocation_dispatcher.h" | 68 #include "content/renderer/geolocation_dispatcher.h" |
| 67 #include "content/renderer/gpu/compositor_thread.h" | 69 #include "content/renderer/gpu/compositor_thread.h" |
| 68 #include "content/renderer/idle_user_detector.h" | 70 #include "content/renderer/idle_user_detector.h" |
| 69 #include "content/renderer/input_tag_speech_dispatcher.h" | 71 #include "content/renderer/input_tag_speech_dispatcher.h" |
| 70 #include "content/renderer/java/java_bridge_dispatcher.h" | 72 #include "content/renderer/java/java_bridge_dispatcher.h" |
| 71 #include "content/renderer/load_progress_tracker.h" | 73 #include "content/renderer/load_progress_tracker.h" |
| 72 #include "content/renderer/media/audio_message_filter.h" | 74 #include "content/renderer/media/audio_message_filter.h" |
| 73 #include "content/renderer/media/media_stream_dependency_factory.h" | 75 #include "content/renderer/media/media_stream_dependency_factory.h" |
| 74 #include "content/renderer/media/media_stream_dispatcher.h" | 76 #include "content/renderer/media/media_stream_dispatcher.h" |
| 75 #include "content/renderer/media/media_stream_impl.h" | 77 #include "content/renderer/media/media_stream_impl.h" |
| 76 #include "content/renderer/media/render_audiosourceprovider.h" | 78 #include "content/renderer/media/render_audiosourceprovider.h" |
| 77 #include "content/renderer/media/render_media_log.h" | 79 #include "content/renderer/media/render_media_log.h" |
| 78 #include "content/renderer/media/renderer_gpu_video_decoder_factories.h" | 80 #include "content/renderer/media/renderer_gpu_video_decoder_factories.h" |
| 79 #include "content/renderer/mhtml_generator.h" | 81 #include "content/renderer/mhtml_generator.h" |
| 80 #include "content/renderer/mouse_lock_dispatcher.h" | 82 #include "content/renderer/mouse_lock_dispatcher.h" |
| 81 #include "content/renderer/notification_provider.h" | 83 #include "content/renderer/notification_provider.h" |
| 82 #include "content/renderer/p2p/socket_dispatcher.h" | 84 #include "content/renderer/p2p/socket_dispatcher.h" |
| 83 #include "content/renderer/plugin_channel_host.h" | 85 #include "content/renderer/plugin_channel_host.h" |
| 84 #include "content/renderer/browser_plugin/browser_plugin.h" | |
| 85 #include "content/renderer/browser_plugin/browser_plugin_constants.h" | |
| 86 #include "content/renderer/render_process.h" | 86 #include "content/renderer/render_process.h" |
| 87 #include "content/renderer/render_thread_impl.h" | 87 #include "content/renderer/render_thread_impl.h" |
| 88 #include "content/renderer/render_widget_fullscreen_pepper.h" | 88 #include "content/renderer/render_widget_fullscreen_pepper.h" |
| 89 #include "content/renderer/renderer_accessibility.h" | 89 #include "content/renderer/renderer_accessibility.h" |
| 90 #include "content/renderer/renderer_webapplicationcachehost_impl.h" | 90 #include "content/renderer/renderer_webapplicationcachehost_impl.h" |
| 91 #include "content/renderer/renderer_webcolorchooser_impl.h" | 91 #include "content/renderer/renderer_webcolorchooser_impl.h" |
| 92 #include "content/renderer/speech_recognition_dispatcher.h" | 92 #include "content/renderer/speech_recognition_dispatcher.h" |
| 93 #include "content/renderer/text_input_client_observer.h" | 93 #include "content/renderer/text_input_client_observer.h" |
| 94 #include "content/renderer/v8_value_converter_impl.h" | 94 #include "content/renderer/v8_value_converter_impl.h" |
| 95 #include "content/renderer/web_intents_host.h" | 95 #include "content/renderer/web_intents_host.h" |
| 96 #include "content/renderer/web_ui_bindings.h" | 96 #include "content/renderer/web_ui_bindings.h" |
| 97 #include "content/renderer/webplugin_delegate_proxy.h" | 97 #include "content/renderer/webplugin_delegate_proxy.h" |
| 98 #include "content/renderer/websharedworker_proxy.h" | 98 #include "content/renderer/websharedworker_proxy.h" |
| 99 #include "media/base/filter_collection.h" | 99 #include "media/base/filter_collection.h" |
| 100 #include "media/base/media_switches.h" | 100 #include "media/base/media_switches.h" |
| 101 #include "media/base/message_loop_factory.h" | 101 #include "media/base/message_loop_factory.h" |
| 102 #include "media/filters/audio_renderer_impl.h" | 102 #include "media/filters/audio_renderer_impl.h" |
| 103 #include "media/filters/gpu_video_decoder.h" | 103 #include "media/filters/gpu_video_decoder.h" |
| 104 #include "net/base/escape.h" | 104 #include "net/base/escape.h" |
| 105 #include "net/base/net_errors.h" | 105 #include "net/base/net_errors.h" |
| 106 #include "net/http/http_util.h" | 106 #include "net/http/http_util.h" |
| 107 #include "third_party/WebKit/Source/WebKit/chromium/public/WebAccessibilityObjec
t.h" | 107 #include "third_party/WebKit/Source/WebKit/chromium/public/WebAccessibilityObjec
t.h" |
| 108 #include "third_party/WebKit/Source/WebKit/chromium/public/WebDOMEvent.h" |
| 109 #include "third_party/WebKit/Source/WebKit/chromium/public/WebDOMMessageEvent.h" |
| 108 #include "third_party/WebKit/Source/WebKit/chromium/public/WebDataSource.h" | 110 #include "third_party/WebKit/Source/WebKit/chromium/public/WebDataSource.h" |
| 109 #include "third_party/WebKit/Source/WebKit/chromium/public/WebDocument.h" | 111 #include "third_party/WebKit/Source/WebKit/chromium/public/WebDocument.h" |
| 110 #include "third_party/WebKit/Source/WebKit/chromium/public/WebDOMEvent.h" | |
| 111 #include "third_party/WebKit/Source/WebKit/chromium/public/WebDOMMessageEvent.h" | |
| 112 #include "third_party/WebKit/Source/WebKit/chromium/public/WebElement.h" | 112 #include "third_party/WebKit/Source/WebKit/chromium/public/WebElement.h" |
| 113 #include "third_party/WebKit/Source/WebKit/chromium/public/WebFileChooserParams.
h" | 113 #include "third_party/WebKit/Source/WebKit/chromium/public/WebFileChooserParams.
h" |
| 114 #include "third_party/WebKit/Source/WebKit/chromium/public/WebFileSystemCallback
s.h" | 114 #include "third_party/WebKit/Source/WebKit/chromium/public/WebFileSystemCallback
s.h" |
| 115 #include "third_party/WebKit/Source/WebKit/chromium/public/WebFindOptions.h" | 115 #include "third_party/WebKit/Source/WebKit/chromium/public/WebFindOptions.h" |
| 116 #include "third_party/WebKit/Source/WebKit/chromium/public/WebFormControlElement
.h" | 116 #include "third_party/WebKit/Source/WebKit/chromium/public/WebFormControlElement
.h" |
| 117 #include "third_party/WebKit/Source/WebKit/chromium/public/WebFormElement.h" | 117 #include "third_party/WebKit/Source/WebKit/chromium/public/WebFormElement.h" |
| 118 #include "third_party/WebKit/Source/WebKit/chromium/public/WebFrame.h" | 118 #include "third_party/WebKit/Source/WebKit/chromium/public/WebFrame.h" |
| 119 #include "third_party/WebKit/Source/WebKit/chromium/public/WebHistoryItem.h" | 119 #include "third_party/WebKit/Source/WebKit/chromium/public/WebHistoryItem.h" |
| 120 #include "third_party/WebKit/Source/WebKit/chromium/public/WebInputElement.h" | 120 #include "third_party/WebKit/Source/WebKit/chromium/public/WebInputElement.h" |
| 121 #include "third_party/WebKit/Source/WebKit/chromium/public/WebInputEvent.h" | 121 #include "third_party/WebKit/Source/WebKit/chromium/public/WebInputEvent.h" |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 154 #include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebSerialize
dScriptValue.h" | 154 #include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebSerialize
dScriptValue.h" |
| 155 #include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebSize.h" | 155 #include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebSize.h" |
| 156 #include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebSocketStr
eamHandle.h" | 156 #include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebSocketStr
eamHandle.h" |
| 157 #include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebString.h" | 157 #include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebString.h" |
| 158 #include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebURL.h" | 158 #include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebURL.h" |
| 159 #include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebURLError.
h" | 159 #include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebURLError.
h" |
| 160 #include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebURLReques
t.h" | 160 #include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebURLReques
t.h" |
| 161 #include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebURLRespon
se.h" | 161 #include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebURLRespon
se.h" |
| 162 #include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebVector.h" | 162 #include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebVector.h" |
| 163 #include "third_party/skia/include/core/SkBitmap.h" | 163 #include "third_party/skia/include/core/SkBitmap.h" |
| 164 #include "ui/base/javascript_message_type.h" | |
| 165 #include "ui/gfx/native_widget_types.h" | 164 #include "ui/gfx/native_widget_types.h" |
| 166 #include "ui/gfx/point.h" | 165 #include "ui/gfx/point.h" |
| 167 #include "ui/gfx/rect.h" | 166 #include "ui/gfx/rect.h" |
| 168 #include "v8/include/v8.h" | 167 #include "v8/include/v8.h" |
| 169 #include "webkit/appcache/web_application_cache_host_impl.h" | 168 #include "webkit/appcache/web_application_cache_host_impl.h" |
| 170 #include "webkit/dom_storage/dom_storage_types.h" | 169 #include "webkit/dom_storage/dom_storage_types.h" |
| 171 #include "webkit/forms/form_data.h" | 170 #include "webkit/forms/form_data.h" |
| 172 #include "webkit/forms/form_field.h" | 171 #include "webkit/forms/form_field.h" |
| 173 #include "webkit/forms/password_form_dom_manager.h" | 172 #include "webkit/forms/password_form_dom_manager.h" |
| 174 #include "webkit/glue/alt_error_page_resource_fetcher.h" | 173 #include "webkit/glue/alt_error_page_resource_fetcher.h" |
| (...skipping 1373 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1548 failed_request, error, &alt_html, NULL); | 1547 failed_request, error, &alt_html, NULL); |
| 1549 error_html = &alt_html; | 1548 error_html = &alt_html; |
| 1550 } | 1549 } |
| 1551 | 1550 |
| 1552 frame->loadHTMLString(*error_html, | 1551 frame->loadHTMLString(*error_html, |
| 1553 GURL(content::kUnreachableWebDataURL), | 1552 GURL(content::kUnreachableWebDataURL), |
| 1554 error.unreachableURL, | 1553 error.unreachableURL, |
| 1555 replace); | 1554 replace); |
| 1556 } | 1555 } |
| 1557 | 1556 |
| 1558 bool RenderViewImpl::RunJavaScriptMessage(ui::JavascriptMessageType type, | 1557 bool RenderViewImpl::RunJavaScriptMessage(content::JavaScriptMessageType type, |
| 1559 const string16& message, | 1558 const string16& message, |
| 1560 const string16& default_value, | 1559 const string16& default_value, |
| 1561 const GURL& frame_url, | 1560 const GURL& frame_url, |
| 1562 string16* result) { | 1561 string16* result) { |
| 1563 bool success = false; | 1562 bool success = false; |
| 1564 string16 result_temp; | 1563 string16 result_temp; |
| 1565 if (!result) | 1564 if (!result) |
| 1566 result = &result_temp; | 1565 result = &result_temp; |
| 1567 | 1566 |
| 1568 SendAndRunNestedMessageLoop(new ViewHostMsg_RunJavaScriptMessage( | 1567 SendAndRunNestedMessageLoop(new ViewHostMsg_RunJavaScriptMessage( |
| (...skipping 344 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1913 webkit_glue::WebStringToFilePath(params.initialValue); | 1912 webkit_glue::WebStringToFilePath(params.initialValue); |
| 1914 ipc_params.accept_types.reserve(params.acceptMIMETypes.size()); | 1913 ipc_params.accept_types.reserve(params.acceptMIMETypes.size()); |
| 1915 for (size_t i = 0; i < params.acceptMIMETypes.size(); ++i) | 1914 for (size_t i = 0; i < params.acceptMIMETypes.size(); ++i) |
| 1916 ipc_params.accept_types.push_back(params.acceptMIMETypes[i]); | 1915 ipc_params.accept_types.push_back(params.acceptMIMETypes[i]); |
| 1917 | 1916 |
| 1918 return ScheduleFileChooser(ipc_params, chooser_completion); | 1917 return ScheduleFileChooser(ipc_params, chooser_completion); |
| 1919 } | 1918 } |
| 1920 | 1919 |
| 1921 void RenderViewImpl::runModalAlertDialog(WebFrame* frame, | 1920 void RenderViewImpl::runModalAlertDialog(WebFrame* frame, |
| 1922 const WebString& message) { | 1921 const WebString& message) { |
| 1923 RunJavaScriptMessage(ui::JAVASCRIPT_MESSAGE_TYPE_ALERT, | 1922 RunJavaScriptMessage(content::JAVASCRIPT_MESSAGE_TYPE_ALERT, |
| 1924 message, | 1923 message, |
| 1925 string16(), | 1924 string16(), |
| 1926 frame->document().url(), | 1925 frame->document().url(), |
| 1927 NULL); | 1926 NULL); |
| 1928 } | 1927 } |
| 1929 | 1928 |
| 1930 bool RenderViewImpl::runModalConfirmDialog(WebFrame* frame, | 1929 bool RenderViewImpl::runModalConfirmDialog(WebFrame* frame, |
| 1931 const WebString& message) { | 1930 const WebString& message) { |
| 1932 return RunJavaScriptMessage(ui::JAVASCRIPT_MESSAGE_TYPE_CONFIRM, | 1931 return RunJavaScriptMessage(content::JAVASCRIPT_MESSAGE_TYPE_CONFIRM, |
| 1933 message, | 1932 message, |
| 1934 string16(), | 1933 string16(), |
| 1935 frame->document().url(), | 1934 frame->document().url(), |
| 1936 NULL); | 1935 NULL); |
| 1937 } | 1936 } |
| 1938 | 1937 |
| 1939 bool RenderViewImpl::runModalPromptDialog(WebFrame* frame, | 1938 bool RenderViewImpl::runModalPromptDialog(WebFrame* frame, |
| 1940 const WebString& message, | 1939 const WebString& message, |
| 1941 const WebString& default_value, | 1940 const WebString& default_value, |
| 1942 WebString* actual_value) { | 1941 WebString* actual_value) { |
| 1943 string16 result; | 1942 string16 result; |
| 1944 bool ok = RunJavaScriptMessage(ui::JAVASCRIPT_MESSAGE_TYPE_PROMPT, | 1943 bool ok = RunJavaScriptMessage(content::JAVASCRIPT_MESSAGE_TYPE_PROMPT, |
| 1945 message, | 1944 message, |
| 1946 default_value, | 1945 default_value, |
| 1947 frame->document().url(), | 1946 frame->document().url(), |
| 1948 &result); | 1947 &result); |
| 1949 if (ok) | 1948 if (ok) |
| 1950 actual_value->assign(result); | 1949 actual_value->assign(result); |
| 1951 return ok; | 1950 return ok; |
| 1952 } | 1951 } |
| 1953 | 1952 |
| 1954 bool RenderViewImpl::runModalBeforeUnloadDialog( | 1953 bool RenderViewImpl::runModalBeforeUnloadDialog( |
| (...skipping 3581 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5536 bool RenderViewImpl::WebWidgetHandlesCompositorScheduling() const { | 5535 bool RenderViewImpl::WebWidgetHandlesCompositorScheduling() const { |
| 5537 return !!RenderThreadImpl::current()->compositor_thread(); | 5536 return !!RenderThreadImpl::current()->compositor_thread(); |
| 5538 } | 5537 } |
| 5539 | 5538 |
| 5540 void RenderViewImpl::OnJavaBridgeInit() { | 5539 void RenderViewImpl::OnJavaBridgeInit() { |
| 5541 DCHECK(!java_bridge_dispatcher_); | 5540 DCHECK(!java_bridge_dispatcher_); |
| 5542 #if defined(ENABLE_JAVA_BRIDGE) | 5541 #if defined(ENABLE_JAVA_BRIDGE) |
| 5543 java_bridge_dispatcher_ = new JavaBridgeDispatcher(this); | 5542 java_bridge_dispatcher_ = new JavaBridgeDispatcher(this); |
| 5544 #endif | 5543 #endif |
| 5545 } | 5544 } |
| OLD | NEW |