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 "components/signin/core/browser/signin_account_id_helper.h" | 5 #include "components/signin/core/browser/signin_account_id_helper.h" |
6 | 6 |
7 #include "base/prefs/pref_service.h" | 7 #include "base/prefs/pref_service.h" |
8 #include "components/signin/core/browser/profile_oauth2_token_service.h" | 8 #include "components/signin/core/browser/profile_oauth2_token_service.h" |
9 #include "components/signin/core/browser/signin_client.h" | 9 #include "components/signin/core/browser/signin_client.h" |
10 #include "components/signin/core/common/signin_pref_names.h" | 10 #include "components/signin/core/common/signin_pref_names.h" |
(...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
122 new GaiaIdFetcher(client_, token_service_, signin_manager_, this)); | 122 new GaiaIdFetcher(client_, token_service_, signin_manager_, this)); |
123 } | 123 } |
124 token_service_->AddObserver(this); | 124 token_service_->AddObserver(this); |
125 } | 125 } |
126 | 126 |
127 SigninAccountIdHelper::~SigninAccountIdHelper() { | 127 SigninAccountIdHelper::~SigninAccountIdHelper() { |
128 signin_manager_->RemoveObserver(this); | 128 signin_manager_->RemoveObserver(this); |
129 token_service_->RemoveObserver(this); | 129 token_service_->RemoveObserver(this); |
130 } | 130 } |
131 | 131 |
132 void SigninAccountIdHelper::GoogleSignedOut(const std::string& username) { | 132 void SigninAccountIdHelper::GoogleSignedOut(const std::string& account_id, |
| 133 const std::string& username) { |
133 client_->GetPrefs()->ClearPref(prefs::kGoogleServicesUserAccountId); | 134 client_->GetPrefs()->ClearPref(prefs::kGoogleServicesUserAccountId); |
134 } | 135 } |
135 | 136 |
136 void SigninAccountIdHelper::OnRefreshTokenAvailable( | 137 void SigninAccountIdHelper::OnRefreshTokenAvailable( |
137 const std::string& account_id) { | 138 const std::string& account_id) { |
138 if (account_id == signin_manager_->GetAuthenticatedAccountId()) { | 139 if (account_id == signin_manager_->GetAuthenticatedAccountId()) { |
139 std::string current_gaia_id = | 140 std::string current_gaia_id = |
140 client_->GetPrefs()->GetString(prefs::kGoogleServicesUserAccountId); | 141 client_->GetPrefs()->GetString(prefs::kGoogleServicesUserAccountId); |
141 if (current_gaia_id.empty() && !disable_for_test_) { | 142 if (current_gaia_id.empty() && !disable_for_test_) { |
142 id_fetcher_.reset( | 143 id_fetcher_.reset( |
(...skipping 10 matching lines...) Expand all Loading... |
153 } | 154 } |
154 } | 155 } |
155 | 156 |
156 // static | 157 // static |
157 bool SigninAccountIdHelper::disable_for_test_ = false; | 158 bool SigninAccountIdHelper::disable_for_test_ = false; |
158 | 159 |
159 // static | 160 // static |
160 void SigninAccountIdHelper::SetDisableForTest(bool disable_for_test) { | 161 void SigninAccountIdHelper::SetDisableForTest(bool disable_for_test) { |
161 disable_for_test_ = disable_for_test; | 162 disable_for_test_ = disable_for_test; |
162 } | 163 } |
OLD | NEW |