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

Side by Side Diff: chrome/browser/ui/sync/one_click_signin_sync_observer.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 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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_sync_observer.h" 5 #include "chrome/browser/ui/sync/one_click_signin_sync_observer.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/message_loop/message_loop.h" 8 #include "base/message_loop/message_loop.h"
9 #include "chrome/browser/profiles/profile.h" 9 #include "chrome/browser/profiles/profile.h"
10 #include "chrome/browser/signin/signin_promo.h" 10 #include "chrome/browser/signin/signin_promo.h"
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
44 // before this task has a chance to run. 44 // before this task has a chance to run.
45 base::MessageLoop::current()->PostTask( 45 base::MessageLoop::current()->PostTask(
46 FROM_HERE, 46 FROM_HERE,
47 base::Bind(&OneClickSigninSyncObserver::DeleteObserver, 47 base::Bind(&OneClickSigninSyncObserver::DeleteObserver,
48 weak_ptr_factory_.GetWeakPtr())); 48 weak_ptr_factory_.GetWeakPtr()));
49 } 49 }
50 } 50 }
51 51
52 OneClickSigninSyncObserver::~OneClickSigninSyncObserver() {} 52 OneClickSigninSyncObserver::~OneClickSigninSyncObserver() {}
53 53
54 void OneClickSigninSyncObserver::WebContentsDestroyed( 54 void OneClickSigninSyncObserver::WebContentsDestroyed() {
55 content::WebContents* web_contents) { 55 ProfileSyncService* sync_service = GetSyncService(web_contents());
56 ProfileSyncService* sync_service = GetSyncService(web_contents);
57 if (sync_service) 56 if (sync_service)
58 sync_service->RemoveObserver(this); 57 sync_service->RemoveObserver(this);
59 58
60 delete this; 59 delete this;
61 } 60 }
62 61
63 void OneClickSigninSyncObserver::OnStateChanged() { 62 void OneClickSigninSyncObserver::OnStateChanged() {
64 ProfileSyncService* sync_service = GetSyncService(web_contents()); 63 ProfileSyncService* sync_service = GetSyncService(web_contents());
65 64
66 // At this point, the sign-in process is complete, and control has been handed 65 // At this point, the sign-in process is complete, and control has been handed
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
110 Profile::FromBrowserContext(web_contents->GetBrowserContext()); 109 Profile::FromBrowserContext(web_contents->GetBrowserContext());
111 return ProfileSyncServiceFactory::GetForProfile(profile); 110 return ProfileSyncServiceFactory::GetForProfile(profile);
112 } 111 }
113 112
114 // static 113 // static
115 void OneClickSigninSyncObserver::DeleteObserver( 114 void OneClickSigninSyncObserver::DeleteObserver(
116 base::WeakPtr<OneClickSigninSyncObserver> observer) { 115 base::WeakPtr<OneClickSigninSyncObserver> observer) {
117 if (observer) 116 if (observer)
118 delete observer.get(); 117 delete observer.get();
119 } 118 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/sync/one_click_signin_sync_observer.h ('k') | chrome/browser/ui/tab_contents/core_tab_helper.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698