OLD | NEW |
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 <string> | 7 #include <string> |
8 | 8 |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "base/location.h" | 10 #include "base/location.h" |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
56 | 56 |
57 void OneClickSigninSyncObserver::WebContentsDestroyed() { | 57 void OneClickSigninSyncObserver::WebContentsDestroyed() { |
58 browser_sync::ProfileSyncService* sync_service = | 58 browser_sync::ProfileSyncService* sync_service = |
59 GetSyncService(web_contents()); | 59 GetSyncService(web_contents()); |
60 if (sync_service) | 60 if (sync_service) |
61 sync_service->RemoveObserver(this); | 61 sync_service->RemoveObserver(this); |
62 | 62 |
63 delete this; | 63 delete this; |
64 } | 64 } |
65 | 65 |
66 void OneClickSigninSyncObserver::OnStateChanged() { | 66 void OneClickSigninSyncObserver::OnStateChanged(syncer::SyncService* sync) { |
67 browser_sync::ProfileSyncService* sync_service = | 67 browser_sync::ProfileSyncService* sync_service = |
68 GetSyncService(web_contents()); | 68 GetSyncService(web_contents()); |
69 | 69 |
70 // At this point, the sign-in process is complete, and control has been handed | 70 // At this point, the sign-in process is complete, and control has been handed |
71 // back to the sync engine. Close the gaia sign in tab if the |continue_url_| | 71 // back to the sync engine. Close the gaia sign in tab if the |continue_url_| |
72 // contains the |auto_close| parameter. Otherwise, wait for sync setup to | 72 // contains the |auto_close| parameter. Otherwise, wait for sync setup to |
73 // complete and then navigate to the |continue_url_|. | 73 // complete and then navigate to the |continue_url_|. |
74 if (signin::IsAutoCloseEnabledInURL(continue_url_)) { | 74 if (signin::IsAutoCloseEnabledInURL(continue_url_)) { |
75 // Close the Gaia sign-in tab via a task to make sure we aren't in the | 75 // Close the Gaia sign-in tab via a task to make sure we aren't in the |
76 // middle of any WebUI handler code. | 76 // middle of any WebUI handler code. |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
109 Profile::FromBrowserContext(web_contents->GetBrowserContext()); | 109 Profile::FromBrowserContext(web_contents->GetBrowserContext()); |
110 return ProfileSyncServiceFactory::GetForProfile(profile); | 110 return ProfileSyncServiceFactory::GetForProfile(profile); |
111 } | 111 } |
112 | 112 |
113 // static | 113 // static |
114 void OneClickSigninSyncObserver::DeleteObserver( | 114 void OneClickSigninSyncObserver::DeleteObserver( |
115 base::WeakPtr<OneClickSigninSyncObserver> observer) { | 115 base::WeakPtr<OneClickSigninSyncObserver> observer) { |
116 if (observer) | 116 if (observer) |
117 delete observer.get(); | 117 delete observer.get(); |
118 } | 118 } |
OLD | NEW |