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

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

Issue 5290005: Use the correct signal to detect failed navigations (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase Created 10 years 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
« no previous file with comments | « chrome/browser/tab_contents/provisional_load_details.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2010 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 "chrome/browser/tab_contents/tab_contents.h" 5 #include "chrome/browser/tab_contents/tab_contents.h"
6 6
7 #include <cmath> 7 #include <cmath>
8 8
9 #include "app/l10n_util.h" 9 #include "app/l10n_util.h"
10 #include "app/resource_bundle.h" 10 #include "app/resource_bundle.h"
(...skipping 2125 matching lines...) Expand 10 before | Expand all | Expand 10 after
2136 } 2136 }
2137 2137
2138 void TabContents::DidStartProvisionalLoadForFrame( 2138 void TabContents::DidStartProvisionalLoadForFrame(
2139 RenderViewHost* render_view_host, 2139 RenderViewHost* render_view_host,
2140 int64 frame_id, 2140 int64 frame_id,
2141 bool is_main_frame, 2141 bool is_main_frame,
2142 bool is_error_page, 2142 bool is_error_page,
2143 const GURL& url) { 2143 const GURL& url) {
2144 ProvisionalLoadDetails details(is_main_frame, 2144 ProvisionalLoadDetails details(is_main_frame,
2145 controller_.IsURLInPageNavigation(url), 2145 controller_.IsURLInPageNavigation(url),
2146 url, std::string(), false, frame_id); 2146 url, std::string(), false,
2147 is_error_page, frame_id);
2147 NotificationService::current()->Notify( 2148 NotificationService::current()->Notify(
2148 NotificationType::FRAME_PROVISIONAL_LOAD_START, 2149 NotificationType::FRAME_PROVISIONAL_LOAD_START,
2149 Source<NavigationController>(&controller_), 2150 Source<NavigationController>(&controller_),
2150 Details<ProvisionalLoadDetails>(&details)); 2151 Details<ProvisionalLoadDetails>(&details));
2151 if (is_main_frame) { 2152 if (is_main_frame) {
2152 // If we're displaying a network error page do not reset the content 2153 // If we're displaying a network error page do not reset the content
2153 // settings delegate's cookies so the user has a chance to modify cookie 2154 // settings delegate's cookies so the user has a chance to modify cookie
2154 // settings. 2155 // settings.
2155 if (!is_error_page) 2156 if (!is_error_page)
2156 content_settings_delegate_->ClearCookieSpecificContentSettings(); 2157 content_settings_delegate_->ClearCookieSpecificContentSettings();
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after
2245 // Update the URL display. 2246 // Update the URL display.
2246 NotifyNavigationStateChanged(TabContents::INVALIDATE_URL); 2247 NotifyNavigationStateChanged(TabContents::INVALIDATE_URL);
2247 } 2248 }
2248 2249
2249 render_manager_.RendererAbortedProvisionalLoad(render_view_host); 2250 render_manager_.RendererAbortedProvisionalLoad(render_view_host);
2250 } 2251 }
2251 2252
2252 // Send out a notification that we failed a provisional load with an error. 2253 // Send out a notification that we failed a provisional load with an error.
2253 ProvisionalLoadDetails details(is_main_frame, 2254 ProvisionalLoadDetails details(is_main_frame,
2254 controller_.IsURLInPageNavigation(url), 2255 controller_.IsURLInPageNavigation(url),
2255 url, std::string(), false, frame_id); 2256 url, std::string(), false, false, frame_id);
yzshen 2010/12/01 18:21:53 I am not sure I understand this correctly. Is FRA
Matt Perry 2010/12/01 20:51:10 I'm also a little confused. Do we not get a "commi
2256 details.set_error_code(error_code); 2257 details.set_error_code(error_code);
2257 2258
2258 NotificationService::current()->Notify( 2259 NotificationService::current()->Notify(
2259 NotificationType::FAIL_PROVISIONAL_LOAD_WITH_ERROR, 2260 NotificationType::FAIL_PROVISIONAL_LOAD_WITH_ERROR,
2260 Source<NavigationController>(&controller_), 2261 Source<NavigationController>(&controller_),
2261 Details<ProvisionalLoadDetails>(&details)); 2262 Details<ProvisionalLoadDetails>(&details));
2262 } 2263 }
2263 2264
2264 void TabContents::DocumentLoadedInFrame(int64 frame_id) { 2265 void TabContents::DocumentLoadedInFrame(int64 frame_id) {
2265 controller_.DocumentLoadedInFrame(); 2266 controller_.DocumentLoadedInFrame();
(...skipping 219 matching lines...) Expand 10 before | Expand all | Expand 10 after
2485 // different from the NAV_ENTRY_COMMITTED notification which doesn't include 2486 // different from the NAV_ENTRY_COMMITTED notification which doesn't include
2486 // the actual URL navigated to and isn't sent for AUTO_SUBFRAME navigations. 2487 // the actual URL navigated to and isn't sent for AUTO_SUBFRAME navigations.
2487 if (details.type != NavigationType::NAV_IGNORE) { 2488 if (details.type != NavigationType::NAV_IGNORE) {
2488 // For AUTO_SUBFRAME navigations, an event for the main frame is generated 2489 // For AUTO_SUBFRAME navigations, an event for the main frame is generated
2489 // that is not recorded in the navigation history. For the purpose of 2490 // that is not recorded in the navigation history. For the purpose of
2490 // tracking navigation events, we treat this event as a sub frame navigation 2491 // tracking navigation events, we treat this event as a sub frame navigation
2491 // event. 2492 // event.
2492 bool is_main_frame = did_navigate ? details.is_main_frame : false; 2493 bool is_main_frame = did_navigate ? details.is_main_frame : false;
2493 ProvisionalLoadDetails load_details( 2494 ProvisionalLoadDetails load_details(
2494 is_main_frame, details.is_in_page, params.url, std::string(), false, 2495 is_main_frame, details.is_in_page, params.url, std::string(), false,
2495 params.frame_id); 2496 false, params.frame_id);
2496 load_details.set_transition_type(params.transition); 2497 load_details.set_transition_type(params.transition);
2497 // Whether or not a page transition was triggered by going backward or 2498 // Whether or not a page transition was triggered by going backward or
2498 // forward in the history is only stored in the navigation controller's 2499 // forward in the history is only stored in the navigation controller's
2499 // entry list. 2500 // entry list.
2500 if (did_navigate && 2501 if (did_navigate &&
2501 (controller_.GetActiveEntry()->transition_type() & 2502 (controller_.GetActiveEntry()->transition_type() &
2502 PageTransition::FORWARD_BACK)) { 2503 PageTransition::FORWARD_BACK)) {
2503 load_details.set_transition_type( 2504 load_details.set_transition_type(
2504 params.transition | PageTransition::FORWARD_BACK); 2505 params.transition | PageTransition::FORWARD_BACK);
2505 } 2506 }
(...skipping 739 matching lines...) Expand 10 before | Expand all | Expand 10 after
3245 } 3246 }
3246 3247
3247 void TabContents::set_encoding(const std::string& encoding) { 3248 void TabContents::set_encoding(const std::string& encoding) {
3248 encoding_ = CharacterEncoding::GetCanonicalEncodingNameByAliasName(encoding); 3249 encoding_ = CharacterEncoding::GetCanonicalEncodingNameByAliasName(encoding);
3249 } 3250 }
3250 3251
3251 void TabContents::SetAppIcon(const SkBitmap& app_icon) { 3252 void TabContents::SetAppIcon(const SkBitmap& app_icon) {
3252 app_icon_ = app_icon; 3253 app_icon_ = app_icon;
3253 NotifyNavigationStateChanged(INVALIDATE_TITLE); 3254 NotifyNavigationStateChanged(INVALIDATE_TITLE);
3254 } 3255 }
OLDNEW
« no previous file with comments | « chrome/browser/tab_contents/provisional_load_details.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698