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

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

Issue 6904039: Update the URL if the user cancels a beforeunload handler. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Add missing file. Created 9 years, 7 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
« no previous file with comments | « content/browser/tab_contents/tab_contents.h ('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) 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 1214 matching lines...) Expand 10 before | Expand all | Expand 10 after
1225 LOG(WARNING) << "Discarding message during interstitial."; 1225 LOG(WARNING) << "Discarding message during interstitial.";
1226 return; 1226 return;
1227 } 1227 }
1228 1228
1229 // This will discard our pending entry if we cancelled the load (e.g., if we 1229 // This will discard our pending entry if we cancelled the load (e.g., if we
1230 // decided to download the file instead of load it). Only discard the 1230 // decided to download the file instead of load it). Only discard the
1231 // pending entry if the URLs match, otherwise the user initiated a navigate 1231 // pending entry if the URLs match, otherwise the user initiated a navigate
1232 // before the page loaded so that the discard would discard the wrong entry. 1232 // before the page loaded so that the discard would discard the wrong entry.
1233 NavigationEntry* pending_entry = controller_.pending_entry(); 1233 NavigationEntry* pending_entry = controller_.pending_entry();
1234 if (pending_entry && pending_entry->url() == validated_url) { 1234 if (pending_entry && pending_entry->url() == validated_url) {
1235 controller_.DiscardNonCommittedEntries(); 1235 DidCancelLoading();
1236 // Update the URL display.
1237 NotifyNavigationStateChanged(TabContents::INVALIDATE_URL);
1238 } 1236 }
1239 1237
1240 render_manager_.RendererAbortedProvisionalLoad(render_view_host()); 1238 render_manager_.RendererAbortedProvisionalLoad(render_view_host());
1241 } 1239 }
1242 1240
1243 // Send out a notification that we failed a provisional load with an error. 1241 // Send out a notification that we failed a provisional load with an error.
1244 ProvisionalLoadDetails details( 1242 ProvisionalLoadDetails details(
1245 is_main_frame, controller_.IsURLInPageNavigation(validated_url), 1243 is_main_frame, controller_.IsURLInPageNavigation(validated_url),
1246 validated_url, std::string(), false, frame_id); 1244 validated_url, std::string(), false, frame_id);
1247 details.set_error_code(error_code); 1245 details.set_error_code(error_code);
(...skipping 725 matching lines...) Expand 10 before | Expand all | Expand 10 after
1973 &controller_, 1971 &controller_,
1974 controller_.GetCurrentEntryIndex())); 1972 controller_.GetCurrentEntryIndex()));
1975 } 1973 }
1976 1974
1977 SetIsLoading(false, details.get()); 1975 SetIsLoading(false, details.get());
1978 1976
1979 // Notify observers about navigation. 1977 // Notify observers about navigation.
1980 FOR_EACH_OBSERVER(TabContentsObserver, observers_, DidStopLoading()); 1978 FOR_EACH_OBSERVER(TabContentsObserver, observers_, DidStopLoading());
1981 } 1979 }
1982 1980
1981 void TabContents::DidCancelLoading() {
1982 controller_.DiscardNonCommittedEntries();
1983
1984 // Update the URL display.
1985 NotifyNavigationStateChanged(TabContents::INVALIDATE_URL);
1986 }
1987
1983 void TabContents::DidChangeLoadProgress(double progress) { 1988 void TabContents::DidChangeLoadProgress(double progress) {
1984 if (delegate()) 1989 if (delegate())
1985 delegate()->LoadProgressChanged(progress); 1990 delegate()->LoadProgressChanged(progress);
1986 } 1991 }
1987 1992
1988 void TabContents::DocumentOnLoadCompletedInMainFrame( 1993 void TabContents::DocumentOnLoadCompletedInMainFrame(
1989 RenderViewHost* render_view_host, 1994 RenderViewHost* render_view_host,
1990 int32 page_id) { 1995 int32 page_id) {
1991 NotificationService::current()->Notify( 1996 NotificationService::current()->Notify(
1992 NotificationType::LOAD_COMPLETED_MAIN_FRAME, 1997 NotificationType::LOAD_COMPLETED_MAIN_FRAME,
(...skipping 425 matching lines...) Expand 10 before | Expand all | Expand 10 after
2418 2423
2419 void TabContents::CreateViewAndSetSizeForRVH(RenderViewHost* rvh) { 2424 void TabContents::CreateViewAndSetSizeForRVH(RenderViewHost* rvh) {
2420 RenderWidgetHostView* rwh_view = view()->CreateViewForWidget(rvh); 2425 RenderWidgetHostView* rwh_view = view()->CreateViewForWidget(rvh);
2421 rwh_view->SetSize(view()->GetContainerSize()); 2426 rwh_view->SetSize(view()->GetContainerSize());
2422 } 2427 }
2423 2428
2424 void TabContents::OnOnlineStateChanged(bool online) { 2429 void TabContents::OnOnlineStateChanged(bool online) {
2425 render_view_host()->Send(new ViewMsg_NetworkStateChanged( 2430 render_view_host()->Send(new ViewMsg_NetworkStateChanged(
2426 render_view_host()->routing_id(), online)); 2431 render_view_host()->routing_id(), online));
2427 } 2432 }
OLDNEW
« no previous file with comments | « content/browser/tab_contents/tab_contents.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698