| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "content/renderer/render_view_impl.h" | 5 #include "content/renderer/render_view_impl.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 #include <cmath> | 8 #include <cmath> |
| 9 | 9 |
| 10 #include "base/auto_reset.h" | 10 #include "base/auto_reset.h" |
| (...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 58 #include "content/public/common/file_chooser_params.h" | 58 #include "content/public/common/file_chooser_params.h" |
| 59 #include "content/public/common/ssl_status.h" | 59 #include "content/public/common/ssl_status.h" |
| 60 #include "content/public/common/three_d_api_types.h" | 60 #include "content/public/common/three_d_api_types.h" |
| 61 #include "content/public/common/url_constants.h" | 61 #include "content/public/common/url_constants.h" |
| 62 #include "content/public/common/url_utils.h" | 62 #include "content/public/common/url_utils.h" |
| 63 #include "content/public/renderer/content_renderer_client.h" | 63 #include "content/public/renderer/content_renderer_client.h" |
| 64 #include "content/public/renderer/context_menu_client.h" | 64 #include "content/public/renderer/context_menu_client.h" |
| 65 #include "content/public/renderer/document_state.h" | 65 #include "content/public/renderer/document_state.h" |
| 66 #include "content/public/renderer/history_item_serialization.h" | 66 #include "content/public/renderer/history_item_serialization.h" |
| 67 #include "content/public/renderer/navigation_state.h" | 67 #include "content/public/renderer/navigation_state.h" |
| 68 #include "content/public/renderer/password_form_conversion_utils.h" | |
| 69 #include "content/public/renderer/render_view_observer.h" | 68 #include "content/public/renderer/render_view_observer.h" |
| 70 #include "content/public/renderer/render_view_visitor.h" | 69 #include "content/public/renderer/render_view_visitor.h" |
| 71 #include "content/renderer/accessibility/renderer_accessibility.h" | 70 #include "content/renderer/accessibility/renderer_accessibility.h" |
| 72 #include "content/renderer/accessibility/renderer_accessibility_complete.h" | 71 #include "content/renderer/accessibility/renderer_accessibility_complete.h" |
| 73 #include "content/renderer/accessibility/renderer_accessibility_focus_only.h" | 72 #include "content/renderer/accessibility/renderer_accessibility_focus_only.h" |
| 74 #include "content/renderer/browser_plugin/browser_plugin.h" | 73 #include "content/renderer/browser_plugin/browser_plugin.h" |
| 75 #include "content/renderer/browser_plugin/browser_plugin_manager.h" | 74 #include "content/renderer/browser_plugin/browser_plugin_manager.h" |
| 76 #include "content/renderer/browser_plugin/browser_plugin_manager_impl.h" | 75 #include "content/renderer/browser_plugin/browser_plugin_manager_impl.h" |
| 77 #include "content/renderer/context_menu_params_builder.h" | 76 #include "content/renderer/context_menu_params_builder.h" |
| 78 #include "content/renderer/device_orientation_dispatcher.h" | 77 #include "content/renderer/device_orientation_dispatcher.h" |
| (...skipping 1754 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1833 if (frame->document().baseURL() != params.url) | 1832 if (frame->document().baseURL() != params.url) |
| 1834 params.base_url = frame->document().baseURL(); | 1833 params.base_url = frame->document().baseURL(); |
| 1835 | 1834 |
| 1836 GetRedirectChain(ds, ¶ms.redirects); | 1835 GetRedirectChain(ds, ¶ms.redirects); |
| 1837 params.should_update_history = !ds->hasUnreachableURL() && | 1836 params.should_update_history = !ds->hasUnreachableURL() && |
| 1838 !response.isMultipartPayload() && (response.httpStatusCode() != 404); | 1837 !response.isMultipartPayload() && (response.httpStatusCode() != 404); |
| 1839 | 1838 |
| 1840 params.searchable_form_url = internal_data->searchable_form_url(); | 1839 params.searchable_form_url = internal_data->searchable_form_url(); |
| 1841 params.searchable_form_encoding = internal_data->searchable_form_encoding(); | 1840 params.searchable_form_encoding = internal_data->searchable_form_encoding(); |
| 1842 | 1841 |
| 1843 const PasswordForm* password_form_data = document_state->password_form_data(); | |
| 1844 if (password_form_data) | |
| 1845 params.password_form = *password_form_data; | |
| 1846 | |
| 1847 params.gesture = navigation_gesture_; | 1842 params.gesture = navigation_gesture_; |
| 1848 navigation_gesture_ = NavigationGestureUnknown; | 1843 navigation_gesture_ = NavigationGestureUnknown; |
| 1849 | 1844 |
| 1850 // Make navigation state a part of the FrameNavigate message so that commited | 1845 // Make navigation state a part of the FrameNavigate message so that commited |
| 1851 // entry had it at all times. | 1846 // entry had it at all times. |
| 1852 WebHistoryItem item = frame->currentHistoryItem(); | 1847 WebHistoryItem item = frame->currentHistoryItem(); |
| 1853 if (item.isNull()) { | 1848 if (item.isNull()) { |
| 1854 item.initialize(); | 1849 item.initialize(); |
| 1855 item.setURLString(request.url().spec().utf16()); | 1850 item.setURLString(request.url().spec().utf16()); |
| 1856 } | 1851 } |
| (...skipping 1376 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3233 WebNavigationPolicy RenderViewImpl::decidePolicyForNavigation( | 3228 WebNavigationPolicy RenderViewImpl::decidePolicyForNavigation( |
| 3234 WebFrame* frame, const WebURLRequest& request, WebNavigationType type, | 3229 WebFrame* frame, const WebURLRequest& request, WebNavigationType type, |
| 3235 WebNavigationPolicy default_policy, bool is_redirect) { | 3230 WebNavigationPolicy default_policy, bool is_redirect) { |
| 3236 return decidePolicyForNavigation(frame, | 3231 return decidePolicyForNavigation(frame, |
| 3237 frame->provisionalDataSource()->extraData(), | 3232 frame->provisionalDataSource()->extraData(), |
| 3238 request, type, default_policy, is_redirect); | 3233 request, type, default_policy, is_redirect); |
| 3239 } | 3234 } |
| 3240 | 3235 |
| 3241 void RenderViewImpl::willSendSubmitEvent(WebKit::WebFrame* frame, | 3236 void RenderViewImpl::willSendSubmitEvent(WebKit::WebFrame* frame, |
| 3242 const WebKit::WebFormElement& form) { | 3237 const WebKit::WebFormElement& form) { |
| 3243 NOTREACHED(); | 3238 FOR_EACH_OBSERVER( |
| 3239 RenderViewObserver, observers_, WillSendSubmitEvent(frame, form)); |
| 3244 } | 3240 } |
| 3245 | 3241 |
| 3246 void RenderViewImpl::willSubmitForm(WebFrame* frame, | 3242 void RenderViewImpl::willSubmitForm(WebFrame* frame, |
| 3247 const WebFormElement& form) { | 3243 const WebFormElement& form) { |
| 3248 FOR_EACH_OBSERVER( | 3244 FOR_EACH_OBSERVER( |
| 3249 RenderViewObserver, observers_, WillSubmitForm(frame, form)); | 3245 RenderViewObserver, observers_, WillSubmitForm(frame, form)); |
| 3250 } | 3246 } |
| 3251 | 3247 |
| 3252 void RenderViewImpl::willPerformClientRedirect( | 3248 void RenderViewImpl::willPerformClientRedirect( |
| 3253 WebFrame* frame, const WebURL& from, const WebURL& to, double interval, | 3249 WebFrame* frame, const WebURL& from, const WebURL& to, double interval, |
| (...skipping 227 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3481 } | 3477 } |
| 3482 | 3478 |
| 3483 // Start time is only set after request time. | 3479 // Start time is only set after request time. |
| 3484 document_state->set_start_load_time(Time::Now()); | 3480 document_state->set_start_load_time(Time::Now()); |
| 3485 | 3481 |
| 3486 bool is_top_most = !frame->parent(); | 3482 bool is_top_most = !frame->parent(); |
| 3487 if (is_top_most) { | 3483 if (is_top_most) { |
| 3488 navigation_gesture_ = WebUserGestureIndicator::isProcessingUserGesture() ? | 3484 navigation_gesture_ = WebUserGestureIndicator::isProcessingUserGesture() ? |
| 3489 NavigationGestureUser : NavigationGestureAuto; | 3485 NavigationGestureUser : NavigationGestureAuto; |
| 3490 | 3486 |
| 3491 // If the navigation is not triggered by a user gesture, e.g. by some ajax | |
| 3492 // callback, then inherit the submitted password form from the previous | |
| 3493 // state. This fixes the no password save issue for ajax login, tracked in | |
| 3494 // [http://crbug/43219]. Note that there are still some sites that this | |
| 3495 // fails for because they use some element other than a submit button to | |
| 3496 // trigger submission. | |
| 3497 if (navigation_gesture_ == NavigationGestureAuto) { | |
| 3498 DocumentState* old_document_state = DocumentState::FromDataSource( | |
| 3499 frame->dataSource()); | |
| 3500 const content::PasswordForm* old_password_form = | |
| 3501 old_document_state->password_form_data(); | |
| 3502 if (old_password_form) { | |
| 3503 document_state->set_password_form_data( | |
| 3504 make_scoped_ptr(new content::PasswordForm(*old_password_form))); | |
| 3505 } | |
| 3506 } | |
| 3507 | |
| 3508 // Make sure redirect tracking state is clear for the new load. | 3487 // Make sure redirect tracking state is clear for the new load. |
| 3509 completed_client_redirect_src_ = Referrer(); | 3488 completed_client_redirect_src_ = Referrer(); |
| 3510 } else if (frame->parent()->isLoading()) { | 3489 } else if (frame->parent()->isLoading()) { |
| 3511 // Take note of AUTO_SUBFRAME loads here, so that we can know how to | 3490 // Take note of AUTO_SUBFRAME loads here, so that we can know how to |
| 3512 // load an error page. See didFailProvisionalLoad. | 3491 // load an error page. See didFailProvisionalLoad. |
| 3513 document_state->navigation_state()->set_transition_type( | 3492 document_state->navigation_state()->set_transition_type( |
| 3514 PAGE_TRANSITION_AUTO_SUBFRAME); | 3493 PAGE_TRANSITION_AUTO_SUBFRAME); |
| 3515 } | 3494 } |
| 3516 | 3495 |
| 3517 FOR_EACH_OBSERVER( | 3496 FOR_EACH_OBSERVER( |
| (...skipping 2863 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6381 WebURL url = icon_urls[i].iconURL(); | 6360 WebURL url = icon_urls[i].iconURL(); |
| 6382 if (!url.isEmpty()) | 6361 if (!url.isEmpty()) |
| 6383 urls.push_back(FaviconURL(url, | 6362 urls.push_back(FaviconURL(url, |
| 6384 ToFaviconType(icon_urls[i].iconType()))); | 6363 ToFaviconType(icon_urls[i].iconType()))); |
| 6385 } | 6364 } |
| 6386 SendUpdateFaviconURL(urls); | 6365 SendUpdateFaviconURL(urls); |
| 6387 } | 6366 } |
| 6388 | 6367 |
| 6389 | 6368 |
| 6390 } // namespace content | 6369 } // namespace content |
| OLD | NEW |