| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 "base/logging.h" | 5 #include "base/logging.h" |
| 6 #include "base/time/time.h" | 6 #include "base/time/time.h" |
| 7 #include "chrome/browser/chrome_notification_types.h" | 7 #include "chrome/browser/chrome_notification_types.h" |
| 8 #include "chrome/browser/net/chrome_cookie_notification_details.h" | 8 #include "chrome/browser/net/chrome_cookie_notification_details.h" |
| 9 #include "chrome/browser/profiles/profile.h" | 9 #include "chrome/browser/profiles/profile.h" |
| 10 #include "chrome/browser/signin/account_reconcilor.h" | 10 #include "chrome/browser/signin/account_reconcilor.h" |
| 11 #include "chrome/browser/signin/google_auto_login_helper.h" | |
| 12 #include "chrome/browser/signin/profile_oauth2_token_service.h" | 11 #include "chrome/browser/signin/profile_oauth2_token_service.h" |
| 13 #include "chrome/browser/signin/profile_oauth2_token_service_factory.h" | 12 #include "chrome/browser/signin/profile_oauth2_token_service_factory.h" |
| 14 #include "chrome/browser/signin/signin_manager.h" | 13 #include "chrome/browser/signin/signin_manager.h" |
| 15 #include "chrome/browser/signin/signin_manager_factory.h" | 14 #include "chrome/browser/signin/signin_manager_factory.h" |
| 16 #include "content/public/browser/browser_thread.h" | 15 #include "content/public/browser/browser_thread.h" |
| 17 #include "content/public/browser/notification_details.h" | 16 #include "content/public/browser/notification_details.h" |
| 18 #include "content/public/browser/notification_source.h" | 17 #include "content/public/browser/notification_source.h" |
| 19 #include "google_apis/gaia/gaia_auth_fetcher.h" | 18 #include "google_apis/gaia/gaia_auth_fetcher.h" |
| 20 #include "google_apis/gaia/gaia_auth_util.h" | 19 #include "google_apis/gaia/gaia_auth_util.h" |
| 21 #include "google_apis/gaia/gaia_constants.h" | 20 #include "google_apis/gaia/gaia_constants.h" |
| 22 | 21 |
| 23 AccountReconcilor::AccountReconcilor(Profile* profile) | 22 AccountReconcilor::AccountReconcilor(Profile* profile) |
| 24 : profile_(profile), | 23 : profile_(profile), |
| 24 merge_session_helper_(profile), |
| 25 are_gaia_accounts_set_(false), | 25 are_gaia_accounts_set_(false), |
| 26 requests_(NULL) { | 26 requests_(NULL) { |
| 27 DVLOG(1) << "AccountReconcilor::AccountReconcilor"; | 27 DVLOG(1) << "AccountReconcilor::AccountReconcilor"; |
| 28 merge_session_helper_.disable_auto_delete_when_done(); |
| 28 RegisterWithSigninManager(); | 29 RegisterWithSigninManager(); |
| 29 RegisterWithCookieMonster(); | 30 RegisterWithCookieMonster(); |
| 30 | 31 |
| 31 // If this profile is not connected, the reconcilor should do nothing but | 32 // If this profile is not connected, the reconcilor should do nothing but |
| 32 // wait for the connection. | 33 // wait for the connection. |
| 33 if (IsProfileConnected()) { | 34 if (IsProfileConnected()) { |
| 34 RegisterWithTokenService(); | 35 RegisterWithTokenService(); |
| 35 StartPeriodicReconciliation(); | 36 StartPeriodicReconciliation(); |
| 36 } | 37 } |
| 37 } | 38 } |
| (...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 152 } | 153 } |
| 153 | 154 |
| 154 void AccountReconcilor::OnRefreshTokenRevoked(const std::string& account_id) { | 155 void AccountReconcilor::OnRefreshTokenRevoked(const std::string& account_id) { |
| 155 DVLOG(1) << "AccountReconcilor::OnRefreshTokenRevoked: " << account_id; | 156 DVLOG(1) << "AccountReconcilor::OnRefreshTokenRevoked: " << account_id; |
| 156 PerformRemoveAction(account_id); | 157 PerformRemoveAction(account_id); |
| 157 } | 158 } |
| 158 | 159 |
| 159 void AccountReconcilor::OnRefreshTokensLoaded() {} | 160 void AccountReconcilor::OnRefreshTokensLoaded() {} |
| 160 | 161 |
| 161 void AccountReconcilor::PerformMergeAction(const std::string& account_id) { | 162 void AccountReconcilor::PerformMergeAction(const std::string& account_id) { |
| 162 // GoogleAutoLoginHelper deletes itself upon success / failure. | 163 merge_session_helper_.LogIn(account_id); |
| 163 GoogleAutoLoginHelper* helper = new GoogleAutoLoginHelper(profile_); | |
| 164 helper->LogIn(account_id); | |
| 165 } | 164 } |
| 166 | 165 |
| 167 void AccountReconcilor::PerformRemoveAction(const std::string& account_id) { | 166 void AccountReconcilor::PerformRemoveAction(const std::string& account_id) { |
| 168 // TODO(acleung): Implement this: | 167 // TODO(acleung): Implement this: |
| 169 } | 168 } |
| 170 | 169 |
| 171 void AccountReconcilor::StartReconcileAction() { | 170 void AccountReconcilor::StartReconcileAction() { |
| 172 if (!IsProfileConnected()) | 171 if (!IsProfileConnected()) |
| 173 return; | 172 return; |
| 174 | 173 |
| (...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 282 have_same_accounts = false; | 281 have_same_accounts = false; |
| 283 break; | 282 break; |
| 284 } | 283 } |
| 285 } | 284 } |
| 286 } | 285 } |
| 287 | 286 |
| 288 if (!are_primaries_equal || !have_same_accounts) { | 287 if (!are_primaries_equal || !have_same_accounts) { |
| 289 // TODO(rogerta): fix things up. | 288 // TODO(rogerta): fix things up. |
| 290 } | 289 } |
| 291 } | 290 } |
| OLD | NEW |