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

Side by Side Diff: content/browser/tab_contents/tab_contents.cc

Issue 8142032: Add error description to the DidFailProvisionalLoad callback. (Closed) Base URL: http://git.chromium.org/git/chromium.git@trunk
Patch Set: removed unnecessary change Created 9 years, 2 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 | Annotate | Revision Log
OLDNEW
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/browser/tab_contents/tab_contents.h" 5 #include "content/browser/tab_contents/tab_contents.h"
6 6
7 #include <cmath> 7 #include <cmath>
8 8
9 #include "base/command_line.h" 9 #include "base/command_line.h"
10 #include "base/metrics/histogram.h" 10 #include "base/metrics/histogram.h"
(...skipping 894 matching lines...) Expand 10 before | Expand all | Expand 10 after
905 if (!entry || entry->url() != source_url) 905 if (!entry || entry->url() != source_url)
906 return; 906 return;
907 907
908 // Notify observers about the provisional change in the main frame URL. 908 // Notify observers about the provisional change in the main frame URL.
909 FOR_EACH_OBSERVER(TabContentsObserver, observers_, 909 FOR_EACH_OBSERVER(TabContentsObserver, observers_,
910 ProvisionalChangeToMainFrameUrl(target_url, 910 ProvisionalChangeToMainFrameUrl(target_url,
911 has_opener_set)); 911 has_opener_set));
912 } 912 }
913 913
914 void TabContents::OnDidFailProvisionalLoadWithError( 914 void TabContents::OnDidFailProvisionalLoadWithError(
915 int64 frame_id, 915 const ViewHostMsg_DidFailProvisionalLoadWithError_Params& params) {
916 bool is_main_frame, 916 VLOG(1) << "Failed Provisional Load: " << params.url.possibly_invalid_spec()
917 int error_code, 917 << ", error_code: " << params.error_code
918 const GURL& url, 918 << ", error_description: " << params.error_description
919 bool showing_repost_interstitial) { 919 << ", is_main_frame: " << params.is_main_frame
920 VLOG(1) << "Failed Provisional Load: " << url.possibly_invalid_spec() 920 << ", showing_repost_interstitial: " <<
921 << ", error_code: " << error_code 921 params.showing_repost_interstitial
922 << " is_main_frame: " << is_main_frame 922 << ", frame_id: " << params.frame_id;
923 << " showing_repost_interstitial: " << showing_repost_interstitial 923 GURL validated_url(params.url);
924 << " frame_id: " << frame_id;
925 GURL validated_url(url);
926 render_view_host()->FilterURL(ChildProcessSecurityPolicy::GetInstance(), 924 render_view_host()->FilterURL(ChildProcessSecurityPolicy::GetInstance(),
927 GetRenderProcessHost()->id(), &validated_url); 925 GetRenderProcessHost()->id(), &validated_url);
928 926
929 if (net::ERR_ABORTED == error_code) { 927 if (net::ERR_ABORTED == params.error_code) {
930 // EVIL HACK ALERT! Ignore failed loads when we're showing interstitials. 928 // EVIL HACK ALERT! Ignore failed loads when we're showing interstitials.
931 // This means that the interstitial won't be torn down properly, which is 929 // This means that the interstitial won't be torn down properly, which is
932 // bad. But if we have an interstitial, go back to another tab type, and 930 // bad. But if we have an interstitial, go back to another tab type, and
933 // then load the same interstitial again, we could end up getting the first 931 // then load the same interstitial again, we could end up getting the first
934 // interstitial's "failed" message (as a result of the cancel) when we're on 932 // interstitial's "failed" message (as a result of the cancel) when we're on
935 // the second one. 933 // the second one.
936 // 934 //
937 // We can't tell this apart, so we think we're tearing down the current page 935 // We can't tell this apart, so we think we're tearing down the current page
938 // which will cause a crash later one. There is also some code in 936 // which will cause a crash later one. There is also some code in
939 // RenderViewHostManager::RendererAbortedProvisionalLoad that is commented 937 // RenderViewHostManager::RendererAbortedProvisionalLoad that is commented
(...skipping 20 matching lines...) Expand all
960 // navigation will still commit even if there is no pending entry. 958 // navigation will still commit even if there is no pending entry.
961 NavigationEntry* pending_entry = controller_.pending_entry(); 959 NavigationEntry* pending_entry = controller_.pending_entry();
962 if (pending_entry) 960 if (pending_entry)
963 DidCancelLoading(); 961 DidCancelLoading();
964 962
965 render_manager_.RendererAbortedProvisionalLoad(render_view_host()); 963 render_manager_.RendererAbortedProvisionalLoad(render_view_host());
966 } 964 }
967 965
968 // Send out a notification that we failed a provisional load with an error. 966 // Send out a notification that we failed a provisional load with an error.
969 ProvisionalLoadDetails details( 967 ProvisionalLoadDetails details(
970 is_main_frame, controller_.IsURLInPageNavigation(validated_url), 968 params.is_main_frame,
971 validated_url, std::string(), false, frame_id); 969 controller_.IsURLInPageNavigation(validated_url),
972 details.set_error_code(error_code); 970 validated_url,
971 std::string(),
972 false,
973 params.frame_id);
974 details.set_error_code(params.error_code);
973 975
974 NotificationService::current()->Notify( 976 NotificationService::current()->Notify(
975 content::NOTIFICATION_FAIL_PROVISIONAL_LOAD_WITH_ERROR, 977 content::NOTIFICATION_FAIL_PROVISIONAL_LOAD_WITH_ERROR,
976 Source<NavigationController>(&controller_), 978 Source<NavigationController>(&controller_),
977 Details<ProvisionalLoadDetails>(&details)); 979 Details<ProvisionalLoadDetails>(&details));
978 980
979 FOR_EACH_OBSERVER(TabContentsObserver, observers_, 981 FOR_EACH_OBSERVER(TabContentsObserver,
980 DidFailProvisionalLoad(frame_id, is_main_frame, 982 observers_,
981 validated_url, error_code)); 983 DidFailProvisionalLoad(params.frame_id,
984 params.is_main_frame,
985 validated_url,
986 params.error_code,
987 params.error_description));
982 } 988 }
983 989
984 void TabContents::OnDidLoadResourceFromMemoryCache( 990 void TabContents::OnDidLoadResourceFromMemoryCache(
985 const GURL& url, 991 const GURL& url,
986 const std::string& security_info, 992 const std::string& security_info,
987 const std::string& http_method, 993 const std::string& http_method,
988 ResourceType::Type resource_type) { 994 ResourceType::Type resource_type) {
989 base::StatsCounter cache("WebKit.CacheHit"); 995 base::StatsCounter cache("WebKit.CacheHit");
990 cache.Increment(); 996 cache.Increment();
991 997
(...skipping 964 matching lines...) Expand 10 before | Expand all | Expand 10 after
1956 } 1962 }
1957 1963
1958 void TabContents::SwapInRenderViewHost(RenderViewHost* rvh) { 1964 void TabContents::SwapInRenderViewHost(RenderViewHost* rvh) {
1959 render_manager_.SwapInRenderViewHost(rvh); 1965 render_manager_.SwapInRenderViewHost(rvh);
1960 } 1966 }
1961 1967
1962 void TabContents::CreateViewAndSetSizeForRVH(RenderViewHost* rvh) { 1968 void TabContents::CreateViewAndSetSizeForRVH(RenderViewHost* rvh) {
1963 RenderWidgetHostView* rwh_view = view()->CreateViewForWidget(rvh); 1969 RenderWidgetHostView* rwh_view = view()->CreateViewForWidget(rvh);
1964 rwh_view->SetSize(view()->GetContainerSize()); 1970 rwh_view->SetSize(view()->GetContainerSize());
1965 } 1971 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698