Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(111)

Side by Side Diff: content/renderer/render_frame_impl.cc

Issue 137463002: RenderFrame: flesh out Observer (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@lkgr
Patch Set: move didFinishLoad Created 6 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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_frame_impl.h" 5 #include "content/renderer/render_frame_impl.h"
6 6
7 #include <map> 7 #include <map>
8 #include <string> 8 #include <string>
9 9
10 #include "base/command_line.h" 10 #include "base/command_line.h"
(...skipping 847 matching lines...) Expand 10 before | Expand all | Expand 10 after
858 858
859 void RenderFrameImpl::didCreateDataSource(blink::WebFrame* frame, 859 void RenderFrameImpl::didCreateDataSource(blink::WebFrame* frame,
860 blink::WebDataSource* datasource) { 860 blink::WebDataSource* datasource) {
861 // TODO(nasko): Move implementation here. Needed state: 861 // TODO(nasko): Move implementation here. Needed state:
862 // * pending_navigation_params_ 862 // * pending_navigation_params_
863 // * webview 863 // * webview
864 // Needed methods: 864 // Needed methods:
865 // * PopulateDocumentStateFromPending 865 // * PopulateDocumentStateFromPending
866 // * CreateNavigationStateFromPending 866 // * CreateNavigationStateFromPending
867 render_view_->didCreateDataSource(frame, datasource); 867 render_view_->didCreateDataSource(frame, datasource);
868
869 FOR_EACH_OBSERVER(RenderFrameObserver, observers_,
870 DidCreateDataSource(frame, datasource));
868 } 871 }
869 872
870 void RenderFrameImpl::didStartProvisionalLoad(blink::WebFrame* frame) { 873 void RenderFrameImpl::didStartProvisionalLoad(blink::WebFrame* frame) {
871 WebDataSource* ds = frame->provisionalDataSource(); 874 WebDataSource* ds = frame->provisionalDataSource();
872 875
873 // In fast/loader/stop-provisional-loads.html, we abort the load before this 876 // In fast/loader/stop-provisional-loads.html, we abort the load before this
874 // callback is invoked. 877 // callback is invoked.
875 if (!ds) 878 if (!ds)
876 return; 879 return;
877 880
(...skipping 25 matching lines...) Expand all
903 // marked with AUTO_SUBFRAME. See also didFailProvisionalLoad for how we 906 // marked with AUTO_SUBFRAME. See also didFailProvisionalLoad for how we
904 // handle loading of error pages. 907 // handle loading of error pages.
905 document_state->navigation_state()->set_transition_type( 908 document_state->navigation_state()->set_transition_type(
906 PAGE_TRANSITION_AUTO_SUBFRAME); 909 PAGE_TRANSITION_AUTO_SUBFRAME);
907 } 910 }
908 911
909 FOR_EACH_OBSERVER( 912 FOR_EACH_OBSERVER(
910 RenderViewObserver, render_view_->observers(), 913 RenderViewObserver, render_view_->observers(),
911 DidStartProvisionalLoad(frame)); 914 DidStartProvisionalLoad(frame));
912 915
916 FOR_EACH_OBSERVER(
917 RenderFrameObserver, observers_,
918 DidStartProvisionalLoad(frame));
919
913 Send(new FrameHostMsg_DidStartProvisionalLoadForFrame( 920 Send(new FrameHostMsg_DidStartProvisionalLoadForFrame(
914 routing_id_, frame->identifier(), 921 routing_id_, frame->identifier(),
915 frame->parent() ? frame->parent()->identifier() : -1, 922 frame->parent() ? frame->parent()->identifier() : -1,
916 is_top_most, ds->request().url())); 923 is_top_most, ds->request().url()));
917 } 924 }
918 925
919 void RenderFrameImpl::didReceiveServerRedirectForProvisionalLoad( 926 void RenderFrameImpl::didReceiveServerRedirectForProvisionalLoad(
920 blink::WebFrame* frame) { 927 blink::WebFrame* frame) {
921 // TODO(nasko): Move implementation here. Needed state: 928 // TODO(nasko): Move implementation here. Needed state:
922 // * page_id_ 929 // * page_id_
923 render_view_->didReceiveServerRedirectForProvisionalLoad(frame); 930 render_view_->didReceiveServerRedirectForProvisionalLoad(frame);
924 } 931 }
925 932
926 void RenderFrameImpl::didFailProvisionalLoad( 933 void RenderFrameImpl::didFailProvisionalLoad(
927 blink::WebFrame* frame, 934 blink::WebFrame* frame,
928 const blink::WebURLError& error) { 935 const blink::WebURLError& error) {
929 WebDataSource* ds = frame->provisionalDataSource(); 936 WebDataSource* ds = frame->provisionalDataSource();
930 DCHECK(ds); 937 DCHECK(ds);
931 938
932 const WebURLRequest& failed_request = ds->request(); 939 const WebURLRequest& failed_request = ds->request();
933 940
934 // Call out to RenderViewImpl, so observers are notified. 941 // Call out to RenderViewImpl, so observers are notified.
935 render_view_->didFailProvisionalLoad(frame, error); 942 render_view_->didFailProvisionalLoad(frame, error);
936 943
944 FOR_EACH_OBSERVER(RenderFrameObserver, observers_,
945 DidFailProvisionalLoad(frame, error));
946
937 bool show_repost_interstitial = 947 bool show_repost_interstitial =
938 (error.reason == net::ERR_CACHE_MISS && 948 (error.reason == net::ERR_CACHE_MISS &&
939 EqualsASCII(failed_request.httpMethod(), "POST")); 949 EqualsASCII(failed_request.httpMethod(), "POST"));
940 950
941 FrameHostMsg_DidFailProvisionalLoadWithError_Params params; 951 FrameHostMsg_DidFailProvisionalLoadWithError_Params params;
942 params.frame_id = frame->identifier(); 952 params.frame_id = frame->identifier();
943 params.frame_unique_name = frame->uniqueName(); 953 params.frame_unique_name = frame->uniqueName();
944 params.is_main_frame = !frame->parent(); 954 params.is_main_frame = !frame->parent();
945 params.error_code = error.reason; 955 params.error_code = error.reason;
946 GetContentClient()->renderer()->GetNavigationErrorStrings( 956 GetContentClient()->renderer()->GetNavigationErrorStrings(
(...skipping 148 matching lines...) Expand 10 before | Expand all | Expand 10 after
1095 1105
1096 void RenderFrameImpl::didFailLoad(blink::WebFrame* frame, 1106 void RenderFrameImpl::didFailLoad(blink::WebFrame* frame,
1097 const blink::WebURLError& error) { 1107 const blink::WebURLError& error) {
1098 // TODO(nasko): Move implementation here. No state needed. 1108 // TODO(nasko): Move implementation here. No state needed.
1099 render_view_->didFailLoad(frame, error); 1109 render_view_->didFailLoad(frame, error);
1100 } 1110 }
1101 1111
1102 void RenderFrameImpl::didFinishLoad(blink::WebFrame* frame) { 1112 void RenderFrameImpl::didFinishLoad(blink::WebFrame* frame) {
1103 // TODO(nasko): Move implementation here. No state needed, just observers 1113 // TODO(nasko): Move implementation here. No state needed, just observers
1104 // notification before sending message to the browser process. 1114 // notification before sending message to the browser process.
1115 FOR_EACH_OBSERVER(RenderFrameObserver, observers_,
1116 DidFinishLoad(frame));
1105 render_view_->didFinishLoad(frame); 1117 render_view_->didFinishLoad(frame);
1106 } 1118 }
1107 1119
1108 void RenderFrameImpl::didNavigateWithinPage(blink::WebFrame* frame, 1120 void RenderFrameImpl::didNavigateWithinPage(blink::WebFrame* frame,
1109 bool is_new_navigation) { 1121 bool is_new_navigation) {
1110 // TODO(nasko): Move implementation here. No state needed, just observers 1122 // TODO(nasko): Move implementation here. No state needed, just observers
1111 // notification before sending message to the browser process. 1123 // notification before sending message to the browser process.
1112 render_view_->didNavigateWithinPage(frame, is_new_navigation); 1124 render_view_->didNavigateWithinPage(frame, is_new_navigation);
1113 } 1125 }
1114 1126
(...skipping 416 matching lines...) Expand 10 before | Expand all | Expand 10 after
1531 void RenderFrameImpl::AddObserver(RenderFrameObserver* observer) { 1543 void RenderFrameImpl::AddObserver(RenderFrameObserver* observer) {
1532 observers_.AddObserver(observer); 1544 observers_.AddObserver(observer);
1533 } 1545 }
1534 1546
1535 void RenderFrameImpl::RemoveObserver(RenderFrameObserver* observer) { 1547 void RenderFrameImpl::RemoveObserver(RenderFrameObserver* observer) {
1536 observer->RenderFrameGone(); 1548 observer->RenderFrameGone();
1537 observers_.RemoveObserver(observer); 1549 observers_.RemoveObserver(observer);
1538 } 1550 }
1539 1551
1540 } // namespace content 1552 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698