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

Unified Diff: components/signin/core/browser/about_signin_internals.cc

Issue 602773002: Handle multiple signin_internal_uis by using a linked_ptr (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Remove unneeded headers Created 6 years, 3 months 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « components/signin/core/browser/about_signin_internals.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: components/signin/core/browser/about_signin_internals.cc
diff --git a/components/signin/core/browser/about_signin_internals.cc b/components/signin/core/browser/about_signin_internals.cc
index 86db713f65c99ddc0ba2b68d831a660b64e19033..74b664ce38a4032dd7c11cd92af783c79aca7ee7 100644
--- a/components/signin/core/browser/about_signin_internals.cc
+++ b/components/signin/core/browser/about_signin_internals.cc
@@ -220,10 +220,11 @@ void AboutSigninInternals::Shutdown() {
}
void AboutSigninInternals::NotifyObservers() {
+ scoped_ptr<base::DictionaryValue> signin_status_value =
+ signin_status_.ToValue(client_->GetProductVersion());
FOR_EACH_OBSERVER(AboutSigninInternals::Observer,
signin_observers_,
- OnSigninStateChanged(
- signin_status_.ToValue(client_->GetProductVersion())));
+ OnSigninStateChanged(signin_status_value.get()));
}
scoped_ptr<base::DictionaryValue> AboutSigninInternals::GetSigninStatus() {
@@ -295,7 +296,8 @@ void AboutSigninInternals::OnCookieChanged(
}
void AboutSigninInternals::GetCookieAccountsAsync() {
- if (!gaia_fetcher_) {
+ // Don't bother calling /ListAccounts if no one will observe the response.
+ if (!gaia_fetcher_ && signin_observers_.might_have_observers()) {
// There is no list account request in flight.
gaia_fetcher_.reset(new GaiaAuthFetcher(
this, GaiaConstants::kChromeSource, client_->GetURLRequestContext()));
@@ -324,9 +326,9 @@ void AboutSigninInternals::OnListAccountsFailure(
void AboutSigninInternals::OnListAccountsComplete(
std::vector<std::pair<std::string, bool> >& gaia_accounts) {
- scoped_ptr<base::DictionaryValue> signin_status(new base::DictionaryValue());
+ base::DictionaryValue signin_status;
base::ListValue* cookie_info = new base::ListValue();
- signin_status->Set("cookie_info", cookie_info);
+ signin_status.Set("cookie_info", cookie_info);
for (size_t i = 0; i < gaia_accounts.size(); ++i) {
AddCookieEntry(cookie_info,
@@ -340,7 +342,7 @@ void AboutSigninInternals::OnListAccountsComplete(
// Update the observers that the cookie's accounts are updated.
FOR_EACH_OBSERVER(AboutSigninInternals::Observer,
signin_observers_,
- OnCookieAccountsFetched(signin_status.Pass()));
+ OnCookieAccountsFetched(&signin_status));
}
AboutSigninInternals::TokenInfo::TokenInfo(
« no previous file with comments | « components/signin/core/browser/about_signin_internals.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698