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

Side by Side Diff: chrome/browser/ui/sync/one_click_signin_helper.cc

Issue 257153003: We have a problem in the process on destroying WebContentsImpl because (Closed) Base URL: https://git.chromium.org/chromium/src.git@master
Patch Set: Rebased onto origin/master again, resolved conflicts Created 6 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
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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/ui/sync/one_click_signin_helper.h" 5 #include "chrome/browser/ui/sync/one_click_signin_helper.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <functional> 8 #include <functional>
9 #include <utility> 9 #include <utility>
10 #include <vector> 10 #include <vector>
(...skipping 408 matching lines...) Expand 10 before | Expand all | Expand 10 after
419 // Watch a webcontents and remove URL from the history once loading is complete. 419 // Watch a webcontents and remove URL from the history once loading is complete.
420 // We have to delay the cleaning until the new URL has finished loading because 420 // We have to delay the cleaning until the new URL has finished loading because
421 // we're not allowed to remove the last-loaded URL from the history. Objects 421 // we're not allowed to remove the last-loaded URL from the history. Objects
422 // of this type automatically self-destruct once they're finished their work. 422 // of this type automatically self-destruct once they're finished their work.
423 class CurrentHistoryCleaner : public content::WebContentsObserver { 423 class CurrentHistoryCleaner : public content::WebContentsObserver {
424 public: 424 public:
425 explicit CurrentHistoryCleaner(content::WebContents* contents); 425 explicit CurrentHistoryCleaner(content::WebContents* contents);
426 virtual ~CurrentHistoryCleaner(); 426 virtual ~CurrentHistoryCleaner();
427 427
428 // content::WebContentsObserver: 428 // content::WebContentsObserver:
429 virtual void WebContentsDestroyed(content::WebContents* contents) OVERRIDE; 429 virtual void WebContentsDestroyed() OVERRIDE;
430 virtual void DidCommitProvisionalLoadForFrame( 430 virtual void DidCommitProvisionalLoadForFrame(
431 int64 frame_id, 431 int64 frame_id,
432 const base::string16& frame_unique_name, 432 const base::string16& frame_unique_name,
433 bool is_main_frame, 433 bool is_main_frame,
434 const GURL& url, 434 const GURL& url,
435 content::PageTransition transition_type, 435 content::PageTransition transition_type,
436 content::RenderViewHost* render_view_host) OVERRIDE; 436 content::RenderViewHost* render_view_host) OVERRIDE;
437 437
438 private: 438 private:
439 scoped_ptr<content::WebContents> contents_; 439 scoped_ptr<content::WebContents> contents_;
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
472 content::NavigationEntry* entry = 472 content::NavigationEntry* entry =
473 nc->GetEntryAtIndex(history_index_to_remove_); 473 nc->GetEntryAtIndex(history_index_to_remove_);
474 if (signin::IsContinueUrlForWebBasedSigninFlow(entry->GetURL())) { 474 if (signin::IsContinueUrlForWebBasedSigninFlow(entry->GetURL())) {
475 hs->DeleteURL(entry->GetURL()); 475 hs->DeleteURL(entry->GetURL());
476 nc->RemoveEntryAtIndex(history_index_to_remove_); 476 nc->RemoveEntryAtIndex(history_index_to_remove_);
477 delete this; // Success. 477 delete this; // Success.
478 } 478 }
479 } 479 }
480 } 480 }
481 481
482 void CurrentHistoryCleaner::WebContentsDestroyed( 482 void CurrentHistoryCleaner::WebContentsDestroyed() {
483 content::WebContents* contents) {
484 delete this; // Failure. 483 delete this; // Failure.
485 } 484 }
486 485
487 } // namespace 486 } // namespace
488 487
489 488
490 // StartSyncArgs -------------------------------------------------------------- 489 // StartSyncArgs --------------------------------------------------------------
491 490
492 OneClickSigninHelper::StartSyncArgs::StartSyncArgs() 491 OneClickSigninHelper::StartSyncArgs::StartSyncArgs()
493 : profile(NULL), 492 : profile(NULL),
(...skipping 1104 matching lines...) Expand 10 before | Expand all | Expand 10 after
1598 // If the web contents is showing a blank page and not about to be closed, 1597 // If the web contents is showing a blank page and not about to be closed,
1599 // redirect to the NTP or apps page. 1598 // redirect to the NTP or apps page.
1600 if (signin::IsContinueUrlForWebBasedSigninFlow(current_url) && 1599 if (signin::IsContinueUrlForWebBasedSigninFlow(current_url) &&
1601 !signin::IsAutoCloseEnabledInURL(original_continue_url_)) { 1600 !signin::IsAutoCloseEnabledInURL(original_continue_url_)) {
1602 RedirectToNtpOrAppsPage( 1601 RedirectToNtpOrAppsPage(
1603 web_contents(), 1602 web_contents(),
1604 signin::GetSourceForPromoURL(original_continue_url_)); 1603 signin::GetSourceForPromoURL(original_continue_url_));
1605 } 1604 }
1606 } 1605 }
1607 } 1606 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/passwords/manage_passwords_ui_controller.cc ('k') | chrome/browser/ui/sync/one_click_signin_sync_observer.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698