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

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: Smash changesets together 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 737 matching lines...) Expand 10 before | Expand all | Expand 10 after
748 748
749 void RenderFrameImpl::didCreateDataSource(blink::WebFrame* frame, 749 void RenderFrameImpl::didCreateDataSource(blink::WebFrame* frame,
750 blink::WebDataSource* datasource) { 750 blink::WebDataSource* datasource) {
751 // TODO(nasko): Move implementation here. Needed state: 751 // TODO(nasko): Move implementation here. Needed state:
752 // * pending_navigation_params_ 752 // * pending_navigation_params_
753 // * webview 753 // * webview
754 // Needed methods: 754 // Needed methods:
755 // * PopulateDocumentStateFromPending 755 // * PopulateDocumentStateFromPending
756 // * CreateNavigationStateFromPending 756 // * CreateNavigationStateFromPending
757 render_view_->didCreateDataSource(frame, datasource); 757 render_view_->didCreateDataSource(frame, datasource);
758
759 FOR_EACH_OBSERVER(RenderFrameObserver, observers_,
760 DidCreateDataSource(frame, datasource));
758 } 761 }
759 762
760 void RenderFrameImpl::didStartProvisionalLoad(blink::WebFrame* frame) { 763 void RenderFrameImpl::didStartProvisionalLoad(blink::WebFrame* frame) {
761 WebDataSource* ds = frame->provisionalDataSource(); 764 WebDataSource* ds = frame->provisionalDataSource();
762 765
763 // In fast/loader/stop-provisional-loads.html, we abort the load before this 766 // In fast/loader/stop-provisional-loads.html, we abort the load before this
764 // callback is invoked. 767 // callback is invoked.
765 if (!ds) 768 if (!ds)
766 return; 769 return;
767 770
(...skipping 25 matching lines...) Expand all
793 // marked with AUTO_SUBFRAME. See also didFailProvisionalLoad for how we 796 // marked with AUTO_SUBFRAME. See also didFailProvisionalLoad for how we
794 // handle loading of error pages. 797 // handle loading of error pages.
795 document_state->navigation_state()->set_transition_type( 798 document_state->navigation_state()->set_transition_type(
796 PAGE_TRANSITION_AUTO_SUBFRAME); 799 PAGE_TRANSITION_AUTO_SUBFRAME);
797 } 800 }
798 801
799 FOR_EACH_OBSERVER( 802 FOR_EACH_OBSERVER(
800 RenderViewObserver, render_view_->observers(), 803 RenderViewObserver, render_view_->observers(),
801 DidStartProvisionalLoad(frame)); 804 DidStartProvisionalLoad(frame));
802 805
806 FOR_EACH_OBSERVER(
807 RenderFrameObserver, observers_,
808 DidStartProvisionalLoad(frame));
809
803 Send(new FrameHostMsg_DidStartProvisionalLoadForFrame( 810 Send(new FrameHostMsg_DidStartProvisionalLoadForFrame(
804 routing_id_, frame->identifier(), 811 routing_id_, frame->identifier(),
805 frame->parent() ? frame->parent()->identifier() : -1, 812 frame->parent() ? frame->parent()->identifier() : -1,
806 is_top_most, ds->request().url())); 813 is_top_most, ds->request().url()));
807 } 814 }
808 815
809 void RenderFrameImpl::didReceiveServerRedirectForProvisionalLoad( 816 void RenderFrameImpl::didReceiveServerRedirectForProvisionalLoad(
810 blink::WebFrame* frame) { 817 blink::WebFrame* frame) {
811 if (frame->parent()) 818 if (frame->parent())
812 return; 819 return;
(...skipping 19 matching lines...) Expand all
832 blink::WebFrame* frame, 839 blink::WebFrame* frame,
833 const blink::WebURLError& error) { 840 const blink::WebURLError& error) {
834 WebDataSource* ds = frame->provisionalDataSource(); 841 WebDataSource* ds = frame->provisionalDataSource();
835 DCHECK(ds); 842 DCHECK(ds);
836 843
837 const WebURLRequest& failed_request = ds->request(); 844 const WebURLRequest& failed_request = ds->request();
838 845
839 // Call out to RenderViewImpl, so observers are notified. 846 // Call out to RenderViewImpl, so observers are notified.
840 render_view_->didFailProvisionalLoad(frame, error); 847 render_view_->didFailProvisionalLoad(frame, error);
841 848
849 FOR_EACH_OBSERVER(RenderFrameObserver, observers_,
850 DidFailProvisionalLoad(frame, error));
851
842 bool show_repost_interstitial = 852 bool show_repost_interstitial =
843 (error.reason == net::ERR_CACHE_MISS && 853 (error.reason == net::ERR_CACHE_MISS &&
844 EqualsASCII(failed_request.httpMethod(), "POST")); 854 EqualsASCII(failed_request.httpMethod(), "POST"));
845 855
846 FrameHostMsg_DidFailProvisionalLoadWithError_Params params; 856 FrameHostMsg_DidFailProvisionalLoadWithError_Params params;
847 params.frame_id = frame->identifier(); 857 params.frame_id = frame->identifier();
848 params.frame_unique_name = frame->uniqueName(); 858 params.frame_unique_name = frame->uniqueName();
849 params.is_main_frame = !frame->parent(); 859 params.is_main_frame = !frame->parent();
850 params.error_code = error.reason; 860 params.error_code = error.reason;
851 GetContentClient()->renderer()->GetNavigationErrorStrings( 861 GetContentClient()->renderer()->GetNavigationErrorStrings(
(...skipping 145 matching lines...) Expand 10 before | Expand all | Expand 10 after
997 1007
998 void RenderFrameImpl::didFailLoad(blink::WebFrame* frame, 1008 void RenderFrameImpl::didFailLoad(blink::WebFrame* frame,
999 const blink::WebURLError& error) { 1009 const blink::WebURLError& error) {
1000 // TODO(nasko): Move implementation here. No state needed. 1010 // TODO(nasko): Move implementation here. No state needed.
1001 render_view_->didFailLoad(frame, error); 1011 render_view_->didFailLoad(frame, error);
1002 } 1012 }
1003 1013
1004 void RenderFrameImpl::didFinishLoad(blink::WebFrame* frame) { 1014 void RenderFrameImpl::didFinishLoad(blink::WebFrame* frame) {
1005 // TODO(nasko): Move implementation here. No state needed, just observers 1015 // TODO(nasko): Move implementation here. No state needed, just observers
1006 // notification before sending message to the browser process. 1016 // notification before sending message to the browser process.
1017 FOR_EACH_OBSERVER(RenderFrameObserver, observers_,
1018 DidFinishLoad(frame));
1007 render_view_->didFinishLoad(frame); 1019 render_view_->didFinishLoad(frame);
1008 } 1020 }
1009 1021
1010 void RenderFrameImpl::didNavigateWithinPage(blink::WebFrame* frame, 1022 void RenderFrameImpl::didNavigateWithinPage(blink::WebFrame* frame,
1011 bool is_new_navigation) { 1023 bool is_new_navigation) {
1012 // TODO(nasko): Move implementation here. No state needed, just observers 1024 // TODO(nasko): Move implementation here. No state needed, just observers
1013 // notification before sending message to the browser process. 1025 // notification before sending message to the browser process.
1014 render_view_->didNavigateWithinPage(frame, is_new_navigation); 1026 render_view_->didNavigateWithinPage(frame, is_new_navigation);
1015 } 1027 }
1016 1028
(...skipping 416 matching lines...) Expand 10 before | Expand all | Expand 10 after
1433 void RenderFrameImpl::AddObserver(RenderFrameObserver* observer) { 1445 void RenderFrameImpl::AddObserver(RenderFrameObserver* observer) {
1434 observers_.AddObserver(observer); 1446 observers_.AddObserver(observer);
1435 } 1447 }
1436 1448
1437 void RenderFrameImpl::RemoveObserver(RenderFrameObserver* observer) { 1449 void RenderFrameImpl::RemoveObserver(RenderFrameObserver* observer) {
1438 observer->RenderFrameGone(); 1450 observer->RenderFrameGone();
1439 observers_.RemoveObserver(observer); 1451 observers_.RemoveObserver(observer);
1440 } 1452 }
1441 1453
1442 } // namespace content 1454 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698