| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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.h" | 5 #include "content/renderer/render_view.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> |
| 11 | 11 |
| 12 #include "base/callback.h" | 12 #include "base/callback.h" |
| 13 #include "base/command_line.h" | 13 #include "base/command_line.h" |
| 14 #include "base/compiler_specific.h" | 14 #include "base/compiler_specific.h" |
| 15 #include "base/lazy_instance.h" | 15 #include "base/lazy_instance.h" |
| 16 #include "base/metrics/histogram.h" | 16 #include "base/metrics/histogram.h" |
| 17 #include "base/path_service.h" | 17 #include "base/path_service.h" |
| 18 #include "base/process_util.h" | 18 #include "base/process_util.h" |
| 19 #include "base/string_piece.h" | 19 #include "base/string_piece.h" |
| 20 #include "base/string_util.h" | 20 #include "base/string_util.h" |
| 21 #include "base/sys_string_conversions.h" | 21 #include "base/sys_string_conversions.h" |
| 22 #include "base/time.h" | 22 #include "base/time.h" |
| 23 #include "base/utf_string_conversions.h" | 23 #include "base/utf_string_conversions.h" |
| 24 #include "chrome/common/bindings_policy.h" | |
| 25 #include "chrome/common/chrome_constants.h" | |
| 26 #include "chrome/common/chrome_paths.h" | |
| 27 #include "chrome/common/chrome_switches.h" | |
| 28 #include "chrome/common/pepper_plugin_registry.h" | 24 #include "chrome/common/pepper_plugin_registry.h" |
| 29 #include "chrome/common/render_messages.h" | 25 #include "chrome/common/render_messages.h" |
| 30 #include "chrome/common/url_constants.h" | |
| 31 #include "chrome/renderer/automation/dom_automation_controller.h" | |
| 32 #include "chrome/renderer/external_host_bindings.h" | |
| 33 #include "chrome/renderer/localized_error.h" | |
| 34 #include "content/common/appcache/appcache_dispatcher.h" | 26 #include "content/common/appcache/appcache_dispatcher.h" |
| 27 #include "content/common/bindings_policy.h" |
| 35 #include "content/common/clipboard_messages.h" | 28 #include "content/common/clipboard_messages.h" |
| 36 #include "content/common/content_constants.h" | 29 #include "content/common/content_constants.h" |
| 30 #include "content/common/content_switches.h" |
| 37 #include "content/common/database_messages.h" | 31 #include "content/common/database_messages.h" |
| 38 #include "content/common/drag_messages.h" | 32 #include "content/common/drag_messages.h" |
| 39 #include "content/common/file_system/file_system_dispatcher.h" | 33 #include "content/common/file_system/file_system_dispatcher.h" |
| 40 #include "content/common/file_system/webfilesystem_callback_dispatcher.h" | 34 #include "content/common/file_system/webfilesystem_callback_dispatcher.h" |
| 41 #include "content/common/json_value_serializer.h" | 35 #include "content/common/json_value_serializer.h" |
| 42 #include "content/common/notification_service.h" | 36 #include "content/common/notification_service.h" |
| 43 #include "content/common/pepper_messages.h" | 37 #include "content/common/pepper_messages.h" |
| 44 #include "content/common/quota_dispatcher.h" | 38 #include "content/common/quota_dispatcher.h" |
| 45 #include "content/common/renderer_preferences.h" | 39 #include "content/common/renderer_preferences.h" |
| 40 #include "content/common/url_constants.h" |
| 46 #include "content/common/view_messages.h" | 41 #include "content/common/view_messages.h" |
| 47 #include "content/renderer/audio_message_filter.h" | 42 #include "content/renderer/audio_message_filter.h" |
| 48 #include "content/renderer/content_renderer_client.h" | 43 #include "content/renderer/content_renderer_client.h" |
| 49 #include "content/renderer/device_orientation_dispatcher.h" | 44 #include "content/renderer/device_orientation_dispatcher.h" |
| 50 #include "content/renderer/external_popup_menu.h" | 45 #include "content/renderer/external_popup_menu.h" |
| 51 #include "content/renderer/geolocation_dispatcher.h" | 46 #include "content/renderer/geolocation_dispatcher.h" |
| 52 #include "content/renderer/load_progress_tracker.h" | 47 #include "content/renderer/load_progress_tracker.h" |
| 53 #include "content/renderer/media/audio_renderer_impl.h" | 48 #include "content/renderer/media/audio_renderer_impl.h" |
| 54 #include "content/renderer/media/ipc_video_decoder.h" | 49 #include "content/renderer/media/ipc_video_decoder.h" |
| 55 #include "content/renderer/navigation_state.h" | 50 #include "content/renderer/navigation_state.h" |
| 56 #include "content/renderer/notification_provider.h" | 51 #include "content/renderer/notification_provider.h" |
| 57 #include "content/renderer/p2p/socket_dispatcher.h" | 52 #include "content/renderer/p2p/socket_dispatcher.h" |
| 58 #include "content/renderer/plugin_channel_host.h" | 53 #include "content/renderer/plugin_channel_host.h" |
| 59 #include "content/renderer/render_process.h" | 54 #include "content/renderer/render_process.h" |
| 60 #include "content/renderer/render_thread.h" | 55 #include "content/renderer/render_thread.h" |
| 61 #include "content/renderer/render_view_observer.h" | 56 #include "content/renderer/render_view_observer.h" |
| 62 #include "content/renderer/render_view_visitor.h" | 57 #include "content/renderer/render_view_visitor.h" |
| 63 #include "content/renderer/render_widget_fullscreen_pepper.h" | 58 #include "content/renderer/render_widget_fullscreen_pepper.h" |
| 64 #include "content/renderer/renderer_webapplicationcachehost_impl.h" | 59 #include "content/renderer/renderer_webapplicationcachehost_impl.h" |
| 65 #include "content/renderer/renderer_webstoragenamespace_impl.h" | 60 #include "content/renderer/renderer_webstoragenamespace_impl.h" |
| 66 #include "content/renderer/speech_input_dispatcher.h" | 61 #include "content/renderer/speech_input_dispatcher.h" |
| 67 #include "content/renderer/web_ui_bindings.h" | 62 #include "content/renderer/web_ui_bindings.h" |
| 68 #include "content/renderer/webgraphicscontext3d_command_buffer_impl.h" | 63 #include "content/renderer/webgraphicscontext3d_command_buffer_impl.h" |
| 69 #include "content/renderer/webplugin_delegate_proxy.h" | 64 #include "content/renderer/webplugin_delegate_proxy.h" |
| 70 #include "content/renderer/websharedworker_proxy.h" | 65 #include "content/renderer/websharedworker_proxy.h" |
| 71 #include "content/renderer/webworker_proxy.h" | 66 #include "content/renderer/webworker_proxy.h" |
| 72 #include "media/base/filter_collection.h" | 67 #include "media/base/filter_collection.h" |
| 73 #include "media/base/media_switches.h" | 68 #include "media/base/media_switches.h" |
| 74 #include "media/base/message_loop_factory_impl.h" | 69 #include "media/base/message_loop_factory_impl.h" |
| 75 #include "net/base/data_url.h" | |
| 76 #include "net/base/escape.h" | 70 #include "net/base/escape.h" |
| 77 #include "net/base/net_errors.h" | 71 #include "net/base/net_errors.h" |
| 78 #include "net/http/http_util.h" | 72 #include "net/http/http_util.h" |
| 79 #include "ppapi/c/private/ppb_flash_net_connector.h" | 73 #include "ppapi/c/private/ppb_flash_net_connector.h" |
| 80 #include "third_party/WebKit/Source/WebKit/chromium/public/WebAccessibilityCache
.h" | 74 #include "third_party/WebKit/Source/WebKit/chromium/public/WebAccessibilityCache
.h" |
| 81 #include "third_party/WebKit/Source/WebKit/chromium/public/WebAccessibilityObjec
t.h" | 75 #include "third_party/WebKit/Source/WebKit/chromium/public/WebAccessibilityObjec
t.h" |
| 82 #include "third_party/WebKit/Source/WebKit/chromium/public/WebCString.h" | 76 #include "third_party/WebKit/Source/WebKit/chromium/public/WebCString.h" |
| 83 #include "third_party/WebKit/Source/WebKit/chromium/public/WebDataSource.h" | 77 #include "third_party/WebKit/Source/WebKit/chromium/public/WebDataSource.h" |
| 84 #include "third_party/WebKit/Source/WebKit/chromium/public/WebDocument.h" | 78 #include "third_party/WebKit/Source/WebKit/chromium/public/WebDocument.h" |
| 85 #include "third_party/WebKit/Source/WebKit/chromium/public/WebDragData.h" | 79 #include "third_party/WebKit/Source/WebKit/chromium/public/WebDragData.h" |
| 86 #include "third_party/WebKit/Source/WebKit/chromium/public/WebElement.h" | 80 #include "third_party/WebKit/Source/WebKit/chromium/public/WebElement.h" |
| 87 #include "third_party/WebKit/Source/WebKit/chromium/public/WebFileChooserParams.
h" | 81 #include "third_party/WebKit/Source/WebKit/chromium/public/WebFileChooserParams.
h" |
| 88 #include "third_party/WebKit/Source/WebKit/chromium/public/WebFileSystemCallback
s.h" | 82 #include "third_party/WebKit/Source/WebKit/chromium/public/WebFileSystemCallback
s.h" |
| 89 #include "third_party/WebKit/Source/WebKit/chromium/public/WebFindOptions.h" | 83 #include "third_party/WebKit/Source/WebKit/chromium/public/WebFindOptions.h" |
| 90 #include "third_party/WebKit/Source/WebKit/chromium/public/WebFormControlElement
.h" | 84 #include "third_party/WebKit/Source/WebKit/chromium/public/WebFormControlElement
.h" |
| 91 #include "third_party/WebKit/Source/WebKit/chromium/public/WebFormElement.h" | 85 #include "third_party/WebKit/Source/WebKit/chromium/public/WebFormElement.h" |
| 92 #include "third_party/WebKit/Source/WebKit/chromium/public/WebFrame.h" | 86 #include "third_party/WebKit/Source/WebKit/chromium/public/WebFrame.h" |
| 93 #include "third_party/WebKit/Source/WebKit/chromium/public/WebGraphicsContext3D.
h" | 87 #include "third_party/WebKit/Source/WebKit/chromium/public/WebGraphicsContext3D.
h" |
| 94 #include "third_party/WebKit/Source/WebKit/chromium/public/WebHistoryItem.h" | 88 #include "third_party/WebKit/Source/WebKit/chromium/public/WebHistoryItem.h" |
| 95 #include "third_party/WebKit/Source/WebKit/chromium/public/WebImage.h" | 89 #include "third_party/WebKit/Source/WebKit/chromium/public/WebImage.h" |
| 96 #include "third_party/WebKit/Source/WebKit/chromium/public/WebInputElement.h" | 90 #include "third_party/WebKit/Source/WebKit/chromium/public/WebInputElement.h" |
| 97 #include "third_party/WebKit/Source/WebKit/chromium/public/WebMediaPlayerAction.
h" | 91 #include "third_party/WebKit/Source/WebKit/chromium/public/WebMediaPlayerAction.
h" |
| 98 #include "third_party/WebKit/Source/WebKit/chromium/public/WebNetworkStateNotifi
er.h" | 92 #include "third_party/WebKit/Source/WebKit/chromium/public/WebNetworkStateNotifi
er.h" |
| 99 #include "third_party/WebKit/Source/WebKit/chromium/public/WebNodeList.h" | 93 #include "third_party/WebKit/Source/WebKit/chromium/public/WebNodeList.h" |
| 100 #include "third_party/WebKit/Source/WebKit/chromium/public/WebPageSerializer.h" | |
| 101 #include "third_party/WebKit/Source/WebKit/chromium/public/WebPlugin.h" | 94 #include "third_party/WebKit/Source/WebKit/chromium/public/WebPlugin.h" |
| 102 #include "third_party/WebKit/Source/WebKit/chromium/public/WebPluginContainer.h" | 95 #include "third_party/WebKit/Source/WebKit/chromium/public/WebPluginContainer.h" |
| 103 #include "third_party/WebKit/Source/WebKit/chromium/public/WebPluginDocument.h" | 96 #include "third_party/WebKit/Source/WebKit/chromium/public/WebPluginDocument.h" |
| 104 #include "third_party/WebKit/Source/WebKit/chromium/public/WebPluginParams.h" | 97 #include "third_party/WebKit/Source/WebKit/chromium/public/WebPluginParams.h" |
| 105 #include "third_party/WebKit/Source/WebKit/chromium/public/WebPoint.h" | 98 #include "third_party/WebKit/Source/WebKit/chromium/public/WebPoint.h" |
| 106 #include "third_party/WebKit/Source/WebKit/chromium/public/WebRange.h" | 99 #include "third_party/WebKit/Source/WebKit/chromium/public/WebRange.h" |
| 107 #include "third_party/WebKit/Source/WebKit/chromium/public/WebRect.h" | 100 #include "third_party/WebKit/Source/WebKit/chromium/public/WebRect.h" |
| 108 #include "third_party/WebKit/Source/WebKit/chromium/public/WebScriptSource.h" | 101 #include "third_party/WebKit/Source/WebKit/chromium/public/WebScriptSource.h" |
| 109 #include "third_party/WebKit/Source/WebKit/chromium/public/WebSearchableFormData
.h" | 102 #include "third_party/WebKit/Source/WebKit/chromium/public/WebSearchableFormData
.h" |
| 110 #include "third_party/WebKit/Source/WebKit/chromium/public/WebSecurityOrigin.h" | 103 #include "third_party/WebKit/Source/WebKit/chromium/public/WebSecurityOrigin.h" |
| 111 #include "third_party/WebKit/Source/WebKit/chromium/public/WebSettings.h" | 104 #include "third_party/WebKit/Source/WebKit/chromium/public/WebSettings.h" |
| 112 #include "third_party/WebKit/Source/WebKit/chromium/public/WebSize.h" | 105 #include "third_party/WebKit/Source/WebKit/chromium/public/WebSize.h" |
| 113 #include "third_party/WebKit/Source/WebKit/chromium/public/WebStorageNamespace.h
" | 106 #include "third_party/WebKit/Source/WebKit/chromium/public/WebStorageNamespace.h
" |
| 114 #include "third_party/WebKit/Source/WebKit/chromium/public/WebStorageQuotaCallba
cks.h" | 107 #include "third_party/WebKit/Source/WebKit/chromium/public/WebStorageQuotaCallba
cks.h" |
| 115 #include "third_party/WebKit/Source/WebKit/chromium/public/WebString.h" | 108 #include "third_party/WebKit/Source/WebKit/chromium/public/WebString.h" |
| 116 #include "third_party/WebKit/Source/WebKit/chromium/public/WebURL.h" | 109 #include "third_party/WebKit/Source/WebKit/chromium/public/WebURL.h" |
| 117 #include "third_party/WebKit/Source/WebKit/chromium/public/WebURLError.h" | 110 #include "third_party/WebKit/Source/WebKit/chromium/public/WebURLError.h" |
| 118 #include "third_party/WebKit/Source/WebKit/chromium/public/WebURLRequest.h" | 111 #include "third_party/WebKit/Source/WebKit/chromium/public/WebURLRequest.h" |
| 119 #include "third_party/WebKit/Source/WebKit/chromium/public/WebURLResponse.h" | 112 #include "third_party/WebKit/Source/WebKit/chromium/public/WebURLResponse.h" |
| 120 #include "third_party/WebKit/Source/WebKit/chromium/public/WebVector.h" | 113 #include "third_party/WebKit/Source/WebKit/chromium/public/WebVector.h" |
| 121 #include "third_party/WebKit/Source/WebKit/chromium/public/WebView.h" | 114 #include "third_party/WebKit/Source/WebKit/chromium/public/WebView.h" |
| 122 #include "third_party/WebKit/Source/WebKit/chromium/public/WebWindowFeatures.h" | 115 #include "third_party/WebKit/Source/WebKit/chromium/public/WebWindowFeatures.h" |
| 123 #include "third_party/skia/include/core/SkBitmap.h" | 116 #include "third_party/skia/include/core/SkBitmap.h" |
| 124 #include "ui/base/message_box_flags.h" | 117 #include "ui/base/message_box_flags.h" |
| 125 #include "ui/gfx/favicon_size.h" | |
| 126 #include "ui/gfx/native_widget_types.h" | 118 #include "ui/gfx/native_widget_types.h" |
| 127 #include "ui/gfx/point.h" | 119 #include "ui/gfx/point.h" |
| 128 #include "ui/gfx/rect.h" | 120 #include "ui/gfx/rect.h" |
| 129 #include "v8/include/v8-testing.h" | |
| 130 #include "v8/include/v8.h" | 121 #include "v8/include/v8.h" |
| 131 #include "webkit/appcache/web_application_cache_host_impl.h" | 122 #include "webkit/appcache/web_application_cache_host_impl.h" |
| 132 #include "webkit/glue/alt_error_page_resource_fetcher.h" | 123 #include "webkit/glue/alt_error_page_resource_fetcher.h" |
| 133 #include "webkit/glue/context_menu.h" | 124 #include "webkit/glue/context_menu.h" |
| 134 #include "webkit/glue/dom_operations.h" | |
| 135 #include "webkit/glue/form_data.h" | 125 #include "webkit/glue/form_data.h" |
| 136 #include "webkit/glue/form_field.h" | 126 #include "webkit/glue/form_field.h" |
| 137 #include "webkit/glue/glue_serialize.h" | 127 #include "webkit/glue/glue_serialize.h" |
| 138 #include "webkit/glue/image_decoder.h" | |
| 139 #include "webkit/glue/image_resource_fetcher.h" | |
| 140 #include "webkit/glue/media/video_renderer_impl.h" | 128 #include "webkit/glue/media/video_renderer_impl.h" |
| 141 #include "webkit/glue/password_form_dom_manager.h" | 129 #include "webkit/glue/password_form_dom_manager.h" |
| 142 #include "webkit/glue/site_isolation_metrics.h" | 130 #include "webkit/glue/site_isolation_metrics.h" |
| 143 #include "webkit/glue/webaccessibility.h" | 131 #include "webkit/glue/webaccessibility.h" |
| 144 #include "webkit/glue/webdropdata.h" | 132 #include "webkit/glue/webdropdata.h" |
| 145 #include "webkit/glue/webkit_constants.h" | 133 #include "webkit/glue/webkit_constants.h" |
| 146 #include "webkit/glue/webkit_glue.h" | 134 #include "webkit/glue/webkit_glue.h" |
| 147 #include "webkit/glue/webmediaplayer_impl.h" | 135 #include "webkit/glue/webmediaplayer_impl.h" |
| 148 #include "webkit/plugins/npapi/default_plugin_shared.h" | 136 #include "webkit/plugins/npapi/default_plugin_shared.h" |
| 149 #include "webkit/plugins/npapi/plugin_list.h" | 137 #include "webkit/plugins/npapi/plugin_list.h" |
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 195 using WebKit::WebHistoryItem; | 183 using WebKit::WebHistoryItem; |
| 196 using WebKit::WebImage; | 184 using WebKit::WebImage; |
| 197 using WebKit::WebInputElement; | 185 using WebKit::WebInputElement; |
| 198 using WebKit::WebMediaPlayer; | 186 using WebKit::WebMediaPlayer; |
| 199 using WebKit::WebMediaPlayerAction; | 187 using WebKit::WebMediaPlayerAction; |
| 200 using WebKit::WebMediaPlayerClient; | 188 using WebKit::WebMediaPlayerClient; |
| 201 using WebKit::WebNavigationPolicy; | 189 using WebKit::WebNavigationPolicy; |
| 202 using WebKit::WebNavigationType; | 190 using WebKit::WebNavigationType; |
| 203 using WebKit::WebNetworkStateNotifier; | 191 using WebKit::WebNetworkStateNotifier; |
| 204 using WebKit::WebNode; | 192 using WebKit::WebNode; |
| 205 using WebKit::WebPageSerializer; | |
| 206 using WebKit::WebPageSerializerClient; | |
| 207 using WebKit::WebPlugin; | 193 using WebKit::WebPlugin; |
| 208 using WebKit::WebPluginContainer; | 194 using WebKit::WebPluginContainer; |
| 209 using WebKit::WebPluginDocument; | 195 using WebKit::WebPluginDocument; |
| 210 using WebKit::WebPluginParams; | 196 using WebKit::WebPluginParams; |
| 211 using WebKit::WebPoint; | 197 using WebKit::WebPoint; |
| 212 using WebKit::WebPopupMenuInfo; | 198 using WebKit::WebPopupMenuInfo; |
| 213 using WebKit::WebRange; | 199 using WebKit::WebRange; |
| 214 using WebKit::WebRect; | 200 using WebKit::WebRect; |
| 215 using WebKit::WebScriptSource; | 201 using WebKit::WebScriptSource; |
| 216 using WebKit::WebSearchableFormData; | 202 using WebKit::WebSearchableFormData; |
| (...skipping 16 matching lines...) Expand all Loading... |
| 233 using WebKit::WebView; | 219 using WebKit::WebView; |
| 234 using WebKit::WebWidget; | 220 using WebKit::WebWidget; |
| 235 using WebKit::WebWindowFeatures; | 221 using WebKit::WebWindowFeatures; |
| 236 using WebKit::WebWorker; | 222 using WebKit::WebWorker; |
| 237 using WebKit::WebWorkerClient; | 223 using WebKit::WebWorkerClient; |
| 238 using appcache::WebApplicationCacheHostImpl; | 224 using appcache::WebApplicationCacheHostImpl; |
| 239 using base::Time; | 225 using base::Time; |
| 240 using base::TimeDelta; | 226 using base::TimeDelta; |
| 241 using webkit_glue::AltErrorPageResourceFetcher; | 227 using webkit_glue::AltErrorPageResourceFetcher; |
| 242 using webkit_glue::FormField; | 228 using webkit_glue::FormField; |
| 243 using webkit_glue::ImageResourceFetcher; | |
| 244 using webkit_glue::PasswordForm; | 229 using webkit_glue::PasswordForm; |
| 245 using webkit_glue::PasswordFormDomManager; | 230 using webkit_glue::PasswordFormDomManager; |
| 246 using webkit_glue::ResourceFetcher; | 231 using webkit_glue::ResourceFetcher; |
| 247 using webkit_glue::SiteIsolationMetrics; | 232 using webkit_glue::SiteIsolationMetrics; |
| 248 using webkit_glue::WebAccessibility; | 233 using webkit_glue::WebAccessibility; |
| 249 | 234 |
| 250 //----------------------------------------------------------------------------- | 235 //----------------------------------------------------------------------------- |
| 251 | 236 |
| 252 typedef std::map<WebKit::WebView*, RenderView*> ViewMap; | 237 typedef std::map<WebKit::WebView*, RenderView*> ViewMap; |
| 253 static base::LazyInstance<ViewMap> g_view_map(base::LINKER_INITIALIZED); | 238 static base::LazyInstance<ViewMap> g_view_map(base::LINKER_INITIALIZED); |
| (...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 388 const WebPreferences& webkit_prefs, | 373 const WebPreferences& webkit_prefs, |
| 389 SharedRenderViewCounter* counter, | 374 SharedRenderViewCounter* counter, |
| 390 int32 routing_id, | 375 int32 routing_id, |
| 391 int64 session_storage_namespace_id, | 376 int64 session_storage_namespace_id, |
| 392 const string16& frame_name) | 377 const string16& frame_name) |
| 393 : RenderWidget(render_thread, WebKit::WebPopupTypeNone), | 378 : RenderWidget(render_thread, WebKit::WebPopupTypeNone), |
| 394 webkit_preferences_(webkit_prefs), | 379 webkit_preferences_(webkit_prefs), |
| 395 send_content_state_immediately_(false), | 380 send_content_state_immediately_(false), |
| 396 enabled_bindings_(0), | 381 enabled_bindings_(0), |
| 397 send_preferred_size_changes_(false), | 382 send_preferred_size_changes_(false), |
| 398 script_can_close_(true), | |
| 399 is_loading_(false), | 383 is_loading_(false), |
| 400 navigation_gesture_(NavigationGestureUnknown), | 384 navigation_gesture_(NavigationGestureUnknown), |
| 401 opened_by_user_gesture_(true), | 385 opened_by_user_gesture_(true), |
| 402 opener_suppressed_(false), | 386 opener_suppressed_(false), |
| 403 is_prerendering_(false), | 387 is_prerendering_(false), |
| 404 page_id_(-1), | 388 page_id_(-1), |
| 405 last_page_id_sent_to_browser_(-1), | 389 last_page_id_sent_to_browser_(-1), |
| 406 history_list_offset_(-1), | 390 history_list_offset_(-1), |
| 407 history_list_length_(0), | 391 history_list_length_(0), |
| 408 has_unload_listener_(false), | 392 has_unload_listener_(false), |
| 409 target_url_status_(TARGET_NONE), | 393 target_url_status_(TARGET_NONE), |
| 410 view_type_(ViewType::INVALID), | |
| 411 browser_window_id_(-1), | |
| 412 ALLOW_THIS_IN_INITIALIZER_LIST(pepper_delegate_(this)), | 394 ALLOW_THIS_IN_INITIALIZER_LIST(pepper_delegate_(this)), |
| 413 ALLOW_THIS_IN_INITIALIZER_LIST(accessibility_method_factory_(this)), | 395 ALLOW_THIS_IN_INITIALIZER_LIST(accessibility_method_factory_(this)), |
| 414 ALLOW_THIS_IN_INITIALIZER_LIST(cookie_jar_(this)), | 396 ALLOW_THIS_IN_INITIALIZER_LIST(cookie_jar_(this)), |
| 415 geolocation_dispatcher_(NULL), | 397 geolocation_dispatcher_(NULL), |
| 416 speech_input_dispatcher_(NULL), | 398 speech_input_dispatcher_(NULL), |
| 417 device_orientation_dispatcher_(NULL), | 399 device_orientation_dispatcher_(NULL), |
| 418 accessibility_ack_pending_(false), | 400 accessibility_ack_pending_(false), |
| 419 p2p_socket_dispatcher_(NULL), | 401 p2p_socket_dispatcher_(NULL), |
| 420 session_storage_namespace_id_(session_storage_namespace_id) { | 402 session_storage_namespace_id_(session_storage_namespace_id) { |
| 421 | 403 |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 457 // If this is a popup, we must wait for the CreatingNew_ACK message before | 439 // If this is a popup, we must wait for the CreatingNew_ACK message before |
| 458 // completing initialization. Otherwise, we can finish it now. | 440 // completing initialization. Otherwise, we can finish it now. |
| 459 if (opener_id == MSG_ROUTING_NONE) { | 441 if (opener_id == MSG_ROUTING_NONE) { |
| 460 did_show_ = true; | 442 did_show_ = true; |
| 461 CompleteInit(parent_hwnd); | 443 CompleteInit(parent_hwnd); |
| 462 } | 444 } |
| 463 | 445 |
| 464 host_window_ = parent_hwnd; | 446 host_window_ = parent_hwnd; |
| 465 | 447 |
| 466 const CommandLine& command_line = *CommandLine::ForCurrentProcess(); | 448 const CommandLine& command_line = *CommandLine::ForCurrentProcess(); |
| 467 if (command_line.HasSwitch(switches::kDomAutomationController)) | |
| 468 enabled_bindings_ |= BindingsPolicy::DOM_AUTOMATION; | |
| 469 if (command_line.HasSwitch(switches::kEnableAccessibility)) | 449 if (command_line.HasSwitch(switches::kEnableAccessibility)) |
| 470 WebAccessibilityCache::enableAccessibility(); | 450 WebAccessibilityCache::enableAccessibility(); |
| 471 | 451 |
| 472 audio_message_filter_ = new AudioMessageFilter(routing_id_); | 452 audio_message_filter_ = new AudioMessageFilter(routing_id_); |
| 473 render_thread_->AddFilter(audio_message_filter_); | 453 render_thread_->AddFilter(audio_message_filter_); |
| 474 | 454 |
| 475 if (CommandLine::ForCurrentProcess()->HasSwitch( | 455 if (CommandLine::ForCurrentProcess()->HasSwitch(switches::kEnableP2PApi)) |
| 476 switches::kEnableP2PApi)) { | |
| 477 p2p_socket_dispatcher_ = new P2PSocketDispatcher(this); | 456 p2p_socket_dispatcher_ = new P2PSocketDispatcher(this); |
| 478 } | |
| 479 | 457 |
| 480 content::GetContentClient()->renderer()->RenderViewCreated(this); | 458 content::GetContentClient()->renderer()->RenderViewCreated(this); |
| 481 } | 459 } |
| 482 | 460 |
| 483 RenderView::~RenderView() { | 461 RenderView::~RenderView() { |
| 484 if (decrement_shared_popup_at_destruction_) | 462 if (decrement_shared_popup_at_destruction_) |
| 485 shared_popup_counter_->data--; | 463 shared_popup_counter_->data--; |
| 486 | 464 |
| 487 // If file chooser is still waiting for answer, dispatch empty answer. | 465 // If file chooser is still waiting for answer, dispatch empty answer. |
| 488 while (!file_chooser_completions_.empty()) { | 466 while (!file_chooser_completions_.empty()) { |
| (...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 580 type == WebKit::WebAccessibilityNotificationLoadComplete) { | 558 type == WebKit::WebAccessibilityNotificationLoadComplete) { |
| 581 return true; | 559 return true; |
| 582 } | 560 } |
| 583 return false; | 561 return false; |
| 584 } | 562 } |
| 585 | 563 |
| 586 WebKit::WebView* RenderView::webview() const { | 564 WebKit::WebView* RenderView::webview() const { |
| 587 return static_cast<WebKit::WebView*>(webwidget()); | 565 return static_cast<WebKit::WebView*>(webwidget()); |
| 588 } | 566 } |
| 589 | 567 |
| 590 void RenderView::UserMetricsRecordAction(const std::string& action) { | |
| 591 Send(new ViewHostMsg_UserMetricsRecordAction(action)); | |
| 592 } | |
| 593 | |
| 594 void RenderView::SetReportLoadProgressEnabled(bool enabled) { | 568 void RenderView::SetReportLoadProgressEnabled(bool enabled) { |
| 595 if (!enabled) { | 569 if (!enabled) { |
| 596 load_progress_tracker_.reset(NULL); | 570 load_progress_tracker_.reset(NULL); |
| 597 return; | 571 return; |
| 598 } | 572 } |
| 599 if (load_progress_tracker_ == NULL) | 573 if (load_progress_tracker_ == NULL) |
| 600 load_progress_tracker_.reset(new LoadProgressTracker(this)); | 574 load_progress_tracker_.reset(new LoadProgressTracker(this)); |
| 601 } | 575 } |
| 602 | 576 |
| 603 void RenderView::PluginCrashed(const FilePath& plugin_path) { | 577 void RenderView::PluginCrashed(const FilePath& plugin_path) { |
| (...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 682 IPC_MESSAGE_HANDLER(ViewMsg_FindReplyACK, OnFindReplyAck) | 656 IPC_MESSAGE_HANDLER(ViewMsg_FindReplyACK, OnFindReplyAck) |
| 683 IPC_MESSAGE_HANDLER(ViewMsg_Zoom, OnZoom) | 657 IPC_MESSAGE_HANDLER(ViewMsg_Zoom, OnZoom) |
| 684 IPC_MESSAGE_HANDLER(ViewMsg_SetContentSettingsForLoadingURL, | 658 IPC_MESSAGE_HANDLER(ViewMsg_SetContentSettingsForLoadingURL, |
| 685 OnSetContentSettingsForLoadingURL) | 659 OnSetContentSettingsForLoadingURL) |
| 686 IPC_MESSAGE_HANDLER(ViewMsg_SetZoomLevel, OnSetZoomLevel) | 660 IPC_MESSAGE_HANDLER(ViewMsg_SetZoomLevel, OnSetZoomLevel) |
| 687 IPC_MESSAGE_HANDLER(ViewMsg_SetZoomLevelForLoadingURL, | 661 IPC_MESSAGE_HANDLER(ViewMsg_SetZoomLevelForLoadingURL, |
| 688 OnSetZoomLevelForLoadingURL) | 662 OnSetZoomLevelForLoadingURL) |
| 689 IPC_MESSAGE_HANDLER(ViewMsg_SetPageEncoding, OnSetPageEncoding) | 663 IPC_MESSAGE_HANDLER(ViewMsg_SetPageEncoding, OnSetPageEncoding) |
| 690 IPC_MESSAGE_HANDLER(ViewMsg_ResetPageEncodingToDefault, | 664 IPC_MESSAGE_HANDLER(ViewMsg_ResetPageEncodingToDefault, |
| 691 OnResetPageEncodingToDefault) | 665 OnResetPageEncodingToDefault) |
| 692 IPC_MESSAGE_HANDLER(ViewMsg_DownloadFavicon, OnDownloadFavicon) | |
| 693 IPC_MESSAGE_HANDLER(ViewMsg_ScriptEvalRequest, OnScriptEvalRequest) | 666 IPC_MESSAGE_HANDLER(ViewMsg_ScriptEvalRequest, OnScriptEvalRequest) |
| 694 IPC_MESSAGE_HANDLER(ViewMsg_CSSInsertRequest, OnCSSInsertRequest) | 667 IPC_MESSAGE_HANDLER(ViewMsg_CSSInsertRequest, OnCSSInsertRequest) |
| 695 IPC_MESSAGE_HANDLER(ViewMsg_ReservePageIDRange, OnReservePageIDRange) | 668 IPC_MESSAGE_HANDLER(ViewMsg_ReservePageIDRange, OnReservePageIDRange) |
| 696 IPC_MESSAGE_HANDLER(DragMsg_TargetDragEnter, OnDragTargetDragEnter) | 669 IPC_MESSAGE_HANDLER(DragMsg_TargetDragEnter, OnDragTargetDragEnter) |
| 697 IPC_MESSAGE_HANDLER(DragMsg_TargetDragOver, OnDragTargetDragOver) | 670 IPC_MESSAGE_HANDLER(DragMsg_TargetDragOver, OnDragTargetDragOver) |
| 698 IPC_MESSAGE_HANDLER(DragMsg_TargetDragLeave, OnDragTargetDragLeave) | 671 IPC_MESSAGE_HANDLER(DragMsg_TargetDragLeave, OnDragTargetDragLeave) |
| 699 IPC_MESSAGE_HANDLER(DragMsg_TargetDrop, OnDragTargetDrop) | 672 IPC_MESSAGE_HANDLER(DragMsg_TargetDrop, OnDragTargetDrop) |
| 700 IPC_MESSAGE_HANDLER(DragMsg_SourceEndedOrMoved, OnDragSourceEndedOrMoved) | 673 IPC_MESSAGE_HANDLER(DragMsg_SourceEndedOrMoved, OnDragSourceEndedOrMoved) |
| 701 IPC_MESSAGE_HANDLER(DragMsg_SourceSystemDragEnded, | 674 IPC_MESSAGE_HANDLER(DragMsg_SourceSystemDragEnded, |
| 702 OnDragSourceSystemDragEnded) | 675 OnDragSourceSystemDragEnded) |
| 703 IPC_MESSAGE_HANDLER(ViewMsg_AllowBindings, OnAllowBindings) | 676 IPC_MESSAGE_HANDLER(ViewMsg_AllowBindings, OnAllowBindings) |
| 704 IPC_MESSAGE_HANDLER(ViewMsg_SetWebUIProperty, OnSetWebUIProperty) | 677 IPC_MESSAGE_HANDLER(ViewMsg_SetWebUIProperty, OnSetWebUIProperty) |
| 705 IPC_MESSAGE_HANDLER(ViewMsg_SetInitialFocus, OnSetInitialFocus) | 678 IPC_MESSAGE_HANDLER(ViewMsg_SetInitialFocus, OnSetInitialFocus) |
| 706 IPC_MESSAGE_HANDLER(ViewMsg_ScrollFocusedEditableNodeIntoView, | 679 IPC_MESSAGE_HANDLER(ViewMsg_ScrollFocusedEditableNodeIntoView, |
| 707 OnScrollFocusedEditableNodeIntoView) | 680 OnScrollFocusedEditableNodeIntoView) |
| 708 IPC_MESSAGE_HANDLER(ViewMsg_UpdateTargetURL_ACK, OnUpdateTargetURLAck) | 681 IPC_MESSAGE_HANDLER(ViewMsg_UpdateTargetURL_ACK, OnUpdateTargetURLAck) |
| 709 IPC_MESSAGE_HANDLER(ViewMsg_UpdateWebPreferences, OnUpdateWebPreferences) | 682 IPC_MESSAGE_HANDLER(ViewMsg_UpdateWebPreferences, OnUpdateWebPreferences) |
| 710 IPC_MESSAGE_HANDLER(ViewMsg_SetAltErrorPageURL, OnSetAltErrorPageURL) | 683 IPC_MESSAGE_HANDLER(ViewMsg_SetAltErrorPageURL, OnSetAltErrorPageURL) |
| 711 IPC_MESSAGE_HANDLER(ViewMsg_InstallMissingPlugin, OnInstallMissingPlugin) | 684 IPC_MESSAGE_HANDLER(ViewMsg_InstallMissingPlugin, OnInstallMissingPlugin) |
| 712 IPC_MESSAGE_HANDLER(ViewMsg_DisplayPrerenderedPage, | 685 IPC_MESSAGE_HANDLER(ViewMsg_DisplayPrerenderedPage, |
| 713 OnDisplayPrerenderedPage) | 686 OnDisplayPrerenderedPage) |
| 714 IPC_MESSAGE_HANDLER(ViewMsg_EnumerateDirectoryResponse, | 687 IPC_MESSAGE_HANDLER(ViewMsg_EnumerateDirectoryResponse, |
| 715 OnEnumerateDirectoryResponse) | 688 OnEnumerateDirectoryResponse) |
| 716 IPC_MESSAGE_HANDLER(ViewMsg_RunFileChooserResponse, OnFileChooserResponse) | 689 IPC_MESSAGE_HANDLER(ViewMsg_RunFileChooserResponse, OnFileChooserResponse) |
| 717 IPC_MESSAGE_HANDLER(ViewMsg_EnableViewSourceMode, OnEnableViewSourceMode) | |
| 718 IPC_MESSAGE_HANDLER(ViewMsg_GetAllSavableResourceLinksForCurrentPage, | |
| 719 OnGetAllSavableResourceLinksForCurrentPage) | |
| 720 IPC_MESSAGE_HANDLER( | |
| 721 ViewMsg_GetSerializedHtmlDataForCurrentPageWithLocalLinks, | |
| 722 OnGetSerializedHtmlDataForCurrentPageWithLocalLinks) | |
| 723 IPC_MESSAGE_HANDLER(ViewMsg_ShouldClose, OnShouldClose) | 690 IPC_MESSAGE_HANDLER(ViewMsg_ShouldClose, OnShouldClose) |
| 724 IPC_MESSAGE_HANDLER(ViewMsg_ClosePage, OnClosePage) | 691 IPC_MESSAGE_HANDLER(ViewMsg_ClosePage, OnClosePage) |
| 725 IPC_MESSAGE_HANDLER(ViewMsg_ThemeChanged, OnThemeChanged) | 692 IPC_MESSAGE_HANDLER(ViewMsg_ThemeChanged, OnThemeChanged) |
| 726 IPC_MESSAGE_HANDLER(ViewMsg_HandleMessageFromExternalHost, | |
| 727 OnHandleMessageFromExternalHost) | |
| 728 IPC_MESSAGE_HANDLER(ViewMsg_DisassociateFromPopupCount, | 693 IPC_MESSAGE_HANDLER(ViewMsg_DisassociateFromPopupCount, |
| 729 OnDisassociateFromPopupCount) | 694 OnDisassociateFromPopupCount) |
| 730 IPC_MESSAGE_HANDLER(ViewMsg_AllowScriptToClose, | |
| 731 OnAllowScriptToClose) | |
| 732 IPC_MESSAGE_HANDLER(ViewMsg_MoveOrResizeStarted, OnMoveOrResizeStarted) | 695 IPC_MESSAGE_HANDLER(ViewMsg_MoveOrResizeStarted, OnMoveOrResizeStarted) |
| 733 IPC_MESSAGE_HANDLER(ViewMsg_ClearFocusedNode, OnClearFocusedNode) | 696 IPC_MESSAGE_HANDLER(ViewMsg_ClearFocusedNode, OnClearFocusedNode) |
| 734 IPC_MESSAGE_HANDLER(ViewMsg_SetBackground, OnSetBackground) | 697 IPC_MESSAGE_HANDLER(ViewMsg_SetBackground, OnSetBackground) |
| 735 IPC_MESSAGE_HANDLER(ViewMsg_EnablePreferredSizeChangedMode, | 698 IPC_MESSAGE_HANDLER(ViewMsg_EnablePreferredSizeChangedMode, |
| 736 OnEnablePreferredSizeChangedMode) | 699 OnEnablePreferredSizeChangedMode) |
| 737 IPC_MESSAGE_HANDLER(ViewMsg_DisableScrollbarsForSmallWindows, | 700 IPC_MESSAGE_HANDLER(ViewMsg_DisableScrollbarsForSmallWindows, |
| 738 OnDisableScrollbarsForSmallWindows) | 701 OnDisableScrollbarsForSmallWindows) |
| 739 IPC_MESSAGE_HANDLER(ViewMsg_SetRendererPrefs, OnSetRendererPrefs) | 702 IPC_MESSAGE_HANDLER(ViewMsg_SetRendererPrefs, OnSetRendererPrefs) |
| 740 IPC_MESSAGE_HANDLER(ViewMsg_UpdateBrowserWindowId, | |
| 741 OnUpdateBrowserWindowId) | |
| 742 IPC_MESSAGE_HANDLER(ViewMsg_NotifyRenderViewType, | |
| 743 OnNotifyRendererViewType) | |
| 744 IPC_MESSAGE_HANDLER(ViewMsg_MediaPlayerActionAt, OnMediaPlayerActionAt) | 703 IPC_MESSAGE_HANDLER(ViewMsg_MediaPlayerActionAt, OnMediaPlayerActionAt) |
| 745 IPC_MESSAGE_HANDLER(ViewMsg_SetActive, OnSetActive) | 704 IPC_MESSAGE_HANDLER(ViewMsg_SetActive, OnSetActive) |
| 746 #if defined(OS_MACOSX) | 705 #if defined(OS_MACOSX) |
| 747 IPC_MESSAGE_HANDLER(ViewMsg_SetWindowVisibility, OnSetWindowVisibility) | 706 IPC_MESSAGE_HANDLER(ViewMsg_SetWindowVisibility, OnSetWindowVisibility) |
| 748 IPC_MESSAGE_HANDLER(ViewMsg_WindowFrameChanged, OnWindowFrameChanged) | 707 IPC_MESSAGE_HANDLER(ViewMsg_WindowFrameChanged, OnWindowFrameChanged) |
| 749 IPC_MESSAGE_HANDLER(ViewMsg_PluginImeCompositionCompleted, | 708 IPC_MESSAGE_HANDLER(ViewMsg_PluginImeCompositionCompleted, |
| 750 OnPluginImeCompositionCompleted) | 709 OnPluginImeCompositionCompleted) |
| 751 #endif | 710 #endif |
| 752 IPC_MESSAGE_HANDLER(ViewMsg_SetEditCommandsForNextKeyEvent, | 711 IPC_MESSAGE_HANDLER(ViewMsg_SetEditCommandsForNextKeyEvent, |
| 753 OnSetEditCommandsForNextKeyEvent) | 712 OnSetEditCommandsForNextKeyEvent) |
| 754 IPC_MESSAGE_HANDLER(ViewMsg_CustomContextMenuAction, | 713 IPC_MESSAGE_HANDLER(ViewMsg_CustomContextMenuAction, |
| 755 OnCustomContextMenuAction) | 714 OnCustomContextMenuAction) |
| 756 IPC_MESSAGE_HANDLER(ViewMsg_EnableAccessibility, OnEnableAccessibility) | 715 IPC_MESSAGE_HANDLER(ViewMsg_EnableAccessibility, OnEnableAccessibility) |
| 757 IPC_MESSAGE_HANDLER(ViewMsg_SetAccessibilityFocus, OnSetAccessibilityFocus) | 716 IPC_MESSAGE_HANDLER(ViewMsg_SetAccessibilityFocus, OnSetAccessibilityFocus) |
| 758 IPC_MESSAGE_HANDLER(ViewMsg_AccessibilityDoDefaultAction, | 717 IPC_MESSAGE_HANDLER(ViewMsg_AccessibilityDoDefaultAction, |
| 759 OnAccessibilityDoDefaultAction) | 718 OnAccessibilityDoDefaultAction) |
| 760 IPC_MESSAGE_HANDLER(ViewMsg_AccessibilityNotifications_ACK, | 719 IPC_MESSAGE_HANDLER(ViewMsg_AccessibilityNotifications_ACK, |
| 761 OnAccessibilityNotificationsAck) | 720 OnAccessibilityNotificationsAck) |
| 762 IPC_MESSAGE_HANDLER(ViewMsg_AsyncOpenFile_ACK, OnAsyncFileOpened) | 721 IPC_MESSAGE_HANDLER(ViewMsg_AsyncOpenFile_ACK, OnAsyncFileOpened) |
| 763 IPC_MESSAGE_HANDLER(ViewMsg_PpapiBrokerChannelCreated, | 722 IPC_MESSAGE_HANDLER(ViewMsg_PpapiBrokerChannelCreated, |
| 764 OnPpapiBrokerChannelCreated) | 723 OnPpapiBrokerChannelCreated) |
| 765 #if defined(OS_MACOSX) | 724 #if defined(OS_MACOSX) |
| 766 IPC_MESSAGE_HANDLER(ViewMsg_SelectPopupMenuItem, OnSelectPopupMenuItem) | 725 IPC_MESSAGE_HANDLER(ViewMsg_SelectPopupMenuItem, OnSelectPopupMenuItem) |
| 767 #endif | 726 #endif |
| 768 IPC_MESSAGE_HANDLER(ViewMsg_JavaScriptStressTestControl, | |
| 769 OnJavaScriptStressTestControl) | |
| 770 IPC_MESSAGE_HANDLER(ViewMsg_ContextMenuClosed, OnContextMenuClosed) | 727 IPC_MESSAGE_HANDLER(ViewMsg_ContextMenuClosed, OnContextMenuClosed) |
| 771 IPC_MESSAGE_HANDLER(ViewMsg_NetworkStateChanged, OnNetworkStateChanged) | 728 IPC_MESSAGE_HANDLER(ViewMsg_NetworkStateChanged, OnNetworkStateChanged) |
| 772 // TODO(viettrungluu): Move to a separate message filter. | 729 // TODO(viettrungluu): Move to a separate message filter. |
| 773 #if defined(ENABLE_FLAPPER_HACKS) | 730 #if defined(ENABLE_FLAPPER_HACKS) |
| 774 IPC_MESSAGE_HANDLER(PepperMsg_ConnectTcpACK, OnConnectTcpACK) | 731 IPC_MESSAGE_HANDLER(PepperMsg_ConnectTcpACK, OnConnectTcpACK) |
| 775 #endif | 732 #endif |
| 776 | 733 |
| 777 // Have the super handle all other messages. | 734 // Have the super handle all other messages. |
| 778 IPC_MESSAGE_UNHANDLED(handled = RenderWidget::OnMessageReceived(message)) | 735 IPC_MESSAGE_UNHANDLED(handled = RenderWidget::OnMessageReceived(message)) |
| 779 IPC_END_MESSAGE_MAP() | 736 IPC_END_MESSAGE_MAP() |
| (...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 918 } | 875 } |
| 919 | 876 |
| 920 target_url_status_ = TARGET_NONE; | 877 target_url_status_ = TARGET_NONE; |
| 921 } | 878 } |
| 922 | 879 |
| 923 void RenderView::OnUndo() { | 880 void RenderView::OnUndo() { |
| 924 if (!webview()) | 881 if (!webview()) |
| 925 return; | 882 return; |
| 926 | 883 |
| 927 webview()->focusedFrame()->executeCommand(WebString::fromUTF8("Undo")); | 884 webview()->focusedFrame()->executeCommand(WebString::fromUTF8("Undo")); |
| 928 UserMetricsRecordAction("Undo"); | |
| 929 } | 885 } |
| 930 | 886 |
| 931 void RenderView::OnRedo() { | 887 void RenderView::OnRedo() { |
| 932 if (!webview()) | 888 if (!webview()) |
| 933 return; | 889 return; |
| 934 | 890 |
| 935 webview()->focusedFrame()->executeCommand(WebString::fromUTF8("Redo")); | 891 webview()->focusedFrame()->executeCommand(WebString::fromUTF8("Redo")); |
| 936 UserMetricsRecordAction("Redo"); | |
| 937 } | 892 } |
| 938 | 893 |
| 939 void RenderView::OnCut() { | 894 void RenderView::OnCut() { |
| 940 if (!webview()) | 895 if (!webview()) |
| 941 return; | 896 return; |
| 942 | 897 |
| 943 webview()->focusedFrame()->executeCommand(WebString::fromUTF8("Cut")); | 898 webview()->focusedFrame()->executeCommand(WebString::fromUTF8("Cut")); |
| 944 UserMetricsRecordAction("Cut"); | |
| 945 } | 899 } |
| 946 | 900 |
| 947 void RenderView::OnCopy() { | 901 void RenderView::OnCopy() { |
| 948 if (!webview()) | 902 if (!webview()) |
| 949 return; | 903 return; |
| 950 | 904 |
| 951 webview()->focusedFrame()->executeCommand(WebString::fromUTF8("Copy")); | 905 webview()->focusedFrame()->executeCommand(WebString::fromUTF8("Copy")); |
| 952 UserMetricsRecordAction("Copy"); | |
| 953 } | 906 } |
| 954 | 907 |
| 955 #if defined(OS_MACOSX) | 908 #if defined(OS_MACOSX) |
| 956 void RenderView::OnCopyToFindPboard() { | 909 void RenderView::OnCopyToFindPboard() { |
| 957 if (!webview()) | 910 if (!webview()) |
| 958 return; | 911 return; |
| 959 | 912 |
| 960 // Since the find pasteboard supports only plain text, this can be simpler | 913 // Since the find pasteboard supports only plain text, this can be simpler |
| 961 // than the |OnCopy()| case. | 914 // than the |OnCopy()| case. |
| 962 WebFrame* frame = webview()->focusedFrame(); | 915 WebFrame* frame = webview()->focusedFrame(); |
| 963 if (frame->hasSelection()) { | 916 if (frame->hasSelection()) { |
| 964 string16 selection = frame->selectionAsText(); | 917 string16 selection = frame->selectionAsText(); |
| 965 RenderThread::current()->Send( | 918 RenderThread::current()->Send( |
| 966 new ClipboardHostMsg_FindPboardWriteStringAsync(selection)); | 919 new ClipboardHostMsg_FindPboardWriteStringAsync(selection)); |
| 967 } | 920 } |
| 968 | |
| 969 UserMetricsRecordAction("CopyToFindPboard"); | |
| 970 } | 921 } |
| 971 #endif | 922 #endif |
| 972 | 923 |
| 973 void RenderView::OnPaste() { | 924 void RenderView::OnPaste() { |
| 974 if (!webview()) | 925 if (!webview()) |
| 975 return; | 926 return; |
| 976 | 927 |
| 977 webview()->focusedFrame()->executeCommand(WebString::fromUTF8("Paste")); | 928 webview()->focusedFrame()->executeCommand(WebString::fromUTF8("Paste")); |
| 978 UserMetricsRecordAction("Paste"); | |
| 979 } | 929 } |
| 980 | 930 |
| 981 void RenderView::OnReplace(const string16& text) { | 931 void RenderView::OnReplace(const string16& text) { |
| 982 if (!webview()) | 932 if (!webview()) |
| 983 return; | 933 return; |
| 984 | 934 |
| 985 WebFrame* frame = webview()->focusedFrame(); | 935 WebFrame* frame = webview()->focusedFrame(); |
| 986 if (!frame->hasSelection()) | 936 if (!frame->hasSelection()) |
| 987 frame->selectWordAroundCaret(); | 937 frame->selectWordAroundCaret(); |
| 988 frame->replaceSelection(text); | 938 frame->replaceSelection(text); |
| 989 } | 939 } |
| 990 | 940 |
| 991 void RenderView::OnDelete() { | 941 void RenderView::OnDelete() { |
| 992 if (!webview()) | 942 if (!webview()) |
| 993 return; | 943 return; |
| 994 | 944 |
| 995 webview()->focusedFrame()->executeCommand(WebString::fromUTF8("Delete")); | 945 webview()->focusedFrame()->executeCommand(WebString::fromUTF8("Delete")); |
| 996 UserMetricsRecordAction("DeleteSelection"); | |
| 997 } | 946 } |
| 998 | 947 |
| 999 void RenderView::OnSelectAll() { | 948 void RenderView::OnSelectAll() { |
| 1000 if (!webview()) | 949 if (!webview()) |
| 1001 return; | 950 return; |
| 1002 | 951 |
| 1003 webview()->focusedFrame()->executeCommand( | 952 webview()->focusedFrame()->executeCommand( |
| 1004 WebString::fromUTF8("SelectAll")); | 953 WebString::fromUTF8("SelectAll")); |
| 1005 UserMetricsRecordAction("SelectAll"); | |
| 1006 } | 954 } |
| 1007 | 955 |
| 1008 void RenderView::OnSetInitialFocus(bool reverse) { | 956 void RenderView::OnSetInitialFocus(bool reverse) { |
| 1009 if (!webview()) | 957 if (!webview()) |
| 1010 return; | 958 return; |
| 1011 webview()->setInitialFocus(reverse); | 959 webview()->setInitialFocus(reverse); |
| 1012 } | 960 } |
| 1013 | 961 |
| 1014 void RenderView::OnScrollFocusedEditableNodeIntoView() { | 962 void RenderView::OnScrollFocusedEditableNodeIntoView() { |
| 1015 WebKit::WebNode node = GetFocusedNode(); | 963 WebKit::WebNode node = GetFocusedNode(); |
| (...skipping 208 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1224 } | 1172 } |
| 1225 } | 1173 } |
| 1226 | 1174 |
| 1227 // Tell the embedding application that the title of the active page has changed | 1175 // Tell the embedding application that the title of the active page has changed |
| 1228 void RenderView::UpdateTitle(WebFrame* frame, const string16& title) { | 1176 void RenderView::UpdateTitle(WebFrame* frame, const string16& title) { |
| 1229 // Ignore all but top level navigations... | 1177 // Ignore all but top level navigations... |
| 1230 if (!frame->parent()) { | 1178 if (!frame->parent()) { |
| 1231 Send(new ViewHostMsg_UpdateTitle( | 1179 Send(new ViewHostMsg_UpdateTitle( |
| 1232 routing_id_, | 1180 routing_id_, |
| 1233 page_id_, | 1181 page_id_, |
| 1234 UTF16ToWideHack(title.length() > chrome::kMaxTitleChars ? | 1182 UTF16ToWideHack(title.length() > content::kMaxTitleChars ? |
| 1235 title.substr(0, chrome::kMaxTitleChars) : title))); | 1183 title.substr(0, content::kMaxTitleChars) : title))); |
| 1236 } | 1184 } |
| 1237 } | 1185 } |
| 1238 | 1186 |
| 1239 void RenderView::UpdateEncoding(WebFrame* frame, | 1187 void RenderView::UpdateEncoding(WebFrame* frame, |
| 1240 const std::string& encoding_name) { | 1188 const std::string& encoding_name) { |
| 1241 // Only update main frame's encoding_name. | 1189 // Only update main frame's encoding_name. |
| 1242 if (webview()->mainFrame() == frame && | 1190 if (webview()->mainFrame() == frame && |
| 1243 last_encoding_name_ != encoding_name) { | 1191 last_encoding_name_ != encoding_name) { |
| 1244 // Save the encoding name for later comparing. | 1192 // Save the encoding name for later comparing. |
| 1245 last_encoding_name_ = encoding_name; | 1193 last_encoding_name_ = encoding_name; |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1282 bool replace) { | 1230 bool replace) { |
| 1283 std::string alt_html = !html.empty() ? html : | 1231 std::string alt_html = !html.empty() ? html : |
| 1284 content::GetContentClient()->renderer()->GetNavigationErrorHtml( | 1232 content::GetContentClient()->renderer()->GetNavigationErrorHtml( |
| 1285 failed_request, error); | 1233 failed_request, error); |
| 1286 frame->loadHTMLString(alt_html, | 1234 frame->loadHTMLString(alt_html, |
| 1287 GURL(chrome::kUnreachableWebDataURL), | 1235 GURL(chrome::kUnreachableWebDataURL), |
| 1288 error.unreachableURL, | 1236 error.unreachableURL, |
| 1289 replace); | 1237 replace); |
| 1290 } | 1238 } |
| 1291 | 1239 |
| 1292 void RenderView::BindDOMAutomationController(WebFrame* frame) { | |
| 1293 if (!dom_automation_controller_.get()) { | |
| 1294 dom_automation_controller_.reset(new DomAutomationController()); | |
| 1295 } | |
| 1296 dom_automation_controller_->set_message_sender(this); | |
| 1297 dom_automation_controller_->set_routing_id(routing_id_); | |
| 1298 dom_automation_controller_->BindToJavascript(frame, | |
| 1299 "domAutomationController"); | |
| 1300 } | |
| 1301 | |
| 1302 bool RenderView::RunJavaScriptMessage(int type, | 1240 bool RenderView::RunJavaScriptMessage(int type, |
| 1303 const std::wstring& message, | 1241 const std::wstring& message, |
| 1304 const std::wstring& default_value, | 1242 const std::wstring& default_value, |
| 1305 const GURL& frame_url, | 1243 const GURL& frame_url, |
| 1306 std::wstring* result) { | 1244 std::wstring* result) { |
| 1307 bool success = false; | 1245 bool success = false; |
| 1308 std::wstring result_temp; | 1246 std::wstring result_temp; |
| 1309 if (!result) | 1247 if (!result) |
| 1310 result = &result_temp; | 1248 result = &result_temp; |
| 1311 | 1249 |
| 1312 SendAndRunNestedMessageLoop(new ViewHostMsg_RunJavaScriptMessage( | 1250 SendAndRunNestedMessageLoop(new ViewHostMsg_RunJavaScriptMessage( |
| 1313 routing_id_, message, default_value, frame_url, type, &success, result)); | 1251 routing_id_, message, default_value, frame_url, type, &success, result)); |
| 1314 return success; | 1252 return success; |
| 1315 } | 1253 } |
| 1316 | 1254 |
| 1317 bool RenderView::SendAndRunNestedMessageLoop(IPC::SyncMessage* message) { | 1255 bool RenderView::SendAndRunNestedMessageLoop(IPC::SyncMessage* message) { |
| 1318 // Before WebKit asks us to show an alert (etc.), it takes care of doing the | 1256 // Before WebKit asks us to show an alert (etc.), it takes care of doing the |
| 1319 // equivalent of WebView::willEnterModalLoop. In the case of showModalDialog | 1257 // equivalent of WebView::willEnterModalLoop. In the case of showModalDialog |
| 1320 // it is particularly important that we do not call willEnterModalLoop as | 1258 // it is particularly important that we do not call willEnterModalLoop as |
| 1321 // that would defer resource loads for the dialog itself. | 1259 // that would defer resource loads for the dialog itself. |
| 1322 if (RenderThread::current()) // Will be NULL during unit tests. | 1260 if (RenderThread::current()) // Will be NULL during unit tests. |
| 1323 RenderThread::current()->DoNotNotifyWebKitOfModalLoop(); | 1261 RenderThread::current()->DoNotNotifyWebKitOfModalLoop(); |
| 1324 | 1262 |
| 1325 message->EnableMessagePumping(); // Runs a nested message loop. | 1263 message->EnableMessagePumping(); // Runs a nested message loop. |
| 1326 return Send(message); | 1264 return Send(message); |
| 1327 } | 1265 } |
| 1328 | 1266 |
| 1329 void RenderView::AddGURLSearchProvider( | |
| 1330 const GURL& osd_url, | |
| 1331 search_provider::OSDDType provider_type) { | |
| 1332 if (!osd_url.is_empty()) | |
| 1333 Send(new ViewHostMsg_PageHasOSDD(routing_id_, page_id_, osd_url, | |
| 1334 provider_type)); | |
| 1335 } | |
| 1336 | |
| 1337 void RenderView::OnAllowScriptToClose(bool script_can_close) { | |
| 1338 script_can_close_ = script_can_close; | |
| 1339 } | |
| 1340 | |
| 1341 void RenderView::AddSearchProvider( | |
| 1342 const std::string& url, | |
| 1343 search_provider::OSDDType provider_type) { | |
| 1344 if (provider_type == search_provider::EXPLICIT_DEFAULT_PROVIDER && | |
| 1345 !webview()->mainFrame()->isProcessingUserGesture()) | |
| 1346 return; | |
| 1347 | |
| 1348 AddGURLSearchProvider(GURL(url), provider_type); | |
| 1349 } | |
| 1350 | |
| 1351 search_provider::InstallState | |
| 1352 RenderView::GetSearchProviderInstallState(WebFrame* frame, | |
| 1353 const std::string& url) { | |
| 1354 GURL inquiry_url = GURL(url); | |
| 1355 if (inquiry_url.is_empty()) | |
| 1356 return search_provider::DENIED; | |
| 1357 | |
| 1358 search_provider::InstallState install; | |
| 1359 Send(new ViewHostMsg_GetSearchProviderInstallState(routing_id_, | |
| 1360 frame->url(), | |
| 1361 inquiry_url, | |
| 1362 &install)); | |
| 1363 return install; | |
| 1364 } | |
| 1365 | |
| 1366 void RenderView::OnMissingPluginStatus( | 1267 void RenderView::OnMissingPluginStatus( |
| 1367 WebPluginDelegateProxy* delegate, | 1268 WebPluginDelegateProxy* delegate, |
| 1368 int status) { | 1269 int status) { |
| 1369 #if defined(OS_WIN) | 1270 #if defined(OS_WIN) |
| 1370 if (!first_default_plugin_) { | 1271 if (!first_default_plugin_) { |
| 1371 // Show the InfoBar for the first available plugin. | 1272 // Show the InfoBar for the first available plugin. |
| 1372 if (status == webkit::npapi::default_plugin::MISSING_PLUGIN_AVAILABLE) { | 1273 if (status == webkit::npapi::default_plugin::MISSING_PLUGIN_AVAILABLE) { |
| 1373 first_default_plugin_ = delegate->AsWeakPtr(); | 1274 first_default_plugin_ = delegate->AsWeakPtr(); |
| 1374 Send(new ViewHostMsg_MissingPluginStatus(routing_id_, status)); | 1275 Send(new ViewHostMsg_MissingPluginStatus(routing_id_, status)); |
| 1375 } | 1276 } |
| (...skipping 17 matching lines...) Expand all Loading... |
| 1393 | 1294 |
| 1394 WebView* RenderView::createView( | 1295 WebView* RenderView::createView( |
| 1395 WebFrame* creator, | 1296 WebFrame* creator, |
| 1396 const WebURLRequest& request, | 1297 const WebURLRequest& request, |
| 1397 const WebWindowFeatures& features, | 1298 const WebWindowFeatures& features, |
| 1398 const WebString& frame_name) { | 1299 const WebString& frame_name) { |
| 1399 // Check to make sure we aren't overloading on popups. | 1300 // Check to make sure we aren't overloading on popups. |
| 1400 if (shared_popup_counter_->data > kMaximumNumberOfUnacknowledgedPopups) | 1301 if (shared_popup_counter_->data > kMaximumNumberOfUnacknowledgedPopups) |
| 1401 return NULL; | 1302 return NULL; |
| 1402 | 1303 |
| 1403 // This window can't be closed from a window.close() call until we receive a | |
| 1404 // message from the Browser process explicitly allowing it. | |
| 1405 script_can_close_ = false; | |
| 1406 | |
| 1407 ViewHostMsg_CreateWindow_Params params; | 1304 ViewHostMsg_CreateWindow_Params params; |
| 1408 params.opener_id = routing_id_; | 1305 params.opener_id = routing_id_; |
| 1409 params.user_gesture = creator->isProcessingUserGesture(); | 1306 params.user_gesture = creator->isProcessingUserGesture(); |
| 1410 params.window_container_type = WindowFeaturesToContainerType(features); | 1307 params.window_container_type = WindowFeaturesToContainerType(features); |
| 1411 params.session_storage_namespace_id = session_storage_namespace_id_; | 1308 params.session_storage_namespace_id = session_storage_namespace_id_; |
| 1412 params.frame_name = frame_name; | 1309 params.frame_name = frame_name; |
| 1413 params.opener_frame_id = creator->identifier(); | 1310 params.opener_frame_id = creator->identifier(); |
| 1414 params.opener_url = creator->url(); | 1311 params.opener_url = creator->url(); |
| 1415 params.opener_security_origin = creator->securityOrigin().toString().utf8(); | 1312 params.opener_security_origin = creator->securityOrigin().toString().utf8(); |
| 1416 if (!request.isNull()) | 1313 if (!request.isNull()) |
| (...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1555 return; | 1452 return; |
| 1556 } | 1453 } |
| 1557 | 1454 |
| 1558 is_loading_ = false; | 1455 is_loading_ = false; |
| 1559 | 1456 |
| 1560 // NOTE: For now we're doing the safest thing, and sending out notification | 1457 // NOTE: For now we're doing the safest thing, and sending out notification |
| 1561 // when done loading. This currently isn't an issue as the favicon is only | 1458 // when done loading. This currently isn't an issue as the favicon is only |
| 1562 // displayed when done loading. Ideally we would send notification when | 1459 // displayed when done loading. Ideally we would send notification when |
| 1563 // finished parsing the head, but webkit doesn't support that yet. | 1460 // finished parsing the head, but webkit doesn't support that yet. |
| 1564 // The feed discovery code would also benefit from access to the head. | 1461 // The feed discovery code would also benefit from access to the head. |
| 1565 | |
| 1566 // TODO : Get both favicon and touch icon url, and send them to the browser. | |
| 1567 GURL favicon_url(webview()->mainFrame()->favIconURL()); | |
| 1568 if (!favicon_url.is_empty()) { | |
| 1569 std::vector<FaviconURL> urls; | |
| 1570 urls.push_back(FaviconURL(favicon_url, FAVICON)); | |
| 1571 Send(new ViewHostMsg_UpdateFaviconURL(routing_id_, page_id_, urls)); | |
| 1572 } | |
| 1573 | |
| 1574 AddGURLSearchProvider(webview()->mainFrame()->openSearchDescriptionURL(), | |
| 1575 search_provider::AUTODETECTED_PROVIDER); | |
| 1576 | |
| 1577 Send(new ViewHostMsg_DidStopLoading(routing_id_)); | 1462 Send(new ViewHostMsg_DidStopLoading(routing_id_)); |
| 1578 | 1463 |
| 1579 if (load_progress_tracker_ != NULL) | 1464 if (load_progress_tracker_ != NULL) |
| 1580 load_progress_tracker_->DidStopLoading(); | 1465 load_progress_tracker_->DidStopLoading(); |
| 1581 | 1466 |
| 1582 FOR_EACH_OBSERVER(RenderViewObserver, observers_, DidStopLoading()); | 1467 FOR_EACH_OBSERVER(RenderViewObserver, observers_, DidStopLoading()); |
| 1583 } | 1468 } |
| 1584 | 1469 |
| 1585 void RenderView::didChangeLoadProgress(WebFrame* frame, double load_progress) { | 1470 void RenderView::didChangeLoadProgress(WebFrame* frame, double load_progress) { |
| 1586 if (load_progress_tracker_ != NULL) | 1471 if (load_progress_tracker_ != NULL) |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1628 } | 1513 } |
| 1629 #endif // defined(OS_POSIX) | 1514 #endif // defined(OS_POSIX) |
| 1630 } | 1515 } |
| 1631 | 1516 |
| 1632 void RenderView::didExecuteCommand(const WebString& command_name) { | 1517 void RenderView::didExecuteCommand(const WebString& command_name) { |
| 1633 const std::string& name = UTF16ToUTF8(command_name); | 1518 const std::string& name = UTF16ToUTF8(command_name); |
| 1634 if (StartsWithASCII(name, "Move", true) || | 1519 if (StartsWithASCII(name, "Move", true) || |
| 1635 StartsWithASCII(name, "Insert", true) || | 1520 StartsWithASCII(name, "Insert", true) || |
| 1636 StartsWithASCII(name, "Delete", true)) | 1521 StartsWithASCII(name, "Delete", true)) |
| 1637 return; | 1522 return; |
| 1638 UserMetricsRecordAction(name); | 1523 webkit_glue::UserMetricsRecordAction(name); |
| 1639 } | 1524 } |
| 1640 | 1525 |
| 1641 void RenderView::SendPendingAccessibilityNotifications() { | 1526 void RenderView::SendPendingAccessibilityNotifications() { |
| 1642 if (!accessibility_.get()) | 1527 if (!accessibility_.get()) |
| 1643 return; | 1528 return; |
| 1644 | 1529 |
| 1645 if (pending_accessibility_notifications_.empty()) | 1530 if (pending_accessibility_notifications_.empty()) |
| 1646 return; | 1531 return; |
| 1647 | 1532 |
| 1648 // Send all pending accessibility notifications. | 1533 // Send all pending accessibility notifications. |
| (...skipping 381 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2030 exists, | 1915 exists, |
| 2031 route_id, | 1916 route_id, |
| 2032 routing_id_); | 1917 routing_id_); |
| 2033 } | 1918 } |
| 2034 } | 1919 } |
| 2035 | 1920 |
| 2036 WebMediaPlayer* RenderView::createMediaPlayer( | 1921 WebMediaPlayer* RenderView::createMediaPlayer( |
| 2037 WebFrame* frame, WebMediaPlayerClient* client) { | 1922 WebFrame* frame, WebMediaPlayerClient* client) { |
| 2038 // If this is a prerendering page, start the cancel of the prerender. | 1923 // If this is a prerendering page, start the cancel of the prerender. |
| 2039 if (is_prerendering_) { | 1924 if (is_prerendering_) { |
| 2040 Send(new ViewHostMsg_MaybeCancelPrerender(routing_id_, | 1925 Send(new ViewHostMsg_MaybeCancelPrerenderForHTML5Media(routing_id_)); |
| 2041 prerender::PRERENDER_CANCELLATION_REASON_HTML5_MEDIA)); | |
| 2042 } | 1926 } |
| 2043 | 1927 |
| 2044 scoped_ptr<media::MessageLoopFactory> message_loop_factory( | 1928 scoped_ptr<media::MessageLoopFactory> message_loop_factory( |
| 2045 new media::MessageLoopFactoryImpl()); | 1929 new media::MessageLoopFactoryImpl()); |
| 2046 scoped_ptr<media::FilterCollection> collection( | 1930 scoped_ptr<media::FilterCollection> collection( |
| 2047 new media::FilterCollection()); | 1931 new media::FilterCollection()); |
| 2048 | 1932 |
| 2049 // Add in any custom filter factories first. | 1933 // Add in any custom filter factories first. |
| 2050 const CommandLine* cmd_line = CommandLine::ForCurrentProcess(); | 1934 const CommandLine* cmd_line = CommandLine::ForCurrentProcess(); |
| 2051 if (!cmd_line->HasSwitch(switches::kDisableAudio)) { | 1935 if (!cmd_line->HasSwitch(switches::kDisableAudio)) { |
| (...skipping 521 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2573 // When we perform a new navigation, we need to update the last committed | 2457 // When we perform a new navigation, we need to update the last committed |
| 2574 // session history entry with state for the page we are leaving. | 2458 // session history entry with state for the page we are leaving. |
| 2575 UpdateSessionHistory(frame); | 2459 UpdateSessionHistory(frame); |
| 2576 | 2460 |
| 2577 // We bump our Page ID to correspond with the new session history entry. | 2461 // We bump our Page ID to correspond with the new session history entry. |
| 2578 page_id_ = next_page_id_++; | 2462 page_id_ = next_page_id_++; |
| 2579 | 2463 |
| 2580 // Advance our offset in session history, applying the length limit. There | 2464 // Advance our offset in session history, applying the length limit. There |
| 2581 // is now no forward history. | 2465 // is now no forward history. |
| 2582 history_list_offset_++; | 2466 history_list_offset_++; |
| 2583 if (history_list_offset_ >= chrome::kMaxSessionHistoryEntries) | 2467 if (history_list_offset_ >= content::kMaxSessionHistoryEntries) |
| 2584 history_list_offset_ = chrome::kMaxSessionHistoryEntries - 1; | 2468 history_list_offset_ = content::kMaxSessionHistoryEntries - 1; |
| 2585 history_list_length_ = history_list_offset_ + 1; | 2469 history_list_length_ = history_list_offset_ + 1; |
| 2586 } else { | 2470 } else { |
| 2587 // Inspect the navigation_state on this frame to see if the navigation | 2471 // Inspect the navigation_state on this frame to see if the navigation |
| 2588 // corresponds to a session history navigation... Note: |frame| may or | 2472 // corresponds to a session history navigation... Note: |frame| may or |
| 2589 // may not be the toplevel frame, but for the case of capturing session | 2473 // may not be the toplevel frame, but for the case of capturing session |
| 2590 // history, the first committed frame suffices. We keep track of whether | 2474 // history, the first committed frame suffices. We keep track of whether |
| 2591 // we've seen this commit before so that only capture session history once | 2475 // we've seen this commit before so that only capture session history once |
| 2592 // per navigation. | 2476 // per navigation. |
| 2593 // | 2477 // |
| 2594 // Note that we need to check if the page ID changed. In the case of a | 2478 // Note that we need to check if the page ID changed. In the case of a |
| (...skipping 24 matching lines...) Expand all Loading... |
| 2619 | 2503 |
| 2620 // If this committed load was initiated by a client redirect, we're | 2504 // If this committed load was initiated by a client redirect, we're |
| 2621 // at the last stop now, so clear it. | 2505 // at the last stop now, so clear it. |
| 2622 completed_client_redirect_src_ = GURL(); | 2506 completed_client_redirect_src_ = GURL(); |
| 2623 | 2507 |
| 2624 // Check whether we have new encoding name. | 2508 // Check whether we have new encoding name. |
| 2625 UpdateEncoding(frame, frame->view()->pageEncoding().utf8()); | 2509 UpdateEncoding(frame, frame->view()->pageEncoding().utf8()); |
| 2626 } | 2510 } |
| 2627 | 2511 |
| 2628 void RenderView::didClearWindowObject(WebFrame* frame) { | 2512 void RenderView::didClearWindowObject(WebFrame* frame) { |
| 2629 if (BindingsPolicy::is_dom_automation_enabled(enabled_bindings_)) | 2513 FOR_EACH_OBSERVER(RenderViewObserver, observers_, |
| 2630 BindDOMAutomationController(frame); | 2514 DidClearWindowObject(frame)); |
| 2515 |
| 2631 GURL frame_url = frame->url(); | 2516 GURL frame_url = frame->url(); |
| 2632 if (BindingsPolicy::is_web_ui_enabled(enabled_bindings_) && | 2517 if (BindingsPolicy::is_web_ui_enabled(enabled_bindings_) && |
| 2633 (frame_url.SchemeIs(chrome::kChromeUIScheme) || | 2518 (frame_url.SchemeIs(chrome::kChromeUIScheme) || |
| 2634 frame_url.SchemeIs(chrome::kDataScheme))) { | 2519 frame_url.SchemeIs(chrome::kDataScheme))) { |
| 2635 GetWebUIBindings()->set_message_sender(this); | 2520 GetWebUIBindings()->set_message_sender(this); |
| 2636 GetWebUIBindings()->set_routing_id(routing_id_); | 2521 GetWebUIBindings()->set_routing_id(routing_id_); |
| 2637 GetWebUIBindings()->BindToJavascript(frame, "chrome"); | 2522 GetWebUIBindings()->BindToJavascript(frame, "chrome"); |
| 2638 } | 2523 } |
| 2639 if (BindingsPolicy::is_external_host_enabled(enabled_bindings_)) { | |
| 2640 GetExternalHostBindings()->set_message_sender(this); | |
| 2641 GetExternalHostBindings()->set_routing_id(routing_id_); | |
| 2642 GetExternalHostBindings()->BindToJavascript(frame, "externalHost"); | |
| 2643 } | |
| 2644 } | 2524 } |
| 2645 | 2525 |
| 2646 void RenderView::didCreateDocumentElement(WebFrame* frame) { | 2526 void RenderView::didCreateDocumentElement(WebFrame* frame) { |
| 2647 // Notify the browser about non-blank documents loading in the top frame. | 2527 // Notify the browser about non-blank documents loading in the top frame. |
| 2648 GURL url = frame->url(); | 2528 GURL url = frame->url(); |
| 2649 if (url.is_valid() && url.spec() != chrome::kAboutBlankURL) { | 2529 if (url.is_valid() && url.spec() != chrome::kAboutBlankURL) { |
| 2650 if (frame == webview()->mainFrame()) | 2530 if (frame == webview()->mainFrame()) |
| 2651 Send(new ViewHostMsg_DocumentAvailableInMainFrame(routing_id_)); | 2531 Send(new ViewHostMsg_DocumentAvailableInMainFrame(routing_id_)); |
| 2652 } | 2532 } |
| 2653 | 2533 |
| 2654 FOR_EACH_OBSERVER(RenderViewObserver, observers_, | 2534 FOR_EACH_OBSERVER(RenderViewObserver, observers_, |
| 2655 DidCreateDocumentElement(frame)); | 2535 DidCreateDocumentElement(frame)); |
| 2656 } | 2536 } |
| 2657 | 2537 |
| 2658 void RenderView::didReceiveTitle(WebFrame* frame, const WebString& title) { | 2538 void RenderView::didReceiveTitle(WebFrame* frame, const WebString& title) { |
| 2659 UpdateTitle(frame, title); | 2539 UpdateTitle(frame, title); |
| 2660 | 2540 |
| 2661 // Also check whether we have new encoding name. | 2541 // Also check whether we have new encoding name. |
| 2662 UpdateEncoding(frame, frame->view()->pageEncoding().utf8()); | 2542 UpdateEncoding(frame, frame->view()->pageEncoding().utf8()); |
| 2663 } | 2543 } |
| 2664 | 2544 |
| 2665 void RenderView::didChangeIcons(WebFrame* frame) { | 2545 void RenderView::didChangeIcons(WebFrame* frame) { |
| 2666 if (!frame->parent()) { | 2546 FOR_EACH_OBSERVER(RenderViewObserver, observers_, DidChangeIcons(frame)); |
| 2667 std::vector<FaviconURL> urls; | |
| 2668 urls.push_back(FaviconURL(frame->favIconURL(), FAVICON)); | |
| 2669 Send(new ViewHostMsg_UpdateFaviconURL(routing_id_, page_id_, urls)); | |
| 2670 } | |
| 2671 } | 2547 } |
| 2672 | 2548 |
| 2673 void RenderView::didFinishDocumentLoad(WebFrame* frame) { | 2549 void RenderView::didFinishDocumentLoad(WebFrame* frame) { |
| 2674 WebDataSource* ds = frame->dataSource(); | 2550 WebDataSource* ds = frame->dataSource(); |
| 2675 NavigationState* navigation_state = NavigationState::FromDataSource(ds); | 2551 NavigationState* navigation_state = NavigationState::FromDataSource(ds); |
| 2676 DCHECK(navigation_state); | 2552 DCHECK(navigation_state); |
| 2677 navigation_state->set_finish_document_load_time(Time::Now()); | 2553 navigation_state->set_finish_document_load_time(Time::Now()); |
| 2678 | 2554 |
| 2679 Send(new ViewHostMsg_DocumentLoadedInFrame(routing_id_, frame->identifier())); | 2555 Send(new ViewHostMsg_DocumentLoadedInFrame(routing_id_, frame->identifier())); |
| 2680 | 2556 |
| (...skipping 153 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2834 original_error.unreachableURL = frame_url; | 2710 original_error.unreachableURL = frame_url; |
| 2835 | 2711 |
| 2836 navigation_state->set_alt_error_page_fetcher( | 2712 navigation_state->set_alt_error_page_fetcher( |
| 2837 new AltErrorPageResourceFetcher( | 2713 new AltErrorPageResourceFetcher( |
| 2838 error_page_url, frame, original_error, | 2714 error_page_url, frame, original_error, |
| 2839 NewCallback(this, &RenderView::AltErrorPageFinished))); | 2715 NewCallback(this, &RenderView::AltErrorPageFinished))); |
| 2840 return; | 2716 return; |
| 2841 } | 2717 } |
| 2842 } | 2718 } |
| 2843 | 2719 |
| 2844 // Use an internal error page, if we have one for the status code. | 2720 content::GetContentClient()->renderer()->ShowErrorPage( |
| 2845 if (LocalizedError::HasStrings(LocalizedError::kHttpErrorDomain, | 2721 this, frame, http_status_code); |
| 2846 http_status_code)) { | |
| 2847 WebURLError error; | |
| 2848 error.unreachableURL = frame->url(); | |
| 2849 error.domain = WebString::fromUTF8(LocalizedError::kHttpErrorDomain); | |
| 2850 error.reason = http_status_code; | |
| 2851 | |
| 2852 LoadNavigationErrorPage(frame, frame->dataSource()->request(), error, | |
| 2853 std::string(), true); | |
| 2854 } | |
| 2855 } | 2722 } |
| 2856 | 2723 |
| 2857 void RenderView::didFailResourceLoad( | 2724 void RenderView::didFailResourceLoad( |
| 2858 WebFrame* frame, unsigned identifier, const WebURLError& error) { | 2725 WebFrame* frame, unsigned identifier, const WebURLError& error) { |
| 2859 // Ignore | 2726 // Ignore |
| 2860 } | 2727 } |
| 2861 | 2728 |
| 2862 void RenderView::didLoadResourceFromMemoryCache( | 2729 void RenderView::didLoadResourceFromMemoryCache( |
| 2863 WebFrame* frame, const WebURLRequest& request, | 2730 WebFrame* frame, const WebURLRequest& request, |
| 2864 const WebURLResponse& response) { | 2731 const WebURLResponse& response) { |
| (...skipping 284 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3149 return; | 3016 return; |
| 3150 | 3017 |
| 3151 const WebHistoryItem& item = webview()->mainFrame()->currentHistoryItem(); | 3018 const WebHistoryItem& item = webview()->mainFrame()->currentHistoryItem(); |
| 3152 if (item.isNull()) | 3019 if (item.isNull()) |
| 3153 return; | 3020 return; |
| 3154 | 3021 |
| 3155 Send(new ViewHostMsg_UpdateState( | 3022 Send(new ViewHostMsg_UpdateState( |
| 3156 routing_id_, page_id_, webkit_glue::HistoryItemToString(item))); | 3023 routing_id_, page_id_, webkit_glue::HistoryItemToString(item))); |
| 3157 } | 3024 } |
| 3158 | 3025 |
| 3159 bool RenderView::DownloadFavicon(int id, const GURL& image_url, | |
| 3160 int image_size) { | |
| 3161 // Make sure webview was not shut down. | |
| 3162 if (!webview()) | |
| 3163 return false; | |
| 3164 // Create an image resource fetcher and assign it with a call back object. | |
| 3165 image_fetchers_.push_back(linked_ptr<ImageResourceFetcher>( | |
| 3166 new ImageResourceFetcher( | |
| 3167 image_url, webview()->mainFrame(), id, image_size, | |
| 3168 WebURLRequest::TargetIsFavicon, | |
| 3169 NewCallback(this, &RenderView::DidDownloadFavicon)))); | |
| 3170 return true; | |
| 3171 } | |
| 3172 | |
| 3173 void RenderView::DidDownloadFavicon(ImageResourceFetcher* fetcher, | |
| 3174 const SkBitmap& image) { | |
| 3175 // Notify requester of image download status. | |
| 3176 Send(new ViewHostMsg_DidDownloadFavicon(routing_id_, | |
| 3177 fetcher->id(), | |
| 3178 fetcher->image_url(), | |
| 3179 image.isNull(), | |
| 3180 image)); | |
| 3181 | |
| 3182 // Remove the image fetcher from our pending list. We're in the callback from | |
| 3183 // ImageResourceFetcher, best to delay deletion. | |
| 3184 for (ImageResourceFetcherList::iterator iter = image_fetchers_.begin(); | |
| 3185 iter != image_fetchers_.end(); ++iter) { | |
| 3186 if (iter->get() == fetcher) { | |
| 3187 iter->release(); | |
| 3188 image_fetchers_.erase(iter); | |
| 3189 break; | |
| 3190 } | |
| 3191 } | |
| 3192 MessageLoop::current()->DeleteSoon(FROM_HERE, fetcher); | |
| 3193 } | |
| 3194 | |
| 3195 void RenderView::OnDownloadFavicon(int id, | |
| 3196 const GURL& image_url, | |
| 3197 int image_size) { | |
| 3198 bool data_image_failed = false; | |
| 3199 if (image_url.SchemeIs("data")) { | |
| 3200 SkBitmap data_image = ImageFromDataUrl(image_url); | |
| 3201 data_image_failed = data_image.empty(); | |
| 3202 if (!data_image_failed) { | |
| 3203 Send(new ViewHostMsg_DidDownloadFavicon(routing_id_, id, image_url, false, | |
| 3204 data_image)); | |
| 3205 } | |
| 3206 } | |
| 3207 | |
| 3208 if (data_image_failed || | |
| 3209 !DownloadFavicon(id, image_url, image_size)) { | |
| 3210 Send(new ViewHostMsg_DidDownloadFavicon(routing_id_, id, image_url, true, | |
| 3211 SkBitmap())); | |
| 3212 } | |
| 3213 } | |
| 3214 | |
| 3215 SkBitmap RenderView::ImageFromDataUrl(const GURL& url) const { | |
| 3216 std::string mime_type, char_set, data; | |
| 3217 if (net::DataURL::Parse(url, &mime_type, &char_set, &data) && !data.empty()) { | |
| 3218 // Decode the favicon using WebKit's image decoder. | |
| 3219 webkit_glue::ImageDecoder decoder(gfx::Size(kFaviconSize, kFaviconSize)); | |
| 3220 const unsigned char* src_data = | |
| 3221 reinterpret_cast<const unsigned char*>(&data[0]); | |
| 3222 | |
| 3223 return decoder.Decode(src_data, data.size()); | |
| 3224 } | |
| 3225 return SkBitmap(); | |
| 3226 } | |
| 3227 | |
| 3228 GURL RenderView::GetAlternateErrorPageURL(const GURL& failed_url, | 3026 GURL RenderView::GetAlternateErrorPageURL(const GURL& failed_url, |
| 3229 ErrorPageType error_type) { | 3027 ErrorPageType error_type) { |
| 3230 if (failed_url.SchemeIsSecure()) { | 3028 if (failed_url.SchemeIsSecure()) { |
| 3231 // If the URL that failed was secure, then the embedding web page was not | 3029 // If the URL that failed was secure, then the embedding web page was not |
| 3232 // expecting a network attacker to be able to manipulate its contents. As | 3030 // expecting a network attacker to be able to manipulate its contents. As |
| 3233 // we fetch alternate error pages over HTTP, we would be allowing a network | 3031 // we fetch alternate error pages over HTTP, we would be allowing a network |
| 3234 // attacker to manipulate the contents of the response if we tried to use | 3032 // attacker to manipulate the contents of the response if we tried to use |
| 3235 // the link doctor here. | 3033 // the link doctor here. |
| 3236 return GURL(); | 3034 return GURL(); |
| 3237 } | 3035 } |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3282 return url; | 3080 return url; |
| 3283 } | 3081 } |
| 3284 | 3082 |
| 3285 WebUIBindings* RenderView::GetWebUIBindings() { | 3083 WebUIBindings* RenderView::GetWebUIBindings() { |
| 3286 if (!web_ui_bindings_.get()) { | 3084 if (!web_ui_bindings_.get()) { |
| 3287 web_ui_bindings_.reset(new WebUIBindings()); | 3085 web_ui_bindings_.reset(new WebUIBindings()); |
| 3288 } | 3086 } |
| 3289 return web_ui_bindings_.get(); | 3087 return web_ui_bindings_.get(); |
| 3290 } | 3088 } |
| 3291 | 3089 |
| 3292 ExternalHostBindings* RenderView::GetExternalHostBindings() { | |
| 3293 if (!external_host_bindings_.get()) { | |
| 3294 external_host_bindings_.reset(new ExternalHostBindings()); | |
| 3295 } | |
| 3296 return external_host_bindings_.get(); | |
| 3297 } | |
| 3298 | |
| 3299 WebKit::WebPlugin* RenderView::GetWebPluginFromPluginDocument() { | 3090 WebKit::WebPlugin* RenderView::GetWebPluginFromPluginDocument() { |
| 3300 return webview()->mainFrame()->document().to<WebPluginDocument>().plugin(); | 3091 return webview()->mainFrame()->document().to<WebPluginDocument>().plugin(); |
| 3301 } | 3092 } |
| 3302 | 3093 |
| 3303 void RenderView::OnFind(int request_id, const string16& search_text, | 3094 void RenderView::OnFind(int request_id, const string16& search_text, |
| 3304 const WebFindOptions& options) { | 3095 const WebFindOptions& options) { |
| 3305 WebFrame* main_frame = webview()->mainFrame(); | 3096 WebFrame* main_frame = webview()->mainFrame(); |
| 3306 | 3097 |
| 3307 if (main_frame->document().isPluginDocument()) { | 3098 if (main_frame->document().isPluginDocument()) { |
| 3308 if (options.findNext) { | 3099 if (options.findNext) { |
| (...skipping 498 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3807 file_chooser_completions_.front()->completion->didChooseFile(ws_file_names); | 3598 file_chooser_completions_.front()->completion->didChooseFile(ws_file_names); |
| 3808 file_chooser_completions_.pop_front(); | 3599 file_chooser_completions_.pop_front(); |
| 3809 | 3600 |
| 3810 // If there are more pending file chooser requests, schedule one now. | 3601 // If there are more pending file chooser requests, schedule one now. |
| 3811 if (!file_chooser_completions_.empty()) { | 3602 if (!file_chooser_completions_.empty()) { |
| 3812 Send(new ViewHostMsg_RunFileChooser(routing_id_, | 3603 Send(new ViewHostMsg_RunFileChooser(routing_id_, |
| 3813 file_chooser_completions_.front()->params)); | 3604 file_chooser_completions_.front()->params)); |
| 3814 } | 3605 } |
| 3815 } | 3606 } |
| 3816 | 3607 |
| 3817 void RenderView::OnEnableViewSourceMode() { | |
| 3818 if (!webview()) | |
| 3819 return; | |
| 3820 WebFrame* main_frame = webview()->mainFrame(); | |
| 3821 if (!main_frame) | |
| 3822 return; | |
| 3823 | |
| 3824 main_frame->enableViewSourceMode(true); | |
| 3825 } | |
| 3826 | |
| 3827 void RenderView::OnEnablePreferredSizeChangedMode(int flags) { | 3608 void RenderView::OnEnablePreferredSizeChangedMode(int flags) { |
| 3828 DCHECK(flags != kPreferredSizeNothing); | 3609 DCHECK(flags != kPreferredSizeNothing); |
| 3829 if (send_preferred_size_changes_) | 3610 if (send_preferred_size_changes_) |
| 3830 return; | 3611 return; |
| 3831 send_preferred_size_changes_ = true; | 3612 send_preferred_size_changes_ = true; |
| 3832 | 3613 |
| 3833 // WebKit doesn't send a notification of the effective height of the page | 3614 // WebKit doesn't send a notification of the effective height of the page |
| 3834 // changes, so poll for it. | 3615 // changes, so poll for it. |
| 3835 // TODO: Add a notification for this to WebKit, remove polling. After that's | 3616 // TODO: Add a notification for this to WebKit, remove polling. After that's |
| 3836 // done, rename kPreferredSizeHeightThisIsSlow to kPreferredSizeHeight. | 3617 // done, rename kPreferredSizeHeightThisIsSlow to kPreferredSizeHeight. |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3872 } | 3653 } |
| 3873 #endif | 3654 #endif |
| 3874 } | 3655 } |
| 3875 | 3656 |
| 3876 void RenderView::OnMediaPlayerActionAt(const gfx::Point& location, | 3657 void RenderView::OnMediaPlayerActionAt(const gfx::Point& location, |
| 3877 const WebMediaPlayerAction& action) { | 3658 const WebMediaPlayerAction& action) { |
| 3878 if (webview()) | 3659 if (webview()) |
| 3879 webview()->performMediaPlayerAction(action, location); | 3660 webview()->performMediaPlayerAction(action, location); |
| 3880 } | 3661 } |
| 3881 | 3662 |
| 3882 void RenderView::OnNotifyRendererViewType(ViewType::Type type) { | |
| 3883 view_type_ = type; | |
| 3884 } | |
| 3885 | |
| 3886 void RenderView::OnUpdateBrowserWindowId(int window_id) { | |
| 3887 browser_window_id_ = window_id; | |
| 3888 } | |
| 3889 | |
| 3890 void RenderView::OnEnableAccessibility() { | 3663 void RenderView::OnEnableAccessibility() { |
| 3891 if (WebAccessibilityCache::accessibilityEnabled()) | 3664 if (WebAccessibilityCache::accessibilityEnabled()) |
| 3892 return; | 3665 return; |
| 3893 | 3666 |
| 3894 WebAccessibilityCache::enableAccessibility(); | 3667 WebAccessibilityCache::enableAccessibility(); |
| 3895 | 3668 |
| 3896 if (webview()) { | 3669 if (webview()) { |
| 3897 // It's possible that the webview has already loaded a webpage without | 3670 // It's possible that the webview has already loaded a webpage without |
| 3898 // accessibility being enabled. Initialize the browser's cached | 3671 // accessibility being enabled. Initialize the browser's cached |
| 3899 // accessibility tree by sending it a 'load complete' notification. | 3672 // accessibility tree by sending it a 'load complete' notification. |
| (...skipping 30 matching lines...) Expand all Loading... |
| 3930 | 3703 |
| 3931 obj.performDefaultAction(); | 3704 obj.performDefaultAction(); |
| 3932 } | 3705 } |
| 3933 | 3706 |
| 3934 void RenderView::OnAccessibilityNotificationsAck() { | 3707 void RenderView::OnAccessibilityNotificationsAck() { |
| 3935 DCHECK(accessibility_ack_pending_); | 3708 DCHECK(accessibility_ack_pending_); |
| 3936 accessibility_ack_pending_ = false; | 3709 accessibility_ack_pending_ = false; |
| 3937 SendPendingAccessibilityNotifications(); | 3710 SendPendingAccessibilityNotifications(); |
| 3938 } | 3711 } |
| 3939 | 3712 |
| 3940 void RenderView::OnGetAllSavableResourceLinksForCurrentPage( | |
| 3941 const GURL& page_url) { | |
| 3942 // Prepare list to storage all savable resource links. | |
| 3943 std::vector<GURL> resources_list; | |
| 3944 std::vector<GURL> referrers_list; | |
| 3945 std::vector<GURL> frames_list; | |
| 3946 webkit_glue::SavableResourcesResult result(&resources_list, | |
| 3947 &referrers_list, | |
| 3948 &frames_list); | |
| 3949 | |
| 3950 if (!webkit_glue::GetAllSavableResourceLinksForCurrentPage( | |
| 3951 webview(), | |
| 3952 page_url, | |
| 3953 &result, | |
| 3954 chrome::kSavableSchemes)) { | |
| 3955 // If something is wrong when collecting all savable resource links, | |
| 3956 // send empty list to embedder(browser) to tell it failed. | |
| 3957 referrers_list.clear(); | |
| 3958 resources_list.clear(); | |
| 3959 frames_list.clear(); | |
| 3960 } | |
| 3961 | |
| 3962 // Send result of all savable resource links to embedder. | |
| 3963 Send(new ViewHostMsg_SendCurrentPageAllSavableResourceLinks(routing_id_, | |
| 3964 resources_list, | |
| 3965 referrers_list, | |
| 3966 frames_list)); | |
| 3967 } | |
| 3968 | |
| 3969 void RenderView::OnGetSerializedHtmlDataForCurrentPageWithLocalLinks( | |
| 3970 const std::vector<GURL>& links, | |
| 3971 const std::vector<FilePath>& local_paths, | |
| 3972 const FilePath& local_directory_name) { | |
| 3973 | |
| 3974 // Convert std::vector of GURLs to WebVector<WebURL> | |
| 3975 WebVector<WebURL> weburl_links(links); | |
| 3976 | |
| 3977 // Convert std::vector of std::strings to WebVector<WebString> | |
| 3978 WebVector<WebString> webstring_paths(local_paths.size()); | |
| 3979 for (size_t i = 0; i < local_paths.size(); i++) | |
| 3980 webstring_paths[i] = webkit_glue::FilePathToWebString(local_paths[i]); | |
| 3981 | |
| 3982 WebPageSerializer::serialize(webview()->mainFrame(), | |
| 3983 true, this, weburl_links, webstring_paths, | |
| 3984 webkit_glue::FilePathToWebString( | |
| 3985 local_directory_name)); | |
| 3986 } | |
| 3987 | |
| 3988 void RenderView::didSerializeDataForFrame(const WebURL& frame_url, | |
| 3989 const WebCString& data, | |
| 3990 WebPageSerializerClient::PageSerializationStatus status) { | |
| 3991 Send(new ViewHostMsg_SendSerializedHtmlData( | |
| 3992 routing_id_, | |
| 3993 frame_url, | |
| 3994 data.data(), | |
| 3995 static_cast<int32>(status))); | |
| 3996 } | |
| 3997 | |
| 3998 void RenderView::OnShouldClose() { | 3713 void RenderView::OnShouldClose() { |
| 3999 bool should_close = webview()->dispatchBeforeUnloadEvent(); | 3714 bool should_close = webview()->dispatchBeforeUnloadEvent(); |
| 4000 Send(new ViewHostMsg_ShouldClose_ACK(routing_id_, should_close)); | 3715 Send(new ViewHostMsg_ShouldClose_ACK(routing_id_, should_close)); |
| 4001 } | 3716 } |
| 4002 | 3717 |
| 4003 void RenderView::OnClosePage(const ViewMsg_ClosePage_Params& params) { | 3718 void RenderView::OnClosePage(const ViewMsg_ClosePage_Params& params) { |
| 4004 // TODO(creis): We'd rather use webview()->Close() here, but that currently | 3719 // TODO(creis): We'd rather use webview()->Close() here, but that currently |
| 4005 // sets the WebView's delegate_ to NULL, preventing any JavaScript dialogs | 3720 // sets the WebView's delegate_ to NULL, preventing any JavaScript dialogs |
| 4006 // in the onunload handler from appearing. For now, we're bypassing that and | 3721 // in the onunload handler from appearing. For now, we're bypassing that and |
| 4007 // calling the FrameLoader's CloseURL method directly. This should be | 3722 // calling the FrameLoader's CloseURL method directly. This should be |
| (...skipping 10 matching lines...) Expand all Loading... |
| 4018 #if defined(OS_WIN) | 3733 #if defined(OS_WIN) |
| 4019 gfx::NativeThemeWin::instance()->CloseHandles(); | 3734 gfx::NativeThemeWin::instance()->CloseHandles(); |
| 4020 if (webview()) | 3735 if (webview()) |
| 4021 webview()->themeChanged(); | 3736 webview()->themeChanged(); |
| 4022 #else // defined(OS_WIN) | 3737 #else // defined(OS_WIN) |
| 4023 // TODO(port): we don't support theming on non-Windows platforms yet | 3738 // TODO(port): we don't support theming on non-Windows platforms yet |
| 4024 NOTIMPLEMENTED(); | 3739 NOTIMPLEMENTED(); |
| 4025 #endif | 3740 #endif |
| 4026 } | 3741 } |
| 4027 | 3742 |
| 4028 void RenderView::OnHandleMessageFromExternalHost(const std::string& message, | |
| 4029 const std::string& origin, | |
| 4030 const std::string& target) { | |
| 4031 if (message.empty()) | |
| 4032 return; | |
| 4033 GetExternalHostBindings()->ForwardMessageFromExternalHost(message, origin, | |
| 4034 target); | |
| 4035 } | |
| 4036 | |
| 4037 void RenderView::OnDisassociateFromPopupCount() { | 3743 void RenderView::OnDisassociateFromPopupCount() { |
| 4038 if (decrement_shared_popup_at_destruction_) | 3744 if (decrement_shared_popup_at_destruction_) |
| 4039 shared_popup_counter_->data--; | 3745 shared_popup_counter_->data--; |
| 4040 shared_popup_counter_ = new SharedRenderViewCounter(0); | 3746 shared_popup_counter_ = new SharedRenderViewCounter(0); |
| 4041 decrement_shared_popup_at_destruction_ = false; | 3747 decrement_shared_popup_at_destruction_ = false; |
| 4042 } | 3748 } |
| 4043 | 3749 |
| 4044 bool RenderView::MaybeLoadAlternateErrorPage(WebFrame* frame, | 3750 bool RenderView::MaybeLoadAlternateErrorPage(WebFrame* frame, |
| 4045 const WebURLError& error, | 3751 const WebURLError& error, |
| 4046 bool replace) { | 3752 bool replace) { |
| (...skipping 552 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4599 const PP_Flash_NetAddress& local_addr, | 4305 const PP_Flash_NetAddress& local_addr, |
| 4600 const PP_Flash_NetAddress& remote_addr) { | 4306 const PP_Flash_NetAddress& remote_addr) { |
| 4601 pepper_delegate_.OnConnectTcpACK( | 4307 pepper_delegate_.OnConnectTcpACK( |
| 4602 request_id, | 4308 request_id, |
| 4603 IPC::PlatformFileForTransitToPlatformFile(socket_for_transit), | 4309 IPC::PlatformFileForTransitToPlatformFile(socket_for_transit), |
| 4604 local_addr, | 4310 local_addr, |
| 4605 remote_addr); | 4311 remote_addr); |
| 4606 } | 4312 } |
| 4607 #endif | 4313 #endif |
| 4608 | 4314 |
| 4609 void RenderView::OnJavaScriptStressTestControl(int cmd, int param) { | |
| 4610 if (cmd == kJavaScriptStressTestSetStressRunType) { | |
| 4611 v8::Testing::SetStressRunType(static_cast<v8::Testing::StressType>(param)); | |
| 4612 } else if (cmd == kJavaScriptStressTestPrepareStressRun) { | |
| 4613 v8::Testing::PrepareStressRun(param); | |
| 4614 } | |
| 4615 } | |
| 4616 | |
| 4617 void RenderView::OnContextMenuClosed( | 4315 void RenderView::OnContextMenuClosed( |
| 4618 const webkit_glue::CustomContextMenuContext& custom_context) { | 4316 const webkit_glue::CustomContextMenuContext& custom_context) { |
| 4619 if (custom_context.is_pepper_menu) | 4317 if (custom_context.is_pepper_menu) |
| 4620 pepper_delegate_.OnContextMenuClosed(custom_context); | 4318 pepper_delegate_.OnContextMenuClosed(custom_context); |
| 4621 else | 4319 else |
| 4622 context_menu_node_.reset(); | 4320 context_menu_node_.reset(); |
| 4623 } | 4321 } |
| 4624 | 4322 |
| 4625 void RenderView::OnNetworkStateChanged(bool online) { | 4323 void RenderView::OnNetworkStateChanged(bool online) { |
| 4626 WebNetworkStateNotifier::setOnLine(online); | 4324 WebNetworkStateNotifier::setOnLine(online); |
| 4627 } | 4325 } |
| OLD | NEW |