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 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
60 #include "content/public/common/page_zoom.h" | 60 #include "content/public/common/page_zoom.h" |
61 #include "content/public/common/ssl_status.h" | 61 #include "content/public/common/ssl_status.h" |
62 #include "content/public/common/three_d_api_types.h" | 62 #include "content/public/common/three_d_api_types.h" |
63 #include "content/public/common/url_constants.h" | 63 #include "content/public/common/url_constants.h" |
64 #include "content/public/common/url_utils.h" | 64 #include "content/public/common/url_utils.h" |
65 #include "content/public/renderer/content_renderer_client.h" | 65 #include "content/public/renderer/content_renderer_client.h" |
66 #include "content/public/renderer/context_menu_client.h" | 66 #include "content/public/renderer/context_menu_client.h" |
67 #include "content/public/renderer/document_state.h" | 67 #include "content/public/renderer/document_state.h" |
68 #include "content/public/renderer/history_item_serialization.h" | 68 #include "content/public/renderer/history_item_serialization.h" |
69 #include "content/public/renderer/navigation_state.h" | 69 #include "content/public/renderer/navigation_state.h" |
70 #include "content/public/renderer/password_form_conversion_utils.h" | |
71 #include "content/public/renderer/render_view_observer.h" | 70 #include "content/public/renderer/render_view_observer.h" |
72 #include "content/public/renderer/render_view_visitor.h" | 71 #include "content/public/renderer/render_view_visitor.h" |
73 #include "content/renderer/accessibility/renderer_accessibility.h" | 72 #include "content/renderer/accessibility/renderer_accessibility.h" |
74 #include "content/renderer/accessibility/renderer_accessibility_complete.h" | 73 #include "content/renderer/accessibility/renderer_accessibility_complete.h" |
75 #include "content/renderer/accessibility/renderer_accessibility_focus_only.h" | 74 #include "content/renderer/accessibility/renderer_accessibility_focus_only.h" |
76 #include "content/renderer/browser_plugin/browser_plugin.h" | 75 #include "content/renderer/browser_plugin/browser_plugin.h" |
77 #include "content/renderer/browser_plugin/browser_plugin_manager.h" | 76 #include "content/renderer/browser_plugin/browser_plugin_manager.h" |
78 #include "content/renderer/browser_plugin/browser_plugin_manager_impl.h" | 77 #include "content/renderer/browser_plugin/browser_plugin_manager_impl.h" |
79 #include "content/renderer/context_menu_params_builder.h" | 78 #include "content/renderer/context_menu_params_builder.h" |
80 #include "content/renderer/device_orientation_dispatcher.h" | 79 #include "content/renderer/device_orientation_dispatcher.h" |
(...skipping 1903 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1984 if (frame->document().baseURL() != params.url) | 1983 if (frame->document().baseURL() != params.url) |
1985 params.base_url = frame->document().baseURL(); | 1984 params.base_url = frame->document().baseURL(); |
1986 | 1985 |
1987 GetRedirectChain(ds, ¶ms.redirects); | 1986 GetRedirectChain(ds, ¶ms.redirects); |
1988 params.should_update_history = !ds->hasUnreachableURL() && | 1987 params.should_update_history = !ds->hasUnreachableURL() && |
1989 !response.isMultipartPayload() && (response.httpStatusCode() != 404); | 1988 !response.isMultipartPayload() && (response.httpStatusCode() != 404); |
1990 | 1989 |
1991 params.searchable_form_url = internal_data->searchable_form_url(); | 1990 params.searchable_form_url = internal_data->searchable_form_url(); |
1992 params.searchable_form_encoding = internal_data->searchable_form_encoding(); | 1991 params.searchable_form_encoding = internal_data->searchable_form_encoding(); |
1993 | 1992 |
1994 const PasswordForm* password_form_data = document_state->password_form_data(); | |
1995 if (password_form_data) | |
1996 params.password_form = *password_form_data; | |
1997 | |
1998 params.gesture = navigation_gesture_; | 1993 params.gesture = navigation_gesture_; |
1999 navigation_gesture_ = NavigationGestureUnknown; | 1994 navigation_gesture_ = NavigationGestureUnknown; |
2000 | 1995 |
2001 // Make navigation state a part of the FrameNavigate message so that commited | 1996 // Make navigation state a part of the FrameNavigate message so that commited |
2002 // entry had it at all times. | 1997 // entry had it at all times. |
2003 WebHistoryItem item = frame->currentHistoryItem(); | 1998 WebHistoryItem item = frame->currentHistoryItem(); |
2004 if (item.isNull()) { | 1999 if (item.isNull()) { |
2005 item.initialize(); | 2000 item.initialize(); |
2006 item.setURLString(request.url().spec().utf16()); | 2001 item.setURLString(request.url().spec().utf16()); |
2007 } | 2002 } |
(...skipping 1365 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3373 WebNavigationPolicy RenderViewImpl::decidePolicyForNavigation( | 3368 WebNavigationPolicy RenderViewImpl::decidePolicyForNavigation( |
3374 WebFrame* frame, const WebURLRequest& request, WebNavigationType type, | 3369 WebFrame* frame, const WebURLRequest& request, WebNavigationType type, |
3375 WebNavigationPolicy default_policy, bool is_redirect) { | 3370 WebNavigationPolicy default_policy, bool is_redirect) { |
3376 return decidePolicyForNavigation(frame, | 3371 return decidePolicyForNavigation(frame, |
3377 frame->provisionalDataSource()->extraData(), | 3372 frame->provisionalDataSource()->extraData(), |
3378 request, type, default_policy, is_redirect); | 3373 request, type, default_policy, is_redirect); |
3379 } | 3374 } |
3380 | 3375 |
3381 void RenderViewImpl::willSendSubmitEvent(WebKit::WebFrame* frame, | 3376 void RenderViewImpl::willSendSubmitEvent(WebKit::WebFrame* frame, |
3382 const WebKit::WebFormElement& form) { | 3377 const WebKit::WebFormElement& form) { |
3383 NOTREACHED(); | 3378 FOR_EACH_OBSERVER( |
| 3379 RenderViewObserver, observers_, WillSendSubmitEvent(frame, form)); |
3384 } | 3380 } |
3385 | 3381 |
3386 void RenderViewImpl::willSubmitForm(WebFrame* frame, | 3382 void RenderViewImpl::willSubmitForm(WebFrame* frame, |
3387 const WebFormElement& form) { | 3383 const WebFormElement& form) { |
3388 FOR_EACH_OBSERVER( | 3384 FOR_EACH_OBSERVER( |
3389 RenderViewObserver, observers_, WillSubmitForm(frame, form)); | 3385 RenderViewObserver, observers_, WillSubmitForm(frame, form)); |
3390 } | 3386 } |
3391 | 3387 |
3392 void RenderViewImpl::didCreateDataSource(WebFrame* frame, WebDataSource* ds) { | 3388 void RenderViewImpl::didCreateDataSource(WebFrame* frame, WebDataSource* ds) { |
3393 bool content_initiated = !pending_navigation_params_.get(); | 3389 bool content_initiated = !pending_navigation_params_.get(); |
(...skipping 190 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3584 document_state->set_request_time(Time::FromDoubleT(event_time)); | 3580 document_state->set_request_time(Time::FromDoubleT(event_time)); |
3585 } | 3581 } |
3586 | 3582 |
3587 // Start time is only set after request time. | 3583 // Start time is only set after request time. |
3588 document_state->set_start_load_time(Time::Now()); | 3584 document_state->set_start_load_time(Time::Now()); |
3589 | 3585 |
3590 bool is_top_most = !frame->parent(); | 3586 bool is_top_most = !frame->parent(); |
3591 if (is_top_most) { | 3587 if (is_top_most) { |
3592 navigation_gesture_ = WebUserGestureIndicator::isProcessingUserGesture() ? | 3588 navigation_gesture_ = WebUserGestureIndicator::isProcessingUserGesture() ? |
3593 NavigationGestureUser : NavigationGestureAuto; | 3589 NavigationGestureUser : NavigationGestureAuto; |
3594 | |
3595 // If the navigation is not triggered by a user gesture, e.g. by some ajax | |
3596 // callback, then inherit the submitted password form from the previous | |
3597 // state. This fixes the no password save issue for ajax login, tracked in | |
3598 // [http://crbug/43219]. Note that there are still some sites that this | |
3599 // fails for because they use some element other than a submit button to | |
3600 // trigger submission. | |
3601 if (navigation_gesture_ == NavigationGestureAuto) { | |
3602 DocumentState* old_document_state = DocumentState::FromDataSource( | |
3603 frame->dataSource()); | |
3604 const content::PasswordForm* old_password_form = | |
3605 old_document_state->password_form_data(); | |
3606 if (old_password_form) { | |
3607 document_state->set_password_form_data( | |
3608 make_scoped_ptr(new content::PasswordForm(*old_password_form))); | |
3609 } | |
3610 } | |
3611 } else if (frame->parent()->isLoading()) { | 3590 } else if (frame->parent()->isLoading()) { |
3612 // Take note of AUTO_SUBFRAME loads here, so that we can know how to | 3591 // Take note of AUTO_SUBFRAME loads here, so that we can know how to |
3613 // load an error page. See didFailProvisionalLoad. | 3592 // load an error page. See didFailProvisionalLoad. |
3614 document_state->navigation_state()->set_transition_type( | 3593 document_state->navigation_state()->set_transition_type( |
3615 PAGE_TRANSITION_AUTO_SUBFRAME); | 3594 PAGE_TRANSITION_AUTO_SUBFRAME); |
3616 } | 3595 } |
3617 | 3596 |
3618 FOR_EACH_OBSERVER( | 3597 FOR_EACH_OBSERVER( |
3619 RenderViewObserver, observers_, DidStartProvisionalLoad(frame)); | 3598 RenderViewObserver, observers_, DidStartProvisionalLoad(frame)); |
3620 | 3599 |
(...skipping 2927 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6548 WebURL url = icon_urls[i].iconURL(); | 6527 WebURL url = icon_urls[i].iconURL(); |
6549 if (!url.isEmpty()) | 6528 if (!url.isEmpty()) |
6550 urls.push_back(FaviconURL(url, | 6529 urls.push_back(FaviconURL(url, |
6551 ToFaviconType(icon_urls[i].iconType()))); | 6530 ToFaviconType(icon_urls[i].iconType()))); |
6552 } | 6531 } |
6553 SendUpdateFaviconURL(urls); | 6532 SendUpdateFaviconURL(urls); |
6554 } | 6533 } |
6555 | 6534 |
6556 | 6535 |
6557 } // namespace content | 6536 } // namespace content |
OLD | NEW |