| 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 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 50 #include "content/public/common/bindings_policy.h" | 50 #include "content/public/common/bindings_policy.h" |
| 51 #include "content/public/common/content_client.h" | 51 #include "content/public/common/content_client.h" |
| 52 #include "content/public/common/content_constants.h" | 52 #include "content/public/common/content_constants.h" |
| 53 #include "content/public/common/content_switches.h" | 53 #include "content/public/common/content_switches.h" |
| 54 #include "content/public/common/context_menu_params.h" | 54 #include "content/public/common/context_menu_params.h" |
| 55 #include "content/public/common/file_chooser_params.h" | 55 #include "content/public/common/file_chooser_params.h" |
| 56 #include "content/public/common/url_constants.h" | 56 #include "content/public/common/url_constants.h" |
| 57 #include "content/public/renderer/content_renderer_client.h" | 57 #include "content/public/renderer/content_renderer_client.h" |
| 58 #include "content/public/renderer/document_state.h" | 58 #include "content/public/renderer/document_state.h" |
| 59 #include "content/public/renderer/navigation_state.h" | 59 #include "content/public/renderer/navigation_state.h" |
| 60 #include "content/public/renderer/password_form_conversion_utils.h" |
| 60 #include "content/public/renderer/render_view_observer.h" | 61 #include "content/public/renderer/render_view_observer.h" |
| 61 #include "content/public/renderer/render_view_visitor.h" | 62 #include "content/public/renderer/render_view_visitor.h" |
| 62 #include "content/renderer/browser_plugin/browser_plugin.h" | 63 #include "content/renderer/browser_plugin/browser_plugin.h" |
| 63 #include "content/renderer/browser_plugin/browser_plugin_manager.h" | 64 #include "content/renderer/browser_plugin/browser_plugin_manager.h" |
| 64 #include "content/renderer/browser_plugin/old/old_browser_plugin.h" | 65 #include "content/renderer/browser_plugin/old/old_browser_plugin.h" |
| 65 #include "content/renderer/browser_plugin/old/browser_plugin_channel_manager.h" | 66 #include "content/renderer/browser_plugin/old/browser_plugin_channel_manager.h" |
| 66 #include "content/renderer/browser_plugin/old/browser_plugin_constants.h" | 67 #include "content/renderer/browser_plugin/old/browser_plugin_constants.h" |
| 67 #include "content/renderer/browser_plugin/old/guest_to_embedder_channel.h" | 68 #include "content/renderer/browser_plugin/old/guest_to_embedder_channel.h" |
| 68 #include "content/renderer/device_orientation_dispatcher.h" | 69 #include "content/renderer/device_orientation_dispatcher.h" |
| 69 #include "content/renderer/devtools_agent.h" | 70 #include "content/renderer/devtools_agent.h" |
| (...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 174 #include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebURLRespon
se.h" | 175 #include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebURLRespon
se.h" |
| 175 #include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebVector.h" | 176 #include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebVector.h" |
| 176 #include "third_party/skia/include/core/SkBitmap.h" | 177 #include "third_party/skia/include/core/SkBitmap.h" |
| 177 #include "ui/base/dialogs/selected_file_info.h" | 178 #include "ui/base/dialogs/selected_file_info.h" |
| 178 #include "ui/gfx/native_widget_types.h" | 179 #include "ui/gfx/native_widget_types.h" |
| 179 #include "ui/gfx/point.h" | 180 #include "ui/gfx/point.h" |
| 180 #include "ui/gfx/rect.h" | 181 #include "ui/gfx/rect.h" |
| 181 #include "v8/include/v8.h" | 182 #include "v8/include/v8.h" |
| 182 #include "webkit/appcache/web_application_cache_host_impl.h" | 183 #include "webkit/appcache/web_application_cache_host_impl.h" |
| 183 #include "webkit/dom_storage/dom_storage_types.h" | 184 #include "webkit/dom_storage/dom_storage_types.h" |
| 184 #include "webkit/forms/form_data.h" | |
| 185 #include "webkit/forms/form_field.h" | |
| 186 #include "webkit/forms/password_form_dom_manager.h" | |
| 187 #include "webkit/glue/alt_error_page_resource_fetcher.h" | 185 #include "webkit/glue/alt_error_page_resource_fetcher.h" |
| 188 #include "webkit/glue/dom_operations.h" | 186 #include "webkit/glue/dom_operations.h" |
| 189 #include "webkit/glue/glue_serialize.h" | 187 #include "webkit/glue/glue_serialize.h" |
| 190 #include "webkit/glue/web_intent_service_data.h" | 188 #include "webkit/glue/web_intent_service_data.h" |
| 191 #include "webkit/glue/webdropdata.h" | 189 #include "webkit/glue/webdropdata.h" |
| 192 #include "webkit/glue/webkit_constants.h" | 190 #include "webkit/glue/webkit_constants.h" |
| 193 #include "webkit/glue/webkit_glue.h" | 191 #include "webkit/glue/webkit_glue.h" |
| 194 #include "webkit/glue/weburlresponse_extradata_impl.h" | 192 #include "webkit/glue/weburlresponse_extradata_impl.h" |
| 195 #include "webkit/gpu/webgraphicscontext3d_in_process_impl.h" | 193 #include "webkit/gpu/webgraphicscontext3d_in_process_impl.h" |
| 196 #include "webkit/media/webmediaplayer_impl.h" | 194 #include "webkit/media/webmediaplayer_impl.h" |
| (...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 314 using WebKit::WebURLResponse; | 312 using WebKit::WebURLResponse; |
| 315 using WebKit::WebVector; | 313 using WebKit::WebVector; |
| 316 using WebKit::WebView; | 314 using WebKit::WebView; |
| 317 using WebKit::WebWidget; | 315 using WebKit::WebWidget; |
| 318 using WebKit::WebWindowFeatures; | 316 using WebKit::WebWindowFeatures; |
| 319 using appcache::WebApplicationCacheHostImpl; | 317 using appcache::WebApplicationCacheHostImpl; |
| 320 using base::Time; | 318 using base::Time; |
| 321 using base::TimeDelta; | 319 using base::TimeDelta; |
| 322 using content::DocumentState; | 320 using content::DocumentState; |
| 323 using content::NavigationState; | 321 using content::NavigationState; |
| 322 using content::PasswordForm; |
| 324 using content::Referrer; | 323 using content::Referrer; |
| 325 using content::RenderThread; | 324 using content::RenderThread; |
| 326 using content::RenderViewObserver; | 325 using content::RenderViewObserver; |
| 327 using content::RenderViewVisitor; | 326 using content::RenderViewVisitor; |
| 328 using content::RendererAccessibilityComplete; | 327 using content::RendererAccessibilityComplete; |
| 329 using content::RendererAccessibilityFocusOnly; | 328 using content::RendererAccessibilityFocusOnly; |
| 330 using content::V8ValueConverter; | 329 using content::V8ValueConverter; |
| 331 using webkit::forms::FormField; | |
| 332 using webkit::forms::PasswordForm; | |
| 333 using webkit::forms::PasswordFormDomManager; | |
| 334 using webkit_glue::AltErrorPageResourceFetcher; | 330 using webkit_glue::AltErrorPageResourceFetcher; |
| 335 using webkit_glue::ResourceFetcher; | 331 using webkit_glue::ResourceFetcher; |
| 336 using webkit_glue::WebPreferences; | 332 using webkit_glue::WebPreferences; |
| 337 using webkit_glue::WebURLResponseExtraDataImpl; | 333 using webkit_glue::WebURLResponseExtraDataImpl; |
| 338 | 334 |
| 339 #if defined(OS_ANDROID) | 335 #if defined(OS_ANDROID) |
| 340 using content::AddressDetector; | 336 using content::AddressDetector; |
| 341 using content::ContentDetector; | 337 using content::ContentDetector; |
| 342 using content::EmailDetector; | 338 using content::EmailDetector; |
| 343 using content::PhoneNumberDetector; | 339 using content::PhoneNumberDetector; |
| (...skipping 2586 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2930 } | 2926 } |
| 2931 | 2927 |
| 2932 void RenderViewImpl::willSendSubmitEvent(WebKit::WebFrame* frame, | 2928 void RenderViewImpl::willSendSubmitEvent(WebKit::WebFrame* frame, |
| 2933 const WebKit::WebFormElement& form) { | 2929 const WebKit::WebFormElement& form) { |
| 2934 // Some login forms have onSubmit handlers that put a hash of the password | 2930 // Some login forms have onSubmit handlers that put a hash of the password |
| 2935 // into a hidden field and then clear the password. (Issue 28910.) | 2931 // into a hidden field and then clear the password. (Issue 28910.) |
| 2936 // This method gets called before any of those handlers run, so save away | 2932 // This method gets called before any of those handlers run, so save away |
| 2937 // a copy of the password in case it gets lost. | 2933 // a copy of the password in case it gets lost. |
| 2938 DocumentState* document_state = | 2934 DocumentState* document_state = |
| 2939 DocumentState::FromDataSource(frame->dataSource()); | 2935 DocumentState::FromDataSource(frame->dataSource()); |
| 2940 document_state->set_password_form_data( | 2936 document_state->set_password_form_data(content::CreatePasswordForm(form)); |
| 2941 PasswordFormDomManager::CreatePasswordForm(form)); | |
| 2942 } | 2937 } |
| 2943 | 2938 |
| 2944 void RenderViewImpl::willSubmitForm(WebFrame* frame, | 2939 void RenderViewImpl::willSubmitForm(WebFrame* frame, |
| 2945 const WebFormElement& form) { | 2940 const WebFormElement& form) { |
| 2946 DocumentState* document_state = | 2941 DocumentState* document_state = |
| 2947 DocumentState::FromDataSource(frame->provisionalDataSource()); | 2942 DocumentState::FromDataSource(frame->provisionalDataSource()); |
| 2948 NavigationState* navigation_state = document_state->navigation_state(); | 2943 NavigationState* navigation_state = document_state->navigation_state(); |
| 2949 | 2944 |
| 2950 if (navigation_state->transition_type() == content::PAGE_TRANSITION_LINK) | 2945 if (navigation_state->transition_type() == content::PAGE_TRANSITION_LINK) |
| 2951 navigation_state->set_transition_type(content::PAGE_TRANSITION_FORM_SUBMIT); | 2946 navigation_state->set_transition_type(content::PAGE_TRANSITION_FORM_SUBMIT); |
| 2952 | 2947 |
| 2953 // Save these to be processed when the ensuing navigation is committed. | 2948 // Save these to be processed when the ensuing navigation is committed. |
| 2954 WebSearchableFormData web_searchable_form_data(form); | 2949 WebSearchableFormData web_searchable_form_data(form); |
| 2955 document_state->set_searchable_form_url(web_searchable_form_data.url()); | 2950 document_state->set_searchable_form_url(web_searchable_form_data.url()); |
| 2956 document_state->set_searchable_form_encoding( | 2951 document_state->set_searchable_form_encoding( |
| 2957 web_searchable_form_data.encoding().utf8()); | 2952 web_searchable_form_data.encoding().utf8()); |
| 2958 scoped_ptr<PasswordForm> password_form_data = | 2953 scoped_ptr<PasswordForm> password_form_data = |
| 2959 PasswordFormDomManager::CreatePasswordForm(form); | 2954 content::CreatePasswordForm(form); |
| 2960 | 2955 |
| 2961 // In order to save the password that the user actually typed and not one | 2956 // In order to save the password that the user actually typed and not one |
| 2962 // that may have gotten transformed by the site prior to submit, recover it | 2957 // that may have gotten transformed by the site prior to submit, recover it |
| 2963 // from the form contents already stored by |willSendSubmitEvent| into the | 2958 // from the form contents already stored by |willSendSubmitEvent| into the |
| 2964 // dataSource's NavigationState (as opposed to the provisionalDataSource's, | 2959 // dataSource's NavigationState (as opposed to the provisionalDataSource's, |
| 2965 // which is what we're storing into now.) | 2960 // which is what we're storing into now.) |
| 2966 if (password_form_data.get()) { | 2961 if (password_form_data.get()) { |
| 2967 DocumentState* old_document_state = | 2962 DocumentState* old_document_state = |
| 2968 DocumentState::FromDataSource(frame->dataSource()); | 2963 DocumentState::FromDataSource(frame->dataSource()); |
| 2969 if (old_document_state) { | 2964 if (old_document_state) { |
| (...skipping 3343 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6313 | 6308 |
| 6314 updating_frame_tree_ = true; | 6309 updating_frame_tree_ = true; |
| 6315 active_frame_id_map_.clear(); | 6310 active_frame_id_map_.clear(); |
| 6316 | 6311 |
| 6317 target_process_id_ = process_id; | 6312 target_process_id_ = process_id; |
| 6318 target_routing_id_ = route_id; | 6313 target_routing_id_ = route_id; |
| 6319 CreateFrameTree(webview()->mainFrame(), frames); | 6314 CreateFrameTree(webview()->mainFrame(), frames); |
| 6320 | 6315 |
| 6321 updating_frame_tree_ = false; | 6316 updating_frame_tree_ = false; |
| 6322 } | 6317 } |
| OLD | NEW |