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