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

Unified Diff: chrome/browser/ui/sync/one_click_signin_helper.cc

Issue 19699007: Ensure we don't crash if user navigates back from NTP to Chrome sign-in page before it has fully lo… (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Add test coverage for removing a pending entry. Created 7 years, 5 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/ui/sync/one_click_signin_helper.cc
diff --git a/chrome/browser/ui/sync/one_click_signin_helper.cc b/chrome/browser/ui/sync/one_click_signin_helper.cc
index a39c0d7be7c15802ba3983ed998f2bb1396eab9e..88dbd38dd009d1149b411a0622f8008e32fa306b 100644
--- a/chrome/browser/ui/sync/one_click_signin_helper.cc
+++ b/chrome/browser/ui/sync/one_click_signin_helper.cc
@@ -470,8 +470,9 @@ class CurrentHistoryCleaner : public content::WebContentsObserver {
// content::WebContentsObserver:
virtual void WebContentsDestroyed(content::WebContents* contents) OVERRIDE;
- virtual void DidStopLoading(
- content::RenderViewHost* render_view_host) OVERRIDE;
+ virtual void DidNavigateMainFrame(
+ const content::LoadCommittedDetails& details,
+ const content::FrameNavigateParams& params) OVERRIDE;
private:
scoped_ptr<content::WebContents> contents_;
@@ -489,13 +490,14 @@ CurrentHistoryCleaner::CurrentHistoryCleaner(content::WebContents* contents)
CurrentHistoryCleaner::~CurrentHistoryCleaner() {
}
-void CurrentHistoryCleaner::DidStopLoading(
- content::RenderViewHost* render_view_host) {
+void CurrentHistoryCleaner::DidNavigateMainFrame(
+ const content::LoadCommittedDetails& details,
+ const content::FrameNavigateParams& params) {
content::NavigationController* nc = &web_contents()->GetController();
// Have to wait until something else gets added to history before removal.
if (history_index_to_remove_ < nc->GetLastCommittedEntryIndex()) {
- nc->RemoveEntryAtIndex(history_index_to_remove_);
- delete this; // Success.
+ if (nc->RemoveEntryAtIndex(history_index_to_remove_))
+ delete this; // Success.
}
}

Powered by Google App Engine
This is Rietveld 408576698