| 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_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 24 matching lines...) Expand all Loading... |
| 35 #include "content/common/pepper_messages.h" | 35 #include "content/common/pepper_messages.h" |
| 36 #include "content/common/pepper_plugin_registry.h" | 36 #include "content/common/pepper_plugin_registry.h" |
| 37 #include "content/common/quota_dispatcher.h" | 37 #include "content/common/quota_dispatcher.h" |
| 38 #include "content/common/request_extra_data.h" | 38 #include "content/common/request_extra_data.h" |
| 39 #include "content/common/view_messages.h" | 39 #include "content/common/view_messages.h" |
| 40 #include "content/public/common/bindings_policy.h" | 40 #include "content/public/common/bindings_policy.h" |
| 41 #include "content/public/common/content_constants.h" | 41 #include "content/public/common/content_constants.h" |
| 42 #include "content/public/common/content_switches.h" | 42 #include "content/public/common/content_switches.h" |
| 43 #include "content/public/common/url_constants.h" | 43 #include "content/public/common/url_constants.h" |
| 44 #include "content/public/renderer/content_renderer_client.h" | 44 #include "content/public/renderer/content_renderer_client.h" |
| 45 #include "content/public/renderer/document_state.h" |
| 45 #include "content/public/renderer/navigation_state.h" | 46 #include "content/public/renderer/navigation_state.h" |
| 46 #include "content/public/renderer/render_view_observer.h" | 47 #include "content/public/renderer/render_view_observer.h" |
| 47 #include "content/public/renderer/render_view_visitor.h" | 48 #include "content/public/renderer/render_view_visitor.h" |
| 48 #include "content/renderer/device_orientation_dispatcher.h" | 49 #include "content/renderer/device_orientation_dispatcher.h" |
| 49 #include "content/renderer/devtools_agent.h" | 50 #include "content/renderer/devtools_agent.h" |
| 50 #include "content/renderer/external_popup_menu.h" | 51 #include "content/renderer/external_popup_menu.h" |
| 51 #include "content/renderer/geolocation_dispatcher.h" | 52 #include "content/renderer/geolocation_dispatcher.h" |
| 52 #include "content/renderer/gpu/webgraphicscontext3d_command_buffer_impl.h" | 53 #include "content/renderer/gpu/webgraphicscontext3d_command_buffer_impl.h" |
| 53 #include "content/renderer/intents_dispatcher.h" | 54 #include "content/renderer/intents_dispatcher.h" |
| 54 #include "content/renderer/java/java_bridge_dispatcher.h" | 55 #include "content/renderer/java/java_bridge_dispatcher.h" |
| (...skipping 175 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 230 using WebKit::WebURLResponse; | 231 using WebKit::WebURLResponse; |
| 231 using WebKit::WebVector; | 232 using WebKit::WebVector; |
| 232 using WebKit::WebView; | 233 using WebKit::WebView; |
| 233 using WebKit::WebWidget; | 234 using WebKit::WebWidget; |
| 234 using WebKit::WebWindowFeatures; | 235 using WebKit::WebWindowFeatures; |
| 235 using WebKit::WebWorker; | 236 using WebKit::WebWorker; |
| 236 using WebKit::WebWorkerClient; | 237 using WebKit::WebWorkerClient; |
| 237 using appcache::WebApplicationCacheHostImpl; | 238 using appcache::WebApplicationCacheHostImpl; |
| 238 using base::Time; | 239 using base::Time; |
| 239 using base::TimeDelta; | 240 using base::TimeDelta; |
| 241 using content::DocumentState; |
| 240 using content::NavigationState; | 242 using content::NavigationState; |
| 241 using content::RenderThread; | 243 using content::RenderThread; |
| 242 using content::RenderViewObserver; | 244 using content::RenderViewObserver; |
| 243 using content::RenderViewVisitor; | 245 using content::RenderViewVisitor; |
| 244 using content::V8ValueConverter; | 246 using content::V8ValueConverter; |
| 245 using webkit_glue::AltErrorPageResourceFetcher; | 247 using webkit_glue::AltErrorPageResourceFetcher; |
| 246 using webkit_glue::FormField; | 248 using webkit_glue::FormField; |
| 247 using webkit_glue::PasswordForm; | 249 using webkit_glue::PasswordForm; |
| 248 using webkit_glue::PasswordFormDomManager; | 250 using webkit_glue::PasswordFormDomManager; |
| 249 using webkit_glue::ResourceFetcher; | 251 using webkit_glue::ResourceFetcher; |
| (...skipping 24 matching lines...) Expand all Loading... |
| 274 static const float kScalingIncrementForGesture = 0.01f; | 276 static const float kScalingIncrementForGesture = 0.01f; |
| 275 | 277 |
| 276 static void GetRedirectChain(WebDataSource* ds, std::vector<GURL>* result) { | 278 static void GetRedirectChain(WebDataSource* ds, std::vector<GURL>* result) { |
| 277 WebVector<WebURL> urls; | 279 WebVector<WebURL> urls; |
| 278 ds->redirectChain(urls); | 280 ds->redirectChain(urls); |
| 279 result->reserve(urls.size()); | 281 result->reserve(urls.size()); |
| 280 for (size_t i = 0; i < urls.size(); ++i) | 282 for (size_t i = 0; i < urls.size(); ++i) |
| 281 result->push_back(urls[i]); | 283 result->push_back(urls[i]); |
| 282 } | 284 } |
| 283 | 285 |
| 284 // If |data_source| is non-null and has a NavigationState associated with it, | 286 // If |data_source| is non-null and has a DocumentState associated with it, |
| 285 // the AltErrorPageResourceFetcher is reset. | 287 // the AltErrorPageResourceFetcher is reset. |
| 286 static void StopAltErrorPageFetcher(WebDataSource* data_source) { | 288 static void StopAltErrorPageFetcher(WebDataSource* data_source) { |
| 287 if (data_source) { | 289 if (data_source) { |
| 288 NavigationState* state = NavigationState::FromDataSource(data_source); | 290 DocumentState* document_state = DocumentState::FromDataSource(data_source); |
| 289 if (state) | 291 if (document_state) |
| 290 state->set_alt_error_page_fetcher(NULL); | 292 document_state->set_alt_error_page_fetcher(NULL); |
| 291 } | 293 } |
| 292 } | 294 } |
| 293 | 295 |
| 296 static bool IsReload(const ViewMsg_Navigate_Params& params) { |
| 297 return |
| 298 params.navigation_type == ViewMsg_Navigate_Type::RELOAD || |
| 299 params.navigation_type == ViewMsg_Navigate_Type::RELOAD_IGNORING_CACHE; |
| 300 } |
| 301 |
| 294 /////////////////////////////////////////////////////////////////////////////// | 302 /////////////////////////////////////////////////////////////////////////////// |
| 295 | 303 |
| 296 int32 RenderViewImpl::next_page_id_ = 1; | 304 int32 RenderViewImpl::next_page_id_ = 1; |
| 297 | 305 |
| 298 struct RenderViewImpl::PendingFileChooser { | 306 struct RenderViewImpl::PendingFileChooser { |
| 299 PendingFileChooser(const ViewHostMsg_RunFileChooser_Params& p, | 307 PendingFileChooser(const ViewHostMsg_RunFileChooser_Params& p, |
| 300 WebFileChooserCompletion* c) | 308 WebFileChooserCompletion* c) |
| 301 : params(p), | 309 : params(p), |
| 302 completion(c) { | 310 completion(c) { |
| 303 } | 311 } |
| (...skipping 389 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 693 | 701 |
| 694 return handled; | 702 return handled; |
| 695 } | 703 } |
| 696 | 704 |
| 697 void RenderViewImpl::OnNavigate(const ViewMsg_Navigate_Params& params) { | 705 void RenderViewImpl::OnNavigate(const ViewMsg_Navigate_Params& params) { |
| 698 if (!webview()) | 706 if (!webview()) |
| 699 return; | 707 return; |
| 700 | 708 |
| 701 FOR_EACH_OBSERVER(RenderViewObserver, observers_, Navigate(params.url)); | 709 FOR_EACH_OBSERVER(RenderViewObserver, observers_, Navigate(params.url)); |
| 702 | 710 |
| 703 bool is_reload = | 711 bool is_reload = IsReload(params); |
| 704 params.navigation_type == ViewMsg_Navigate_Type::RELOAD || | |
| 705 params.navigation_type == ViewMsg_Navigate_Type::RELOAD_IGNORING_CACHE; | |
| 706 | 712 |
| 707 // If this is a stale back/forward (due to a recent navigation the browser | 713 // If this is a stale back/forward (due to a recent navigation the browser |
| 708 // didn't know about), ignore it. | 714 // didn't know about), ignore it. |
| 709 if (IsBackForwardToStaleEntry(params, is_reload)) | 715 if (IsBackForwardToStaleEntry(params, is_reload)) |
| 710 return; | 716 return; |
| 711 | 717 |
| 712 // Swap this renderer back in if necessary. | 718 // Swap this renderer back in if necessary. |
| 713 if (is_swapped_out_) | 719 if (is_swapped_out_) |
| 714 SetSwappedOut(false); | 720 SetSwappedOut(false); |
| 715 | 721 |
| 716 history_list_offset_ = params.current_history_list_offset; | 722 history_list_offset_ = params.current_history_list_offset; |
| 717 history_list_length_ = params.current_history_list_length; | 723 history_list_length_ = params.current_history_list_length; |
| 718 if (history_list_length_ >= 0) | 724 if (history_list_length_ >= 0) |
| 719 history_page_ids_.resize(history_list_length_, -1); | 725 history_page_ids_.resize(history_list_length_, -1); |
| 720 if (params.pending_history_list_offset >= 0 && | 726 if (params.pending_history_list_offset >= 0 && |
| 721 params.pending_history_list_offset < history_list_length_) | 727 params.pending_history_list_offset < history_list_length_) |
| 722 history_page_ids_[params.pending_history_list_offset] = params.page_id; | 728 history_page_ids_[params.pending_history_list_offset] = params.page_id; |
| 723 | 729 |
| 724 content::GetContentClient()->SetActiveURL(params.url); | 730 content::GetContentClient()->SetActiveURL(params.url); |
| 725 | 731 |
| 726 WebFrame* main_frame = webview()->mainFrame(); | 732 WebFrame* main_frame = webview()->mainFrame(); |
| 727 if (is_reload && main_frame->currentHistoryItem().isNull()) { | 733 if (is_reload && main_frame->currentHistoryItem().isNull()) { |
| 728 // We cannot reload if we do not have any history state. This happens, for | 734 // We cannot reload if we do not have any history state. This happens, for |
| 729 // example, when recovering from a crash. Our workaround here is a bit of | 735 // example, when recovering from a crash. Our workaround here is a bit of |
| 730 // a hack since it means that reload after a crashed tab does not cause an | 736 // a hack since it means that reload after a crashed tab does not cause an |
| 731 // end-to-end cache validation. | 737 // end-to-end cache validation. |
| 732 is_reload = false; | 738 is_reload = false; |
| 733 } | 739 } |
| 734 | 740 |
| 735 // A navigation resulting from loading a javascript URL should not be treated | 741 pending_navigation_params_.reset(new ViewMsg_Navigate_Params); |
| 736 // as a browser initiated event. Instead, we want it to look as if the page | 742 *pending_navigation_params_.get() = params; |
| 737 // initiated any load resulting from JS execution. | |
| 738 if (!params.url.SchemeIs(chrome::kJavaScriptScheme)) { | |
| 739 NavigationState* state = NavigationState::CreateBrowserInitiated( | |
| 740 params.page_id, | |
| 741 params.pending_history_list_offset, | |
| 742 params.transition, | |
| 743 params.request_time); | |
| 744 if (params.navigation_type == ViewMsg_Navigate_Type::RESTORE) { | |
| 745 // We're doing a load of a page that was restored from the last session. | |
| 746 // By default this prefers the cache over loading (LOAD_PREFERRING_CACHE) | |
| 747 // which can result in stale data for pages that are set to expire. We | |
| 748 // explicitly override that by setting the policy here so that as | |
| 749 // necessary we load from the network. | |
| 750 state->set_cache_policy_override(WebURLRequest::UseProtocolCachePolicy); | |
| 751 } | |
| 752 pending_navigation_state_.reset(state); | |
| 753 } | |
| 754 | |
| 755 NavigationState* navigation_state = pending_navigation_state_.get(); | |
| 756 | |
| 757 if (navigation_state) { | |
| 758 // New loads need to reset the error page fetcher. Otherwise if there is an | |
| 759 // outstanding error page fetcher it may complete and clobber the current | |
| 760 // page load. | |
| 761 navigation_state->set_alt_error_page_fetcher(NULL); | |
| 762 } | |
| 763 | 743 |
| 764 // If we are reloading, then WebKit will use the history state of the current | 744 // If we are reloading, then WebKit will use the history state of the current |
| 765 // page, so we should just ignore any given history state. Otherwise, if we | 745 // page, so we should just ignore any given history state. Otherwise, if we |
| 766 // have history state, then we need to navigate to it, which corresponds to a | 746 // have history state, then we need to navigate to it, which corresponds to a |
| 767 // back/forward navigation event. | 747 // back/forward navigation event. |
| 768 if (is_reload) { | 748 if (is_reload) { |
| 769 if (navigation_state) | |
| 770 navigation_state->set_load_type(NavigationState::RELOAD); | |
| 771 bool ignore_cache = (params.navigation_type == | 749 bool ignore_cache = (params.navigation_type == |
| 772 ViewMsg_Navigate_Type::RELOAD_IGNORING_CACHE); | 750 ViewMsg_Navigate_Type::RELOAD_IGNORING_CACHE); |
| 773 main_frame->reload(ignore_cache); | 751 main_frame->reload(ignore_cache); |
| 774 } else if (!params.state.empty()) { | 752 } else if (!params.state.empty()) { |
| 775 // We must know the page ID of the page we are navigating back to. | 753 // We must know the page ID of the page we are navigating back to. |
| 776 DCHECK_NE(params.page_id, -1); | 754 DCHECK_NE(params.page_id, -1); |
| 777 if (navigation_state) | |
| 778 navigation_state->set_load_type(NavigationState::HISTORY_LOAD); | |
| 779 main_frame->loadHistoryItem( | 755 main_frame->loadHistoryItem( |
| 780 webkit_glue::HistoryItemFromString(params.state)); | 756 webkit_glue::HistoryItemFromString(params.state)); |
| 781 } else { | 757 } else { |
| 782 // Navigate to the given URL. | 758 // Navigate to the given URL. |
| 783 WebURLRequest request(params.url); | 759 WebURLRequest request(params.url); |
| 784 | 760 |
| 785 // A session history navigation should have been accompanied by state. | 761 // A session history navigation should have been accompanied by state. |
| 786 DCHECK_EQ(params.page_id, -1); | 762 DCHECK_EQ(params.page_id, -1); |
| 787 | 763 |
| 788 if (main_frame->isViewSourceModeEnabled()) | 764 if (main_frame->isViewSourceModeEnabled()) |
| (...skipping 10 matching lines...) Expand all Loading... |
| 799 | 775 |
| 800 if (!params.extra_headers.empty()) { | 776 if (!params.extra_headers.empty()) { |
| 801 for (net::HttpUtil::HeadersIterator i(params.extra_headers.begin(), | 777 for (net::HttpUtil::HeadersIterator i(params.extra_headers.begin(), |
| 802 params.extra_headers.end(), "\n"); | 778 params.extra_headers.end(), "\n"); |
| 803 i.GetNext(); ) { | 779 i.GetNext(); ) { |
| 804 request.addHTTPHeaderField(WebString::fromUTF8(i.name()), | 780 request.addHTTPHeaderField(WebString::fromUTF8(i.name()), |
| 805 WebString::fromUTF8(i.values())); | 781 WebString::fromUTF8(i.values())); |
| 806 } | 782 } |
| 807 } | 783 } |
| 808 | 784 |
| 809 if (navigation_state) | |
| 810 navigation_state->set_load_type(NavigationState::NORMAL_LOAD); | |
| 811 main_frame->loadRequest(request); | 785 main_frame->loadRequest(request); |
| 812 } | 786 } |
| 813 | 787 |
| 814 // In case LoadRequest failed before DidCreateDataSource was called. | 788 // In case LoadRequest failed before DidCreateDataSource was called. |
| 815 pending_navigation_state_.reset(); | 789 pending_navigation_params_.reset(); |
| 816 } | 790 } |
| 817 | 791 |
| 818 bool RenderViewImpl::IsBackForwardToStaleEntry( | 792 bool RenderViewImpl::IsBackForwardToStaleEntry( |
| 819 const ViewMsg_Navigate_Params& params, | 793 const ViewMsg_Navigate_Params& params, |
| 820 bool is_reload) { | 794 bool is_reload) { |
| 821 // Make sure this isn't a back/forward to an entry we have already cropped | 795 // Make sure this isn't a back/forward to an entry we have already cropped |
| 822 // or replaced from our history, before the browser knew about it. If so, | 796 // or replaced from our history, before the browser knew about it. If so, |
| 823 // a new navigation has committed in the mean time, and we can ignore this. | 797 // a new navigation has committed in the mean time, and we can ignore this. |
| 824 bool is_back_forward = !is_reload && !params.state.empty(); | 798 bool is_back_forward = !is_reload && !params.state.empty(); |
| 825 | 799 |
| (...skipping 219 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1045 | 1019 |
| 1046 // Tell the embedding application that the URL of the active page has changed | 1020 // Tell the embedding application that the URL of the active page has changed |
| 1047 void RenderViewImpl::UpdateURL(WebFrame* frame) { | 1021 void RenderViewImpl::UpdateURL(WebFrame* frame) { |
| 1048 WebDataSource* ds = frame->dataSource(); | 1022 WebDataSource* ds = frame->dataSource(); |
| 1049 DCHECK(ds); | 1023 DCHECK(ds); |
| 1050 | 1024 |
| 1051 const WebURLRequest& request = ds->request(); | 1025 const WebURLRequest& request = ds->request(); |
| 1052 const WebURLRequest& original_request = ds->originalRequest(); | 1026 const WebURLRequest& original_request = ds->originalRequest(); |
| 1053 const WebURLResponse& response = ds->response(); | 1027 const WebURLResponse& response = ds->response(); |
| 1054 | 1028 |
| 1055 NavigationState* navigation_state = NavigationState::FromDataSource(ds); | 1029 DocumentState* document_state = DocumentState::FromDataSource(ds); |
| 1056 DCHECK(navigation_state); | 1030 NavigationState* navigation_state = document_state->navigation_state(); |
| 1057 | 1031 |
| 1058 ViewHostMsg_FrameNavigate_Params params; | 1032 ViewHostMsg_FrameNavigate_Params params; |
| 1059 params.http_status_code = response.httpStatusCode(); | 1033 params.http_status_code = response.httpStatusCode(); |
| 1060 params.is_post = false; | 1034 params.is_post = false; |
| 1061 params.page_id = page_id_; | 1035 params.page_id = page_id_; |
| 1062 params.frame_id = frame->identifier(); | 1036 params.frame_id = frame->identifier(); |
| 1063 params.socket_address.set_host(response.remoteIPAddress().utf8()); | 1037 params.socket_address.set_host(response.remoteIPAddress().utf8()); |
| 1064 params.socket_address.set_port(response.remotePort()); | 1038 params.socket_address.set_port(response.remotePort()); |
| 1065 params.was_fetched_via_proxy = response.wasFetchedViaProxy(); | 1039 params.was_fetched_via_proxy = response.wasFetchedViaProxy(); |
| 1066 params.was_within_same_page = navigation_state->was_within_same_page(); | 1040 params.was_within_same_page = navigation_state->was_within_same_page(); |
| 1067 if (!navigation_state->security_info().empty()) { | 1041 if (!document_state->security_info().empty()) { |
| 1068 // SSL state specified in the request takes precedence over the one in the | 1042 // SSL state specified in the request takes precedence over the one in the |
| 1069 // response. | 1043 // response. |
| 1070 // So far this is only intended for error pages that are not expected to be | 1044 // So far this is only intended for error pages that are not expected to be |
| 1071 // over ssl, so we should not get any clash. | 1045 // over ssl, so we should not get any clash. |
| 1072 DCHECK(response.securityInfo().isEmpty()); | 1046 DCHECK(response.securityInfo().isEmpty()); |
| 1073 params.security_info = navigation_state->security_info(); | 1047 params.security_info = document_state->security_info(); |
| 1074 } else { | 1048 } else { |
| 1075 params.security_info = response.securityInfo(); | 1049 params.security_info = response.securityInfo(); |
| 1076 } | 1050 } |
| 1077 | 1051 |
| 1078 // Set the URL to be displayed in the browser UI to the user. | 1052 // Set the URL to be displayed in the browser UI to the user. |
| 1079 if (ds->hasUnreachableURL()) { | 1053 if (ds->hasUnreachableURL()) { |
| 1080 params.url = ds->unreachableURL(); | 1054 params.url = ds->unreachableURL(); |
| 1081 } else { | 1055 } else { |
| 1082 params.url = request.url(); | 1056 params.url = request.url(); |
| 1083 } | 1057 } |
| 1084 | 1058 |
| 1085 GetRedirectChain(ds, ¶ms.redirects); | 1059 GetRedirectChain(ds, ¶ms.redirects); |
| 1086 params.should_update_history = !ds->hasUnreachableURL() && | 1060 params.should_update_history = !ds->hasUnreachableURL() && |
| 1087 !response.isMultipartPayload() && (response.httpStatusCode() != 404); | 1061 !response.isMultipartPayload() && (response.httpStatusCode() != 404); |
| 1088 | 1062 |
| 1089 params.searchable_form_url = navigation_state->searchable_form_url(); | 1063 params.searchable_form_url = document_state->searchable_form_url(); |
| 1090 params.searchable_form_encoding = | 1064 params.searchable_form_encoding = |
| 1091 navigation_state->searchable_form_encoding(); | 1065 document_state->searchable_form_encoding(); |
| 1092 | 1066 |
| 1093 const PasswordForm* password_form_data = | 1067 const PasswordForm* password_form_data = |
| 1094 navigation_state->password_form_data(); | 1068 document_state->password_form_data(); |
| 1095 if (password_form_data) | 1069 if (password_form_data) |
| 1096 params.password_form = *password_form_data; | 1070 params.password_form = *password_form_data; |
| 1097 | 1071 |
| 1098 params.gesture = navigation_gesture_; | 1072 params.gesture = navigation_gesture_; |
| 1099 navigation_gesture_ = NavigationGestureUnknown; | 1073 navigation_gesture_ = NavigationGestureUnknown; |
| 1100 | 1074 |
| 1101 // Make navigation state a part of the FrameNavigate message so that commited | 1075 // Make navigation state a part of the FrameNavigate message so that commited |
| 1102 // entry had it at all times. | 1076 // entry had it at all times. |
| 1103 const WebHistoryItem& item = frame->currentHistoryItem(); | 1077 const WebHistoryItem& item = frame->currentHistoryItem(); |
| 1104 if (!item.isNull()) { | 1078 if (!item.isNull()) { |
| (...skipping 900 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2005 } | 1979 } |
| 2006 | 1980 |
| 2007 // Webkit is asking whether to navigate to a new URL. | 1981 // Webkit is asking whether to navigate to a new URL. |
| 2008 // This is fine normally, except if we're showing UI from one security | 1982 // This is fine normally, except if we're showing UI from one security |
| 2009 // context and they're trying to navigate to a different context. | 1983 // context and they're trying to navigate to a different context. |
| 2010 const GURL& url = request.url(); | 1984 const GURL& url = request.url(); |
| 2011 | 1985 |
| 2012 // A content initiated navigation may have originated from a link-click, | 1986 // A content initiated navigation may have originated from a link-click, |
| 2013 // script, drag-n-drop operation, etc. | 1987 // script, drag-n-drop operation, etc. |
| 2014 bool is_content_initiated = | 1988 bool is_content_initiated = |
| 2015 NavigationState::FromDataSource(frame->provisionalDataSource())-> | 1989 DocumentState::FromDataSource(frame->provisionalDataSource())-> |
| 2016 is_content_initiated(); | 1990 navigation_state()->is_content_initiated(); |
| 2017 | 1991 |
| 2018 // Experimental: | 1992 // Experimental: |
| 2019 // If --enable-strict-site-isolation is enabled, send all top-level | 1993 // If --enable-strict-site-isolation is enabled, send all top-level |
| 2020 // navigations to the browser to let it swap processes when crossing site | 1994 // navigations to the browser to let it swap processes when crossing site |
| 2021 // boundaries. This is currently expected to break some script calls and | 1995 // boundaries. This is currently expected to break some script calls and |
| 2022 // navigations, such as form submissions. | 1996 // navigations, such as form submissions. |
| 2023 const CommandLine& command_line = *CommandLine::ForCurrentProcess(); | 1997 const CommandLine& command_line = *CommandLine::ForCurrentProcess(); |
| 2024 if (!frame->parent() && (is_content_initiated || is_redirect) && | 1998 if (!frame->parent() && (is_content_initiated || is_redirect) && |
| 2025 command_line.HasSwitch(switches::kEnableStrictSiteIsolation)) { | 1999 command_line.HasSwitch(switches::kEnableStrictSiteIsolation)) { |
| 2026 GURL referrer(request.httpHeaderField(WebString::fromUTF8("Referer"))); | 2000 GURL referrer(request.httpHeaderField(WebString::fromUTF8("Referer"))); |
| (...skipping 158 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2185 WebFrame*, const WebURLError&) { | 2159 WebFrame*, const WebURLError&) { |
| 2186 NOTREACHED(); // Since we said we can handle all requests. | 2160 NOTREACHED(); // Since we said we can handle all requests. |
| 2187 } | 2161 } |
| 2188 | 2162 |
| 2189 void RenderViewImpl::willSendSubmitEvent(WebKit::WebFrame* frame, | 2163 void RenderViewImpl::willSendSubmitEvent(WebKit::WebFrame* frame, |
| 2190 const WebKit::WebFormElement& form) { | 2164 const WebKit::WebFormElement& form) { |
| 2191 // Some login forms have onSubmit handlers that put a hash of the password | 2165 // Some login forms have onSubmit handlers that put a hash of the password |
| 2192 // into a hidden field and then clear the password. (Issue 28910.) | 2166 // into a hidden field and then clear the password. (Issue 28910.) |
| 2193 // This method gets called before any of those handlers run, so save away | 2167 // This method gets called before any of those handlers run, so save away |
| 2194 // a copy of the password in case it gets lost. | 2168 // a copy of the password in case it gets lost. |
| 2195 NavigationState* navigation_state = | 2169 DocumentState* document_state = |
| 2196 NavigationState::FromDataSource(frame->dataSource()); | 2170 DocumentState::FromDataSource(frame->dataSource()); |
| 2197 navigation_state->set_password_form_data( | 2171 document_state->set_password_form_data( |
| 2198 PasswordFormDomManager::CreatePasswordForm(form)); | 2172 PasswordFormDomManager::CreatePasswordForm(form)); |
| 2199 } | 2173 } |
| 2200 | 2174 |
| 2201 void RenderViewImpl::willSubmitForm(WebFrame* frame, | 2175 void RenderViewImpl::willSubmitForm(WebFrame* frame, |
| 2202 const WebFormElement& form) { | 2176 const WebFormElement& form) { |
| 2203 NavigationState* navigation_state = | 2177 DocumentState* document_state = |
| 2204 NavigationState::FromDataSource(frame->provisionalDataSource()); | 2178 DocumentState::FromDataSource(frame->provisionalDataSource()); |
| 2179 NavigationState* navigation_state = document_state->navigation_state(); |
| 2205 | 2180 |
| 2206 if (navigation_state->transition_type() == content::PAGE_TRANSITION_LINK) | 2181 if (navigation_state->transition_type() == content::PAGE_TRANSITION_LINK) |
| 2207 navigation_state->set_transition_type(content::PAGE_TRANSITION_FORM_SUBMIT); | 2182 navigation_state->set_transition_type(content::PAGE_TRANSITION_FORM_SUBMIT); |
| 2208 | 2183 |
| 2209 // Save these to be processed when the ensuing navigation is committed. | 2184 // Save these to be processed when the ensuing navigation is committed. |
| 2210 WebSearchableFormData web_searchable_form_data(form); | 2185 WebSearchableFormData web_searchable_form_data(form); |
| 2211 navigation_state->set_searchable_form_url(web_searchable_form_data.url()); | 2186 document_state->set_searchable_form_url(web_searchable_form_data.url()); |
| 2212 navigation_state->set_searchable_form_encoding( | 2187 document_state->set_searchable_form_encoding( |
| 2213 web_searchable_form_data.encoding().utf8()); | 2188 web_searchable_form_data.encoding().utf8()); |
| 2214 PasswordForm* password_form_data = | 2189 PasswordForm* password_form_data = |
| 2215 PasswordFormDomManager::CreatePasswordForm(form); | 2190 PasswordFormDomManager::CreatePasswordForm(form); |
| 2216 navigation_state->set_password_form_data(password_form_data); | 2191 document_state->set_password_form_data(password_form_data); |
| 2217 | 2192 |
| 2218 // In order to save the password that the user actually typed and not one | 2193 // In order to save the password that the user actually typed and not one |
| 2219 // that may have gotten transformed by the site prior to submit, recover it | 2194 // that may have gotten transformed by the site prior to submit, recover it |
| 2220 // from the form contents already stored by |willSendSubmitEvent| into the | 2195 // from the form contents already stored by |willSendSubmitEvent| into the |
| 2221 // dataSource's NavigationState (as opposed to the provisionalDataSource's, | 2196 // dataSource's NavigationState (as opposed to the provisionalDataSource's, |
| 2222 // which is what we're storing into now.) | 2197 // which is what we're storing into now.) |
| 2223 if (password_form_data) { | 2198 if (password_form_data) { |
| 2224 NavigationState* old_navigation_state = | 2199 DocumentState* old_document_state = |
| 2225 NavigationState::FromDataSource(frame->dataSource()); | 2200 DocumentState::FromDataSource(frame->dataSource()); |
| 2226 if (old_navigation_state) { | 2201 if (old_document_state) { |
| 2227 PasswordForm* old_form_data = old_navigation_state->password_form_data(); | 2202 PasswordForm* old_form_data = old_document_state->password_form_data(); |
| 2228 if (old_form_data && old_form_data->action == password_form_data->action) | 2203 if (old_form_data && old_form_data->action == password_form_data->action) |
| 2229 password_form_data->password_value = old_form_data->password_value; | 2204 password_form_data->password_value = old_form_data->password_value; |
| 2230 } | 2205 } |
| 2231 } | 2206 } |
| 2232 | 2207 |
| 2233 FOR_EACH_OBSERVER( | 2208 FOR_EACH_OBSERVER( |
| 2234 RenderViewObserver, observers_, WillSubmitForm(frame, form)); | 2209 RenderViewObserver, observers_, WillSubmitForm(frame, form)); |
| 2235 } | 2210 } |
| 2236 | 2211 |
| 2237 void RenderViewImpl::willPerformClientRedirect( | 2212 void RenderViewImpl::willPerformClientRedirect( |
| (...skipping 11 matching lines...) Expand all Loading... |
| 2249 | 2224 |
| 2250 void RenderViewImpl::didCompleteClientRedirect( | 2225 void RenderViewImpl::didCompleteClientRedirect( |
| 2251 WebFrame* frame, const WebURL& from) { | 2226 WebFrame* frame, const WebURL& from) { |
| 2252 if (!frame->parent()) | 2227 if (!frame->parent()) |
| 2253 completed_client_redirect_src_ = from; | 2228 completed_client_redirect_src_ = from; |
| 2254 FOR_EACH_OBSERVER( | 2229 FOR_EACH_OBSERVER( |
| 2255 RenderViewObserver, observers_, DidCompleteClientRedirect(frame, from)); | 2230 RenderViewObserver, observers_, DidCompleteClientRedirect(frame, from)); |
| 2256 } | 2231 } |
| 2257 | 2232 |
| 2258 void RenderViewImpl::didCreateDataSource(WebFrame* frame, WebDataSource* ds) { | 2233 void RenderViewImpl::didCreateDataSource(WebFrame* frame, WebDataSource* ds) { |
| 2234 DocumentState* document_state = DocumentState::FromDataSource(ds); |
| 2235 if (!document_state) { |
| 2236 document_state = new DocumentState; |
| 2237 ds->setExtraData(document_state); |
| 2238 } |
| 2239 |
| 2259 // The rest of RenderView assumes that a WebDataSource will always have a | 2240 // The rest of RenderView assumes that a WebDataSource will always have a |
| 2260 // non-null NavigationState. | 2241 // non-null NavigationState. |
| 2261 bool content_initiated = !pending_navigation_state_.get(); | 2242 bool content_initiated = !pending_navigation_params_.get(); |
| 2262 NavigationState* state = content_initiated ? | 2243 if (content_initiated) |
| 2263 NavigationState::CreateContentInitiated() : | 2244 document_state->set_navigation_state( |
| 2264 pending_navigation_state_.release(); | 2245 NavigationState::CreateContentInitiated()); |
| 2246 else |
| 2247 PopulateStateFromPendingNavigationParams(document_state); |
| 2265 | 2248 |
| 2266 // NavigationState::referred_by_prefetcher_ is true if we are | 2249 // DocumentState::referred_by_prefetcher_ is true if we are |
| 2267 // navigating from a page that used prefetching using a link on that | 2250 // navigating from a page that used prefetching using a link on that |
| 2268 // page. We are early enough in the request process here that we | 2251 // page. We are early enough in the request process here that we |
| 2269 // can still see the NavigationState of the previous page and set | 2252 // can still see the DocumentState of the previous page and set |
| 2270 // this value appropriately. | 2253 // this value appropriately. |
| 2271 // TODO(gavinp): catch the important case of navigation in a new | 2254 // TODO(gavinp): catch the important case of navigation in a new |
| 2272 // renderer process. | 2255 // renderer process. |
| 2273 if (webview()) { | 2256 if (webview()) { |
| 2274 if (WebFrame* old_frame = webview()->mainFrame()) { | 2257 if (WebFrame* old_frame = webview()->mainFrame()) { |
| 2275 const WebURLRequest& original_request = ds->originalRequest(); | 2258 const WebURLRequest& original_request = ds->originalRequest(); |
| 2276 const GURL referrer( | 2259 const GURL referrer( |
| 2277 original_request.httpHeaderField(WebString::fromUTF8("Referer"))); | 2260 original_request.httpHeaderField(WebString::fromUTF8("Referer"))); |
| 2278 if (!referrer.is_empty() && | 2261 if (!referrer.is_empty() && |
| 2279 NavigationState::FromDataSource( | 2262 DocumentState::FromDataSource( |
| 2280 old_frame->dataSource())->was_prefetcher()) { | 2263 old_frame->dataSource())->was_prefetcher()) { |
| 2281 for (;old_frame;old_frame = old_frame->traverseNext(false)) { | 2264 for (;old_frame;old_frame = old_frame->traverseNext(false)) { |
| 2282 WebDataSource* old_frame_ds = old_frame->dataSource(); | 2265 WebDataSource* old_frame_ds = old_frame->dataSource(); |
| 2283 if (old_frame_ds && referrer == GURL(old_frame_ds->request().url())) { | 2266 if (old_frame_ds && referrer == GURL(old_frame_ds->request().url())) { |
| 2284 state->set_was_referred_by_prefetcher(true); | 2267 document_state->set_was_referred_by_prefetcher(true); |
| 2285 break; | 2268 break; |
| 2286 } | 2269 } |
| 2287 } | 2270 } |
| 2288 } | 2271 } |
| 2289 } | 2272 } |
| 2290 } | 2273 } |
| 2291 | 2274 |
| 2292 if (content_initiated) { | 2275 if (content_initiated) { |
| 2293 const WebURLRequest& request = ds->request(); | 2276 const WebURLRequest& request = ds->request(); |
| 2294 switch (request.cachePolicy()) { | 2277 switch (request.cachePolicy()) { |
| 2295 case WebURLRequest::UseProtocolCachePolicy: // normal load. | 2278 case WebURLRequest::UseProtocolCachePolicy: // normal load. |
| 2296 state->set_load_type(NavigationState::LINK_LOAD_NORMAL); | 2279 document_state->set_load_type(DocumentState::LINK_LOAD_NORMAL); |
| 2297 break; | 2280 break; |
| 2298 case WebURLRequest::ReloadIgnoringCacheData: // reload. | 2281 case WebURLRequest::ReloadIgnoringCacheData: // reload. |
| 2299 state->set_load_type(NavigationState::LINK_LOAD_RELOAD); | 2282 document_state->set_load_type(DocumentState::LINK_LOAD_RELOAD); |
| 2300 break; | 2283 break; |
| 2301 case WebURLRequest::ReturnCacheDataElseLoad: // allow stale data. | 2284 case WebURLRequest::ReturnCacheDataElseLoad: // allow stale data. |
| 2302 state->set_load_type(NavigationState::LINK_LOAD_CACHE_STALE_OK); | 2285 document_state->set_load_type( |
| 2286 DocumentState::LINK_LOAD_CACHE_STALE_OK); |
| 2303 break; | 2287 break; |
| 2304 case WebURLRequest::ReturnCacheDataDontLoad: // Don't re-post. | 2288 case WebURLRequest::ReturnCacheDataDontLoad: // Don't re-post. |
| 2305 state->set_load_type(NavigationState::LINK_LOAD_CACHE_ONLY); | 2289 document_state->set_load_type(DocumentState::LINK_LOAD_CACHE_ONLY); |
| 2306 break; | 2290 break; |
| 2307 } | 2291 } |
| 2308 } | 2292 } |
| 2309 | 2293 |
| 2310 ds->setExtraData(state); | |
| 2311 | |
| 2312 FOR_EACH_OBSERVER( | 2294 FOR_EACH_OBSERVER( |
| 2313 RenderViewObserver, observers_, DidCreateDataSource(frame, ds)); | 2295 RenderViewObserver, observers_, DidCreateDataSource(frame, ds)); |
| 2314 } | 2296 } |
| 2315 | 2297 |
| 2298 void RenderViewImpl::PopulateStateFromPendingNavigationParams( |
| 2299 DocumentState* document_state) { |
| 2300 const ViewMsg_Navigate_Params& params = *pending_navigation_params_.get(); |
| 2301 |
| 2302 if (document_state->request_time().is_null()) |
| 2303 document_state->set_request_time(params.request_time); |
| 2304 |
| 2305 // A navigation resulting from loading a javascript URL should not be treated |
| 2306 // as a browser initiated event. Instead, we want it to look as if the page |
| 2307 // initiated any load resulting from JS execution. |
| 2308 if (!params.url.SchemeIs(chrome::kJavaScriptScheme)) { |
| 2309 NavigationState* navigation_state = NavigationState::CreateBrowserInitiated( |
| 2310 params.page_id, |
| 2311 params.pending_history_list_offset, |
| 2312 params.transition); |
| 2313 if (params.navigation_type == ViewMsg_Navigate_Type::RESTORE) { |
| 2314 // We're doing a load of a page that was restored from the last session. |
| 2315 // By default this prefers the cache over loading (LOAD_PREFERRING_CACHE) |
| 2316 // which can result in stale data for pages that are set to expire. We |
| 2317 // explicitly override that by setting the policy here so that as |
| 2318 // necessary we load from the network. |
| 2319 document_state->set_cache_policy_override( |
| 2320 WebURLRequest::UseProtocolCachePolicy); |
| 2321 } |
| 2322 document_state->set_navigation_state(navigation_state); |
| 2323 } else { |
| 2324 document_state->set_navigation_state( |
| 2325 NavigationState::CreateContentInitiated()); |
| 2326 } |
| 2327 |
| 2328 if (IsReload(params)) |
| 2329 document_state->set_load_type(DocumentState::RELOAD); |
| 2330 else if (!params.state.empty()) |
| 2331 document_state->set_load_type(DocumentState::HISTORY_LOAD); |
| 2332 else |
| 2333 document_state->set_load_type(DocumentState::NORMAL_LOAD); |
| 2334 |
| 2335 pending_navigation_params_.reset(); |
| 2336 } |
| 2337 |
| 2316 void RenderViewImpl::didStartProvisionalLoad(WebFrame* frame) { | 2338 void RenderViewImpl::didStartProvisionalLoad(WebFrame* frame) { |
| 2317 WebDataSource* ds = frame->provisionalDataSource(); | 2339 WebDataSource* ds = frame->provisionalDataSource(); |
| 2318 NavigationState* navigation_state = NavigationState::FromDataSource(ds); | 2340 DocumentState* document_state = DocumentState::FromDataSource(ds); |
| 2319 | 2341 |
| 2320 // Update the request time if WebKit has better knowledge of it. | 2342 // Update the request time if WebKit has better knowledge of it. |
| 2321 if (navigation_state->request_time().is_null()) { | 2343 if (document_state->request_time().is_null()) { |
| 2322 double event_time = ds->triggeringEventTime(); | 2344 double event_time = ds->triggeringEventTime(); |
| 2323 if (event_time != 0.0) | 2345 if (event_time != 0.0) |
| 2324 navigation_state->set_request_time(Time::FromDoubleT(event_time)); | 2346 document_state->set_request_time(Time::FromDoubleT(event_time)); |
| 2325 } | 2347 } |
| 2326 | 2348 |
| 2327 // Start time is only set after request time. | 2349 // Start time is only set after request time. |
| 2328 navigation_state->set_start_load_time(Time::Now()); | 2350 document_state->set_start_load_time(Time::Now()); |
| 2329 | 2351 |
| 2330 bool is_top_most = !frame->parent(); | 2352 bool is_top_most = !frame->parent(); |
| 2331 if (is_top_most) { | 2353 if (is_top_most) { |
| 2332 navigation_gesture_ = frame->isProcessingUserGesture() ? | 2354 navigation_gesture_ = frame->isProcessingUserGesture() ? |
| 2333 NavigationGestureUser : NavigationGestureAuto; | 2355 NavigationGestureUser : NavigationGestureAuto; |
| 2334 | 2356 |
| 2335 // Make sure redirect tracking state is clear for the new load. | 2357 // Make sure redirect tracking state is clear for the new load. |
| 2336 completed_client_redirect_src_ = GURL(); | 2358 completed_client_redirect_src_ = GURL(); |
| 2337 } else if (frame->parent()->isLoading()) { | 2359 } else if (frame->parent()->isLoading()) { |
| 2338 // Take note of AUTO_SUBFRAME loads here, so that we can know how to | 2360 // Take note of AUTO_SUBFRAME loads here, so that we can know how to |
| 2339 // load an error page. See didFailProvisionalLoad. | 2361 // load an error page. See didFailProvisionalLoad. |
| 2340 navigation_state->set_transition_type( | 2362 document_state->navigation_state()->set_transition_type( |
| 2341 content::PAGE_TRANSITION_AUTO_SUBFRAME); | 2363 content::PAGE_TRANSITION_AUTO_SUBFRAME); |
| 2342 } | 2364 } |
| 2343 | 2365 |
| 2344 FOR_EACH_OBSERVER( | 2366 FOR_EACH_OBSERVER( |
| 2345 RenderViewObserver, observers_, DidStartProvisionalLoad(frame)); | 2367 RenderViewObserver, observers_, DidStartProvisionalLoad(frame)); |
| 2346 | 2368 |
| 2347 Send(new ViewHostMsg_DidStartProvisionalLoadForFrame( | 2369 Send(new ViewHostMsg_DidStartProvisionalLoadForFrame( |
| 2348 routing_id_, frame->identifier(), is_top_most, GetOpenerUrl(), | 2370 routing_id_, frame->identifier(), is_top_most, GetOpenerUrl(), |
| 2349 ds->request().url())); | 2371 ds->request().url())); |
| 2350 } | 2372 } |
| (...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2403 routing_id_, params)); | 2425 routing_id_, params)); |
| 2404 | 2426 |
| 2405 // Don't display an error page if this is simply a cancelled load. Aside | 2427 // Don't display an error page if this is simply a cancelled load. Aside |
| 2406 // from being dumb, WebCore doesn't expect it and it will cause a crash. | 2428 // from being dumb, WebCore doesn't expect it and it will cause a crash. |
| 2407 if (error.reason == net::ERR_ABORTED) | 2429 if (error.reason == net::ERR_ABORTED) |
| 2408 return; | 2430 return; |
| 2409 | 2431 |
| 2410 // Make sure we never show errors in view source mode. | 2432 // Make sure we never show errors in view source mode. |
| 2411 frame->enableViewSourceMode(false); | 2433 frame->enableViewSourceMode(false); |
| 2412 | 2434 |
| 2413 NavigationState* navigation_state = NavigationState::FromDataSource(ds); | 2435 DocumentState* document_state = DocumentState::FromDataSource(ds); |
| 2436 NavigationState* navigation_state = document_state->navigation_state(); |
| 2414 | 2437 |
| 2415 // If this is a failed back/forward/reload navigation, then we need to do a | 2438 // If this is a failed back/forward/reload navigation, then we need to do a |
| 2416 // 'replace' load. This is necessary to avoid messing up session history. | 2439 // 'replace' load. This is necessary to avoid messing up session history. |
| 2417 // Otherwise, we do a normal load, which simulates a 'go' navigation as far | 2440 // Otherwise, we do a normal load, which simulates a 'go' navigation as far |
| 2418 // as session history is concerned. | 2441 // as session history is concerned. |
| 2419 // | 2442 // |
| 2420 // AUTO_SUBFRAME loads should always be treated as loads that do not advance | 2443 // AUTO_SUBFRAME loads should always be treated as loads that do not advance |
| 2421 // the page id. | 2444 // the page id. |
| 2422 // | 2445 // |
| 2423 bool replace = | 2446 bool replace = |
| 2424 navigation_state->pending_page_id() != -1 || | 2447 navigation_state->pending_page_id() != -1 || |
| 2425 navigation_state->transition_type() == | 2448 navigation_state->transition_type() == |
| 2426 content::PAGE_TRANSITION_AUTO_SUBFRAME; | 2449 content::PAGE_TRANSITION_AUTO_SUBFRAME; |
| 2427 | 2450 |
| 2428 // If we failed on a browser initiated request, then make sure that our error | 2451 // If we failed on a browser initiated request, then make sure that our error |
| 2429 // page load is regarded as the same browser initiated request. | 2452 // page load is regarded as the same browser initiated request. |
| 2430 if (!navigation_state->is_content_initiated()) { | 2453 if (!navigation_state->is_content_initiated()) { |
| 2431 pending_navigation_state_.reset(NavigationState::CreateBrowserInitiated( | 2454 pending_navigation_params_.reset(new ViewMsg_Navigate_Params); |
| 2432 navigation_state->pending_page_id(), | 2455 pending_navigation_params_->page_id = |
| 2433 navigation_state->pending_history_list_offset(), | 2456 navigation_state->pending_page_id(); |
| 2434 navigation_state->transition_type(), | 2457 pending_navigation_params_->pending_history_list_offset = |
| 2435 navigation_state->request_time())); | 2458 navigation_state->pending_history_list_offset(); |
| 2459 pending_navigation_params_->transition = |
| 2460 navigation_state->transition_type(); |
| 2461 pending_navigation_params_->request_time = |
| 2462 document_state->request_time(); |
| 2436 } | 2463 } |
| 2437 | 2464 |
| 2438 // Provide the user with a more helpful error page? | 2465 // Provide the user with a more helpful error page? |
| 2439 if (MaybeLoadAlternateErrorPage(frame, error, replace)) | 2466 if (MaybeLoadAlternateErrorPage(frame, error, replace)) |
| 2440 return; | 2467 return; |
| 2441 | 2468 |
| 2442 // Fallback to a local error page. | 2469 // Fallback to a local error page. |
| 2443 LoadNavigationErrorPage(frame, failed_request, error, std::string(), replace); | 2470 LoadNavigationErrorPage(frame, failed_request, error, std::string(), replace); |
| 2444 } | 2471 } |
| 2445 | 2472 |
| 2446 void RenderViewImpl::didReceiveDocumentData( | 2473 void RenderViewImpl::didReceiveDocumentData( |
| 2447 WebFrame* frame, const char* data, size_t data_len, | 2474 WebFrame* frame, const char* data, size_t data_len, |
| 2448 bool& prevent_default) { | 2475 bool& prevent_default) { |
| 2449 NavigationState* navigation_state = | 2476 DocumentState* document_state = |
| 2450 NavigationState::FromDataSource(frame->dataSource()); | 2477 DocumentState::FromDataSource(frame->dataSource()); |
| 2451 navigation_state->set_use_error_page(false); | 2478 document_state->set_use_error_page(false); |
| 2452 } | 2479 } |
| 2453 | 2480 |
| 2454 void RenderViewImpl::didCommitProvisionalLoad(WebFrame* frame, | 2481 void RenderViewImpl::didCommitProvisionalLoad(WebFrame* frame, |
| 2455 bool is_new_navigation) { | 2482 bool is_new_navigation) { |
| 2456 NavigationState* navigation_state = | 2483 DocumentState* document_state = |
| 2457 NavigationState::FromDataSource(frame->dataSource()); | 2484 DocumentState::FromDataSource(frame->dataSource()); |
| 2485 NavigationState* navigation_state = document_state->navigation_state(); |
| 2458 | 2486 |
| 2459 navigation_state->set_commit_load_time(Time::Now()); | 2487 if (document_state->commit_load_time().is_null()) |
| 2488 document_state->set_commit_load_time(Time::Now()); |
| 2489 |
| 2460 if (is_new_navigation) { | 2490 if (is_new_navigation) { |
| 2461 // When we perform a new navigation, we need to update the last committed | 2491 // When we perform a new navigation, we need to update the last committed |
| 2462 // session history entry with state for the page we are leaving. | 2492 // session history entry with state for the page we are leaving. |
| 2463 UpdateSessionHistory(frame); | 2493 UpdateSessionHistory(frame); |
| 2464 | 2494 |
| 2465 // We bump our Page ID to correspond with the new session history entry. | 2495 // We bump our Page ID to correspond with the new session history entry. |
| 2466 page_id_ = next_page_id_++; | 2496 page_id_ = next_page_id_++; |
| 2467 | 2497 |
| 2468 // Advance our offset in session history, applying the length limit. There | 2498 // Advance our offset in session history, applying the length limit. There |
| 2469 // is now no forward history. | 2499 // is now no forward history. |
| (...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2553 UpdateEncoding(frame, frame->view()->pageEncoding().utf8()); | 2583 UpdateEncoding(frame, frame->view()->pageEncoding().utf8()); |
| 2554 } | 2584 } |
| 2555 | 2585 |
| 2556 void RenderViewImpl::didChangeIcon(WebFrame* frame, WebIconURL::Type type) { | 2586 void RenderViewImpl::didChangeIcon(WebFrame* frame, WebIconURL::Type type) { |
| 2557 FOR_EACH_OBSERVER(RenderViewObserver, observers_, | 2587 FOR_EACH_OBSERVER(RenderViewObserver, observers_, |
| 2558 DidChangeIcon(frame, type)); | 2588 DidChangeIcon(frame, type)); |
| 2559 } | 2589 } |
| 2560 | 2590 |
| 2561 void RenderViewImpl::didFinishDocumentLoad(WebFrame* frame) { | 2591 void RenderViewImpl::didFinishDocumentLoad(WebFrame* frame) { |
| 2562 WebDataSource* ds = frame->dataSource(); | 2592 WebDataSource* ds = frame->dataSource(); |
| 2563 NavigationState* navigation_state = NavigationState::FromDataSource(ds); | 2593 DocumentState* document_state = DocumentState::FromDataSource(ds); |
| 2564 DCHECK(navigation_state); | 2594 document_state->set_finish_document_load_time(Time::Now()); |
| 2565 navigation_state->set_finish_document_load_time(Time::Now()); | |
| 2566 | 2595 |
| 2567 Send(new ViewHostMsg_DocumentLoadedInFrame(routing_id_, frame->identifier())); | 2596 Send(new ViewHostMsg_DocumentLoadedInFrame(routing_id_, frame->identifier())); |
| 2568 | 2597 |
| 2569 FOR_EACH_OBSERVER(RenderViewObserver, observers_, | 2598 FOR_EACH_OBSERVER(RenderViewObserver, observers_, |
| 2570 DidFinishDocumentLoad(frame)); | 2599 DidFinishDocumentLoad(frame)); |
| 2571 | 2600 |
| 2572 // Check whether we have new encoding name. | 2601 // Check whether we have new encoding name. |
| 2573 UpdateEncoding(frame, frame->view()->pageEncoding().utf8()); | 2602 UpdateEncoding(frame, frame->view()->pageEncoding().utf8()); |
| 2574 } | 2603 } |
| 2575 | 2604 |
| 2576 void RenderViewImpl::didHandleOnloadEvents(WebFrame* frame) { | 2605 void RenderViewImpl::didHandleOnloadEvents(WebFrame* frame) { |
| 2577 if (webview()->mainFrame() == frame) { | 2606 if (webview()->mainFrame() == frame) { |
| 2578 Send(new ViewHostMsg_DocumentOnLoadCompletedInMainFrame(routing_id_, | 2607 Send(new ViewHostMsg_DocumentOnLoadCompletedInMainFrame(routing_id_, |
| 2579 page_id_)); | 2608 page_id_)); |
| 2580 } | 2609 } |
| 2581 } | 2610 } |
| 2582 | 2611 |
| 2583 void RenderViewImpl::didFailLoad(WebFrame* frame, const WebURLError& error) { | 2612 void RenderViewImpl::didFailLoad(WebFrame* frame, const WebURLError& error) { |
| 2584 FOR_EACH_OBSERVER(RenderViewObserver, observers_, DidFailLoad(frame, error)); | 2613 FOR_EACH_OBSERVER(RenderViewObserver, observers_, DidFailLoad(frame, error)); |
| 2585 } | 2614 } |
| 2586 | 2615 |
| 2587 void RenderViewImpl::didFinishLoad(WebFrame* frame) { | 2616 void RenderViewImpl::didFinishLoad(WebFrame* frame) { |
| 2588 WebDataSource* ds = frame->dataSource(); | 2617 WebDataSource* ds = frame->dataSource(); |
| 2589 NavigationState* navigation_state = NavigationState::FromDataSource(ds); | 2618 DocumentState* document_state = DocumentState::FromDataSource(ds); |
| 2590 DCHECK(navigation_state); | 2619 if (document_state->finish_load_time().is_null()) |
| 2591 navigation_state->set_finish_load_time(Time::Now()); | 2620 document_state->set_finish_load_time(Time::Now()); |
| 2592 | 2621 |
| 2593 FOR_EACH_OBSERVER(RenderViewObserver, observers_, DidFinishLoad(frame)); | 2622 FOR_EACH_OBSERVER(RenderViewObserver, observers_, DidFinishLoad(frame)); |
| 2594 | 2623 |
| 2595 Send(new ViewHostMsg_DidFinishLoad(routing_id_, frame->identifier())); | 2624 Send(new ViewHostMsg_DidFinishLoad(routing_id_, frame->identifier())); |
| 2596 } | 2625 } |
| 2597 | 2626 |
| 2598 void RenderViewImpl::didNavigateWithinPage( | 2627 void RenderViewImpl::didNavigateWithinPage( |
| 2599 WebFrame* frame, bool is_new_navigation) { | 2628 WebFrame* frame, bool is_new_navigation) { |
| 2600 // If this was a reference fragment navigation that we initiated, then we | 2629 // If this was a reference fragment navigation that we initiated, then we |
| 2601 // could end up having a non-null pending navigation state. We just need to | 2630 // could end up having a non-null pending navigation params. We just need to |
| 2602 // update the ExtraData on the datasource so that others who read the | 2631 // update the ExtraData on the datasource so that others who read the |
| 2603 // ExtraData will get the new NavigationState. Similarly, if we did not | 2632 // ExtraData will get the new NavigationState. Similarly, if we did not |
| 2604 // initiate this navigation, then we need to take care to reset any pre- | 2633 // initiate this navigation, then we need to take care to reset any pre- |
| 2605 // existing navigation state to a content-initiated navigation state. | 2634 // existing navigation state to a content-initiated navigation state. |
| 2606 // DidCreateDataSource conveniently takes care of this for us. | 2635 // DidCreateDataSource conveniently takes care of this for us. |
| 2607 didCreateDataSource(frame, frame->dataSource()); | 2636 didCreateDataSource(frame, frame->dataSource()); |
| 2608 | 2637 |
| 2609 NavigationState* new_state = | 2638 DocumentState* document_state = |
| 2610 NavigationState::FromDataSource(frame->dataSource()); | 2639 DocumentState::FromDataSource(frame->dataSource()); |
| 2640 NavigationState* new_state = document_state->navigation_state(); |
| 2611 new_state->set_was_within_same_page(true); | 2641 new_state->set_was_within_same_page(true); |
| 2612 | 2642 |
| 2613 didCommitProvisionalLoad(frame, is_new_navigation); | 2643 didCommitProvisionalLoad(frame, is_new_navigation); |
| 2614 | 2644 |
| 2615 WebDataSource* datasource = frame->view()->mainFrame()->dataSource(); | 2645 WebDataSource* datasource = frame->view()->mainFrame()->dataSource(); |
| 2616 UpdateTitle(frame, datasource->pageTitle(), datasource->pageTitleDirection()); | 2646 UpdateTitle(frame, datasource->pageTitle(), datasource->pageTitleDirection()); |
| 2617 } | 2647 } |
| 2618 | 2648 |
| 2619 void RenderViewImpl::didUpdateCurrentHistoryItem(WebFrame* frame) { | 2649 void RenderViewImpl::didUpdateCurrentHistoryItem(WebFrame* frame) { |
| 2620 StartNavStateSyncTimerIfNecessary(); | 2650 StartNavStateSyncTimerIfNecessary(); |
| (...skipping 17 matching lines...) Expand all Loading... |
| 2638 provisional_data_source ? provisional_data_source : top_data_source; | 2668 provisional_data_source ? provisional_data_source : top_data_source; |
| 2639 | 2669 |
| 2640 GURL request_url(request.url()); | 2670 GURL request_url(request.url()); |
| 2641 GURL new_url; | 2671 GURL new_url; |
| 2642 if (content::GetContentClient()->renderer()->WillSendRequest( | 2672 if (content::GetContentClient()->renderer()->WillSendRequest( |
| 2643 frame, request_url, &new_url)) { | 2673 frame, request_url, &new_url)) { |
| 2644 request.setURL(WebURL(new_url)); | 2674 request.setURL(WebURL(new_url)); |
| 2645 } | 2675 } |
| 2646 | 2676 |
| 2647 content::PageTransition transition_type = content::PAGE_TRANSITION_LINK; | 2677 content::PageTransition transition_type = content::PAGE_TRANSITION_LINK; |
| 2648 NavigationState* data_state = NavigationState::FromDataSource(data_source); | 2678 DocumentState* document_state = DocumentState::FromDataSource(data_source); |
| 2649 if (data_state) { | 2679 NavigationState* navigation_state = document_state->navigation_state(); |
| 2650 if (data_state->is_cache_policy_override_set()) | 2680 if (document_state) { |
| 2651 request.setCachePolicy(data_state->cache_policy_override()); | 2681 if (document_state->is_cache_policy_override_set()) |
| 2652 transition_type = data_state->transition_type(); | 2682 request.setCachePolicy(document_state->cache_policy_override()); |
| 2683 transition_type = navigation_state->transition_type(); |
| 2653 } | 2684 } |
| 2654 | 2685 |
| 2655 request.setExtraData( | 2686 request.setExtraData( |
| 2656 new RequestExtraData((frame == top_frame), | 2687 new RequestExtraData((frame == top_frame), |
| 2657 frame->identifier(), | 2688 frame->identifier(), |
| 2658 frame->parent() == top_frame, | 2689 frame->parent() == top_frame, |
| 2659 frame->parent() ? frame->parent()->identifier() : -1, | 2690 frame->parent() ? frame->parent()->identifier() : -1, |
| 2660 transition_type)); | 2691 transition_type)); |
| 2661 | 2692 |
| 2662 NavigationState* top_data_state = | 2693 DocumentState* top_document_state = |
| 2663 NavigationState::FromDataSource(top_data_source); | 2694 DocumentState::FromDataSource(top_data_source); |
| 2664 // TODO(gavinp): separate out prefetching and prerender field trials | 2695 // TODO(gavinp): separate out prefetching and prerender field trials |
| 2665 // if the rel=prerender rel type is sticking around. | 2696 // if the rel=prerender rel type is sticking around. |
| 2666 if (top_data_state && | 2697 if (top_document_state && |
| 2667 (request.targetType() == WebURLRequest::TargetIsPrefetch || | 2698 (request.targetType() == WebURLRequest::TargetIsPrefetch || |
| 2668 request.targetType() == WebURLRequest::TargetIsPrerender)) | 2699 request.targetType() == WebURLRequest::TargetIsPrerender)) |
| 2669 top_data_state->set_was_prefetcher(true); | 2700 top_document_state->set_was_prefetcher(true); |
| 2670 | 2701 |
| 2671 request.setRequestorID(routing_id_); | 2702 request.setRequestorID(routing_id_); |
| 2672 request.setHasUserGesture(frame->isProcessingUserGesture()); | 2703 request.setHasUserGesture(frame->isProcessingUserGesture()); |
| 2673 | 2704 |
| 2674 if (!renderer_preferences_.enable_referrers) | 2705 if (!renderer_preferences_.enable_referrers) |
| 2675 request.clearHTTPHeaderField("Referer"); | 2706 request.clearHTTPHeaderField("Referer"); |
| 2676 } | 2707 } |
| 2677 | 2708 |
| 2678 void RenderViewImpl::didReceiveResponse( | 2709 void RenderViewImpl::didReceiveResponse( |
| 2679 WebFrame* frame, unsigned identifier, const WebURLResponse& response) { | 2710 WebFrame* frame, unsigned identifier, const WebURLResponse& response) { |
| 2680 | 2711 |
| 2681 // Only do this for responses that correspond to a provisional data source | 2712 // Only do this for responses that correspond to a provisional data source |
| 2682 // of the top-most frame. If we have a provisional data source, then we | 2713 // of the top-most frame. If we have a provisional data source, then we |
| 2683 // can't have any sub-resources yet, so we know that this response must | 2714 // can't have any sub-resources yet, so we know that this response must |
| 2684 // correspond to a frame load. | 2715 // correspond to a frame load. |
| 2685 if (!frame->provisionalDataSource() || frame->parent()) | 2716 if (!frame->provisionalDataSource() || frame->parent()) |
| 2686 return; | 2717 return; |
| 2687 | 2718 |
| 2688 // If we are in view source mode, then just let the user see the source of | 2719 // If we are in view source mode, then just let the user see the source of |
| 2689 // the server's error page. | 2720 // the server's error page. |
| 2690 if (frame->isViewSourceModeEnabled()) | 2721 if (frame->isViewSourceModeEnabled()) |
| 2691 return; | 2722 return; |
| 2692 | 2723 |
| 2693 NavigationState* navigation_state = | 2724 DocumentState* document_state = |
| 2694 NavigationState::FromDataSource(frame->provisionalDataSource()); | 2725 DocumentState::FromDataSource(frame->provisionalDataSource()); |
| 2695 CHECK(navigation_state); | |
| 2696 int http_status_code = response.httpStatusCode(); | 2726 int http_status_code = response.httpStatusCode(); |
| 2697 | 2727 |
| 2698 // Record page load flags. | 2728 // Record page load flags. |
| 2699 navigation_state->set_was_fetched_via_spdy(response.wasFetchedViaSPDY()); | 2729 document_state->set_was_fetched_via_spdy(response.wasFetchedViaSPDY()); |
| 2700 navigation_state->set_was_npn_negotiated(response.wasNpnNegotiated()); | 2730 document_state->set_was_npn_negotiated(response.wasNpnNegotiated()); |
| 2701 navigation_state->set_was_alternate_protocol_available( | 2731 document_state->set_was_alternate_protocol_available( |
| 2702 response.wasAlternateProtocolAvailable()); | 2732 response.wasAlternateProtocolAvailable()); |
| 2703 navigation_state->set_was_fetched_via_proxy(response.wasFetchedViaProxy()); | 2733 document_state->set_was_fetched_via_proxy(response.wasFetchedViaProxy()); |
| 2704 navigation_state->set_http_status_code(http_status_code); | 2734 document_state->set_http_status_code(http_status_code); |
| 2705 // Whether or not the http status code actually corresponds to an error is | 2735 // Whether or not the http status code actually corresponds to an error is |
| 2706 // only checked when the page is done loading, if |use_error_page| is | 2736 // only checked when the page is done loading, if |use_error_page| is |
| 2707 // still true. | 2737 // still true. |
| 2708 navigation_state->set_use_error_page(true); | 2738 document_state->set_use_error_page(true); |
| 2709 } | 2739 } |
| 2710 | 2740 |
| 2711 void RenderViewImpl::didFinishResourceLoad( | 2741 void RenderViewImpl::didFinishResourceLoad( |
| 2712 WebFrame* frame, unsigned identifier) { | 2742 WebFrame* frame, unsigned identifier) { |
| 2713 NavigationState* navigation_state = | 2743 DocumentState* document_state = |
| 2714 NavigationState::FromDataSource(frame->dataSource()); | 2744 DocumentState::FromDataSource(frame->dataSource()); |
| 2715 if (!navigation_state->use_error_page()) | 2745 if (!document_state->use_error_page()) |
| 2716 return; | 2746 return; |
| 2717 | 2747 |
| 2718 // Do not show error page when DevTools is attached. | 2748 // Do not show error page when DevTools is attached. |
| 2719 if (devtools_agent_->IsAttached()) | 2749 if (devtools_agent_->IsAttached()) |
| 2720 return; | 2750 return; |
| 2721 | 2751 |
| 2722 // Display error page, if appropriate. | 2752 // Display error page, if appropriate. |
| 2723 int http_status_code = navigation_state->http_status_code(); | 2753 int http_status_code = document_state->http_status_code(); |
| 2724 if (http_status_code == 404) { | 2754 if (http_status_code == 404) { |
| 2725 // On 404s, try a remote search page as a fallback. | 2755 // On 404s, try a remote search page as a fallback. |
| 2726 const GURL& document_url = frame->document().url(); | 2756 const GURL& document_url = frame->document().url(); |
| 2727 | 2757 |
| 2728 const GURL& error_page_url = | 2758 const GURL& error_page_url = |
| 2729 GetAlternateErrorPageURL(document_url, HTTP_404); | 2759 GetAlternateErrorPageURL(document_url, HTTP_404); |
| 2730 if (error_page_url.is_valid()) { | 2760 if (error_page_url.is_valid()) { |
| 2731 WebURLError original_error; | 2761 WebURLError original_error; |
| 2732 original_error.domain = "http"; | 2762 original_error.domain = "http"; |
| 2733 original_error.reason = 404; | 2763 original_error.reason = 404; |
| 2734 original_error.unreachableURL = document_url; | 2764 original_error.unreachableURL = document_url; |
| 2735 | 2765 |
| 2736 navigation_state->set_alt_error_page_fetcher( | 2766 document_state->set_alt_error_page_fetcher( |
| 2737 new AltErrorPageResourceFetcher( | 2767 new AltErrorPageResourceFetcher( |
| 2738 error_page_url, frame, original_error, | 2768 error_page_url, frame, original_error, |
| 2739 NewCallback(this, &RenderViewImpl::AltErrorPageFinished))); | 2769 NewCallback(this, &RenderViewImpl::AltErrorPageFinished))); |
| 2740 return; | 2770 return; |
| 2741 } | 2771 } |
| 2742 } | 2772 } |
| 2743 | 2773 |
| 2744 std::string error_domain; | 2774 std::string error_domain; |
| 2745 if (content::GetContentClient()->renderer()->HasErrorPage( | 2775 if (content::GetContentClient()->renderer()->HasErrorPage( |
| 2746 http_status_code, &error_domain)) { | 2776 http_status_code, &error_domain)) { |
| (...skipping 1239 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3986 // Load an empty page first so there is an immediate response to the error, | 4016 // Load an empty page first so there is an immediate response to the error, |
| 3987 // and then kick off a request for the alternate error page. | 4017 // and then kick off a request for the alternate error page. |
| 3988 frame->loadHTMLString(std::string(), | 4018 frame->loadHTMLString(std::string(), |
| 3989 GURL(chrome::kUnreachableWebDataURL), | 4019 GURL(chrome::kUnreachableWebDataURL), |
| 3990 error.unreachableURL, | 4020 error.unreachableURL, |
| 3991 replace); | 4021 replace); |
| 3992 | 4022 |
| 3993 // Now, create a fetcher for the error page and associate it with the data | 4023 // Now, create a fetcher for the error page and associate it with the data |
| 3994 // source we just created via the LoadHTMLString call. That way if another | 4024 // source we just created via the LoadHTMLString call. That way if another |
| 3995 // navigation occurs, the fetcher will get destroyed. | 4025 // navigation occurs, the fetcher will get destroyed. |
| 3996 NavigationState* navigation_state = | 4026 DocumentState* document_state = |
| 3997 NavigationState::FromDataSource(frame->provisionalDataSource()); | 4027 DocumentState::FromDataSource(frame->provisionalDataSource()); |
| 3998 navigation_state->set_alt_error_page_fetcher( | 4028 document_state->set_alt_error_page_fetcher( |
| 3999 new AltErrorPageResourceFetcher( | 4029 new AltErrorPageResourceFetcher( |
| 4000 error_page_url, frame, error, | 4030 error_page_url, frame, error, |
| 4001 NewCallback(this, &RenderViewImpl::AltErrorPageFinished))); | 4031 NewCallback(this, &RenderViewImpl::AltErrorPageFinished))); |
| 4002 return true; | 4032 return true; |
| 4003 } | 4033 } |
| 4004 | 4034 |
| 4005 void RenderViewImpl::AltErrorPageFinished(WebFrame* frame, | 4035 void RenderViewImpl::AltErrorPageFinished(WebFrame* frame, |
| 4006 const WebURLError& original_error, | 4036 const WebURLError& original_error, |
| 4007 const std::string& html) { | 4037 const std::string& html) { |
| 4008 // Here, we replace the blank page we loaded previously. | 4038 // Here, we replace the blank page we loaded previously. |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4042 // our set, possibly invalidating the iterator. So we iterate on a copy that | 4072 // our set, possibly invalidating the iterator. So we iterate on a copy that |
| 4043 // won't change out from under us. | 4073 // won't change out from under us. |
| 4044 pepper_delegate_.ViewFlushedPaint(); | 4074 pepper_delegate_.ViewFlushedPaint(); |
| 4045 | 4075 |
| 4046 WebFrame* main_frame = webview()->mainFrame(); | 4076 WebFrame* main_frame = webview()->mainFrame(); |
| 4047 | 4077 |
| 4048 // If we have a provisional frame we are between the start and commit stages | 4078 // If we have a provisional frame we are between the start and commit stages |
| 4049 // of loading and we don't want to save stats. | 4079 // of loading and we don't want to save stats. |
| 4050 if (!main_frame->provisionalDataSource()) { | 4080 if (!main_frame->provisionalDataSource()) { |
| 4051 WebDataSource* ds = main_frame->dataSource(); | 4081 WebDataSource* ds = main_frame->dataSource(); |
| 4052 NavigationState* navigation_state = NavigationState::FromDataSource(ds); | 4082 DocumentState* document_state = DocumentState::FromDataSource(ds); |
| 4053 DCHECK(navigation_state); | |
| 4054 | 4083 |
| 4055 // TODO(jar): The following code should all be inside a method, probably in | 4084 // TODO(jar): The following code should all be inside a method, probably in |
| 4056 // NavigatorState. | 4085 // NavigatorState. |
| 4057 Time now = Time::Now(); | 4086 Time now = Time::Now(); |
| 4058 if (navigation_state->first_paint_time().is_null()) { | 4087 if (document_state->first_paint_time().is_null()) { |
| 4059 navigation_state->set_first_paint_time(now); | 4088 document_state->set_first_paint_time(now); |
| 4060 } | 4089 } |
| 4061 if (navigation_state->first_paint_after_load_time().is_null() && | 4090 if (document_state->first_paint_after_load_time().is_null() && |
| 4062 !navigation_state->finish_load_time().is_null()) { | 4091 !document_state->finish_load_time().is_null()) { |
| 4063 navigation_state->set_first_paint_after_load_time(now); | 4092 document_state->set_first_paint_after_load_time(now); |
| 4064 } | 4093 } |
| 4065 } | 4094 } |
| 4066 } | 4095 } |
| 4067 | 4096 |
| 4068 void RenderViewImpl::OnViewContextSwapBuffersPosted() { | 4097 void RenderViewImpl::OnViewContextSwapBuffersPosted() { |
| 4069 RenderWidget::OnSwapBuffersPosted(); | 4098 RenderWidget::OnSwapBuffersPosted(); |
| 4070 } | 4099 } |
| 4071 | 4100 |
| 4072 void RenderViewImpl::OnViewContextSwapBuffersComplete() { | 4101 void RenderViewImpl::OnViewContextSwapBuffersComplete() { |
| 4073 RenderWidget::OnSwapBuffersComplete(); | 4102 RenderWidget::OnSwapBuffersComplete(); |
| (...skipping 630 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4704 return webview()->settings()->useThreadedCompositor(); | 4733 return webview()->settings()->useThreadedCompositor(); |
| 4705 } | 4734 } |
| 4706 | 4735 |
| 4707 void RenderViewImpl::OnJavaBridgeInit( | 4736 void RenderViewImpl::OnJavaBridgeInit( |
| 4708 const IPC::ChannelHandle& channel_handle) { | 4737 const IPC::ChannelHandle& channel_handle) { |
| 4709 DCHECK(!java_bridge_dispatcher_.get()); | 4738 DCHECK(!java_bridge_dispatcher_.get()); |
| 4710 #if defined(ENABLE_JAVA_BRIDGE) | 4739 #if defined(ENABLE_JAVA_BRIDGE) |
| 4711 java_bridge_dispatcher_.reset(new JavaBridgeDispatcher(this, channel_handle)); | 4740 java_bridge_dispatcher_.reset(new JavaBridgeDispatcher(this, channel_handle)); |
| 4712 #endif | 4741 #endif |
| 4713 } | 4742 } |
| OLD | NEW |