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/page_zoom.h" | 58 #include "content/public/common/page_zoom.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 1752 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1831 if (frame->document().baseURL() != params.url) | 1830 if (frame->document().baseURL() != params.url) |
1832 params.base_url = frame->document().baseURL(); | 1831 params.base_url = frame->document().baseURL(); |
1833 | 1832 |
1834 GetRedirectChain(ds, ¶ms.redirects); | 1833 GetRedirectChain(ds, ¶ms.redirects); |
1835 params.should_update_history = !ds->hasUnreachableURL() && | 1834 params.should_update_history = !ds->hasUnreachableURL() && |
1836 !response.isMultipartPayload() && (response.httpStatusCode() != 404); | 1835 !response.isMultipartPayload() && (response.httpStatusCode() != 404); |
1837 | 1836 |
1838 params.searchable_form_url = internal_data->searchable_form_url(); | 1837 params.searchable_form_url = internal_data->searchable_form_url(); |
1839 params.searchable_form_encoding = internal_data->searchable_form_encoding(); | 1838 params.searchable_form_encoding = internal_data->searchable_form_encoding(); |
1840 | 1839 |
1841 const PasswordForm* password_form_data = document_state->password_form_data(); | |
1842 if (password_form_data) | |
1843 params.password_form = *password_form_data; | |
1844 | |
1845 params.gesture = navigation_gesture_; | 1840 params.gesture = navigation_gesture_; |
1846 navigation_gesture_ = NavigationGestureUnknown; | 1841 navigation_gesture_ = NavigationGestureUnknown; |
1847 | 1842 |
1848 // Make navigation state a part of the FrameNavigate message so that commited | 1843 // Make navigation state a part of the FrameNavigate message so that commited |
1849 // entry had it at all times. | 1844 // entry had it at all times. |
1850 WebHistoryItem item = frame->currentHistoryItem(); | 1845 WebHistoryItem item = frame->currentHistoryItem(); |
1851 if (item.isNull()) { | 1846 if (item.isNull()) { |
1852 item.initialize(); | 1847 item.initialize(); |
1853 item.setURLString(request.url().spec().utf16()); | 1848 item.setURLString(request.url().spec().utf16()); |
1854 } | 1849 } |
(...skipping 1375 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3230 WebNavigationPolicy RenderViewImpl::decidePolicyForNavigation( | 3225 WebNavigationPolicy RenderViewImpl::decidePolicyForNavigation( |
3231 WebFrame* frame, const WebURLRequest& request, WebNavigationType type, | 3226 WebFrame* frame, const WebURLRequest& request, WebNavigationType type, |
3232 WebNavigationPolicy default_policy, bool is_redirect) { | 3227 WebNavigationPolicy default_policy, bool is_redirect) { |
3233 return decidePolicyForNavigation(frame, | 3228 return decidePolicyForNavigation(frame, |
3234 frame->provisionalDataSource()->extraData(), | 3229 frame->provisionalDataSource()->extraData(), |
3235 request, type, default_policy, is_redirect); | 3230 request, type, default_policy, is_redirect); |
3236 } | 3231 } |
3237 | 3232 |
3238 void RenderViewImpl::willSendSubmitEvent(WebKit::WebFrame* frame, | 3233 void RenderViewImpl::willSendSubmitEvent(WebKit::WebFrame* frame, |
3239 const WebKit::WebFormElement& form) { | 3234 const WebKit::WebFormElement& form) { |
3240 NOTREACHED(); | 3235 FOR_EACH_OBSERVER( |
| 3236 RenderViewObserver, observers_, WillSendSubmitEvent(frame, form)); |
3241 } | 3237 } |
3242 | 3238 |
3243 void RenderViewImpl::willSubmitForm(WebFrame* frame, | 3239 void RenderViewImpl::willSubmitForm(WebFrame* frame, |
3244 const WebFormElement& form) { | 3240 const WebFormElement& form) { |
3245 FOR_EACH_OBSERVER( | 3241 FOR_EACH_OBSERVER( |
3246 RenderViewObserver, observers_, WillSubmitForm(frame, form)); | 3242 RenderViewObserver, observers_, WillSubmitForm(frame, form)); |
3247 } | 3243 } |
3248 | 3244 |
3249 void RenderViewImpl::willPerformClientRedirect( | 3245 void RenderViewImpl::willPerformClientRedirect( |
3250 WebFrame* frame, const WebURL& from, const WebURL& to, double interval, | 3246 WebFrame* frame, const WebURL& from, const WebURL& to, double interval, |
(...skipping 227 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3478 } | 3474 } |
3479 | 3475 |
3480 // Start time is only set after request time. | 3476 // Start time is only set after request time. |
3481 document_state->set_start_load_time(Time::Now()); | 3477 document_state->set_start_load_time(Time::Now()); |
3482 | 3478 |
3483 bool is_top_most = !frame->parent(); | 3479 bool is_top_most = !frame->parent(); |
3484 if (is_top_most) { | 3480 if (is_top_most) { |
3485 navigation_gesture_ = WebUserGestureIndicator::isProcessingUserGesture() ? | 3481 navigation_gesture_ = WebUserGestureIndicator::isProcessingUserGesture() ? |
3486 NavigationGestureUser : NavigationGestureAuto; | 3482 NavigationGestureUser : NavigationGestureAuto; |
3487 | 3483 |
3488 // If the navigation is not triggered by a user gesture, e.g. by some ajax | |
3489 // callback, then inherit the submitted password form from the previous | |
3490 // state. This fixes the no password save issue for ajax login, tracked in | |
3491 // [http://crbug/43219]. Note that there are still some sites that this | |
3492 // fails for because they use some element other than a submit button to | |
3493 // trigger submission. | |
3494 if (navigation_gesture_ == NavigationGestureAuto) { | |
3495 DocumentState* old_document_state = DocumentState::FromDataSource( | |
3496 frame->dataSource()); | |
3497 const content::PasswordForm* old_password_form = | |
3498 old_document_state->password_form_data(); | |
3499 if (old_password_form) { | |
3500 document_state->set_password_form_data( | |
3501 make_scoped_ptr(new content::PasswordForm(*old_password_form))); | |
3502 } | |
3503 } | |
3504 | |
3505 // Make sure redirect tracking state is clear for the new load. | 3484 // Make sure redirect tracking state is clear for the new load. |
3506 completed_client_redirect_src_ = Referrer(); | 3485 completed_client_redirect_src_ = Referrer(); |
3507 } else if (frame->parent()->isLoading()) { | 3486 } else if (frame->parent()->isLoading()) { |
3508 // Take note of AUTO_SUBFRAME loads here, so that we can know how to | 3487 // Take note of AUTO_SUBFRAME loads here, so that we can know how to |
3509 // load an error page. See didFailProvisionalLoad. | 3488 // load an error page. See didFailProvisionalLoad. |
3510 document_state->navigation_state()->set_transition_type( | 3489 document_state->navigation_state()->set_transition_type( |
3511 PAGE_TRANSITION_AUTO_SUBFRAME); | 3490 PAGE_TRANSITION_AUTO_SUBFRAME); |
3512 } | 3491 } |
3513 | 3492 |
3514 FOR_EACH_OBSERVER( | 3493 FOR_EACH_OBSERVER( |
(...skipping 2861 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6376 WebURL url = icon_urls[i].iconURL(); | 6355 WebURL url = icon_urls[i].iconURL(); |
6377 if (!url.isEmpty()) | 6356 if (!url.isEmpty()) |
6378 urls.push_back(FaviconURL(url, | 6357 urls.push_back(FaviconURL(url, |
6379 ToFaviconType(icon_urls[i].iconType()))); | 6358 ToFaviconType(icon_urls[i].iconType()))); |
6380 } | 6359 } |
6381 SendUpdateFaviconURL(urls); | 6360 SendUpdateFaviconURL(urls); |
6382 } | 6361 } |
6383 | 6362 |
6384 | 6363 |
6385 } // namespace content | 6364 } // namespace content |
OLD | NEW |