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

Side by Side Diff: components/signin/core/browser/about_signin_internals.cc

Issue 695553002: Account reconcilor: Use cookie store cookie changed subscription. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Nits Created 6 years, 1 month 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 (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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/about_signin_internals.h" 5 #include "components/signin/core/browser/about_signin_internals.h"
6 6
7 #include "base/command_line.h" 7 #include "base/command_line.h"
8 #include "base/debug/trace_event.h" 8 #include "base/debug/trace_event.h"
9 #include "base/hash.h" 9 #include "base/hash.h"
10 #include "base/i18n/time_formatting.h" 10 #include "base/i18n/time_formatting.h"
(...skipping 191 matching lines...) Expand 10 before | Expand all | Expand 10 after
202 202
203 void AboutSigninInternals::Initialize(SigninClient* client) { 203 void AboutSigninInternals::Initialize(SigninClient* client) {
204 DCHECK(!client_); 204 DCHECK(!client_);
205 client_ = client; 205 client_ = client;
206 206
207 RefreshSigninPrefs(); 207 RefreshSigninPrefs();
208 208
209 signin_manager_->AddSigninDiagnosticsObserver(this); 209 signin_manager_->AddSigninDiagnosticsObserver(this);
210 token_service_->AddDiagnosticsObserver(this); 210 token_service_->AddDiagnosticsObserver(this);
211 cookie_changed_subscription_ = client_->AddCookieChangedCallback( 211 cookie_changed_subscription_ = client_->AddCookieChangedCallback(
212 base::Bind(&AboutSigninInternals::OnCookieChanged, 212 GaiaUrls::GetInstance()->gaia_url(),
213 base::Unretained(this))); 213 "LSID",
214 base::Bind(&AboutSigninInternals::OnCookieChanged,
215 base::Unretained(this)));
214 } 216 }
215 217
216 void AboutSigninInternals::Shutdown() { 218 void AboutSigninInternals::Shutdown() {
217 signin_manager_->RemoveSigninDiagnosticsObserver(this); 219 signin_manager_->RemoveSigninDiagnosticsObserver(this);
218 token_service_->RemoveDiagnosticsObserver(this); 220 token_service_->RemoveDiagnosticsObserver(this);
219 cookie_changed_subscription_.reset(); 221 cookie_changed_subscription_.reset();
220 } 222 }
221 223
222 void AboutSigninInternals::NotifyObservers() { 224 void AboutSigninInternals::NotifyObservers() {
223 scoped_ptr<base::DictionaryValue> signin_status_value = 225 scoped_ptr<base::DictionaryValue> signin_status_value =
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
278 } 280 }
279 281
280 void AboutSigninInternals::OnRefreshTokenReceived(std::string status) { 282 void AboutSigninInternals::OnRefreshTokenReceived(std::string status) {
281 NotifySigninValueChanged(REFRESH_TOKEN_RECEIVED, status); 283 NotifySigninValueChanged(REFRESH_TOKEN_RECEIVED, status);
282 } 284 }
283 285
284 void AboutSigninInternals::OnAuthenticationResultReceived(std::string status) { 286 void AboutSigninInternals::OnAuthenticationResultReceived(std::string status) {
285 NotifySigninValueChanged(AUTHENTICATION_RESULT_RECEIVED, status); 287 NotifySigninValueChanged(AUTHENTICATION_RESULT_RECEIVED, status);
286 } 288 }
287 289
288 void AboutSigninInternals::OnCookieChanged( 290 void AboutSigninInternals::OnCookieChanged(const net::CanonicalCookie& cookie,
289 const net::CanonicalCookie* cookie) { 291 bool removed) {
290 if (cookie->Name() == "LSID" && 292 DCHECK_EQ("LSID", cookie.Name());
291 cookie->Domain() == GaiaUrls::GetInstance()->gaia_url().host() && 293 DCHECK_EQ(GaiaUrls::GetInstance()->gaia_url().host(), cookie.Domain());
292 cookie->IsSecure() && 294 if (cookie.IsSecure() && cookie.IsHttpOnly()) {
293 cookie->IsHttpOnly()) {
294 GetCookieAccountsAsync(); 295 GetCookieAccountsAsync();
295 } 296 }
296 } 297 }
297 298
298 void AboutSigninInternals::GetCookieAccountsAsync() { 299 void AboutSigninInternals::GetCookieAccountsAsync() {
299 // Don't bother calling /ListAccounts if no one will observe the response. 300 // Don't bother calling /ListAccounts if no one will observe the response.
300 if (!gaia_fetcher_ && signin_observers_.might_have_observers()) { 301 if (!gaia_fetcher_ && signin_observers_.might_have_observers()) {
301 // There is no list account request in flight. 302 // There is no list account request in flight.
302 gaia_fetcher_.reset(new GaiaAuthFetcher( 303 gaia_fetcher_.reset(new GaiaAuthFetcher(
303 this, GaiaConstants::kChromeSource, client_->GetURLRequestContext())); 304 this, GaiaConstants::kChromeSource, client_->GetURLRequestContext()));
(...skipping 181 matching lines...) Expand 10 before | Expand all | Expand 10 after
485 std::sort(it->second.begin(), it->second.end(), TokenInfo::LessThan); 486 std::sort(it->second.begin(), it->second.end(), TokenInfo::LessThan);
486 const std::vector<TokenInfo*>& tokens = it->second; 487 const std::vector<TokenInfo*>& tokens = it->second;
487 for (size_t i = 0; i < tokens.size(); ++i) { 488 for (size_t i = 0; i < tokens.size(); ++i) {
488 base::DictionaryValue* token_info = tokens[i]->ToValue(); 489 base::DictionaryValue* token_info = tokens[i]->ToValue();
489 token_details->Append(token_info); 490 token_details->Append(token_info);
490 } 491 }
491 } 492 }
492 493
493 return signin_status.Pass(); 494 return signin_status.Pass();
494 } 495 }
OLDNEW
« no previous file with comments | « components/signin/core/browser/about_signin_internals.h ('k') | components/signin/core/browser/account_reconcilor.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698