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

Side by Side 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: Created 6 years, 2 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 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 205 matching lines...) Expand 10 before | Expand all | Expand 10 after
216 void AboutSigninInternals::Shutdown() { 216 void AboutSigninInternals::Shutdown() {
217 signin_manager_->RemoveSigninDiagnosticsObserver(this); 217 signin_manager_->RemoveSigninDiagnosticsObserver(this);
218 token_service_->RemoveDiagnosticsObserver(this); 218 token_service_->RemoveDiagnosticsObserver(this);
219 cookie_changed_subscription_.reset(); 219 cookie_changed_subscription_.reset();
220 } 220 }
221 221
222 void AboutSigninInternals::NotifyObservers() { 222 void AboutSigninInternals::NotifyObservers() {
223 FOR_EACH_OBSERVER(AboutSigninInternals::Observer, 223 FOR_EACH_OBSERVER(AboutSigninInternals::Observer,
224 signin_observers_, 224 signin_observers_,
225 OnSigninStateChanged( 225 OnSigninStateChanged(
226 signin_status_.ToValue(client_->GetProductVersion()))); 226 signin_status_.ToValue(client_->GetProductVersion())));
Roger Tawa OOO till Jul 10th 2014/09/25 01:14:05 Above line 223 do: scoped_ptr<base::Dictionary
Mike Lerman 2014/09/25 17:28:34 Done.
227 } 227 }
228 228
229 scoped_ptr<base::DictionaryValue> AboutSigninInternals::GetSigninStatus() { 229 scoped_ptr<base::DictionaryValue> AboutSigninInternals::GetSigninStatus() {
230 return signin_status_.ToValue(client_->GetProductVersion()).Pass(); 230 return signin_status_.ToValue(client_->GetProductVersion()).Pass();
231 } 231 }
232 232
233 void AboutSigninInternals::OnAccessTokenRequested( 233 void AboutSigninInternals::OnAccessTokenRequested(
234 const std::string& account_id, 234 const std::string& account_id,
235 const std::string& consumer_id, 235 const std::string& consumer_id,
236 const OAuth2TokenService::ScopeSet& scopes) { 236 const OAuth2TokenService::ScopeSet& scopes) {
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after
317 } 317 }
318 318
319 void AboutSigninInternals::OnListAccountsFailure( 319 void AboutSigninInternals::OnListAccountsFailure(
320 const GoogleServiceAuthError& error) { 320 const GoogleServiceAuthError& error) {
321 gaia_fetcher_.reset(); 321 gaia_fetcher_.reset();
322 VLOG(1) << "AboutSigninInternals::OnListAccountsFailure:" << error.ToString(); 322 VLOG(1) << "AboutSigninInternals::OnListAccountsFailure:" << error.ToString();
323 } 323 }
324 324
325 void AboutSigninInternals::OnListAccountsComplete( 325 void AboutSigninInternals::OnListAccountsComplete(
326 std::vector<std::pair<std::string, bool> >& gaia_accounts) { 326 std::vector<std::pair<std::string, bool> >& gaia_accounts) {
327 scoped_ptr<base::DictionaryValue> signin_status(new base::DictionaryValue()); 327 linked_ptr<base::DictionaryValue> signin_status(new base::DictionaryValue());
Roger Tawa OOO till Jul 10th 2014/09/25 01:14:05 Could declare this on the stack: base::Diction
Mike Lerman 2014/09/25 17:28:34 Done.
328 base::ListValue* cookie_info = new base::ListValue(); 328 base::ListValue* cookie_info = new base::ListValue();
329 signin_status->Set("cookie_info", cookie_info); 329 signin_status->Set("cookie_info", cookie_info);
330 330
331 for (size_t i = 0; i < gaia_accounts.size(); ++i) { 331 for (size_t i = 0; i < gaia_accounts.size(); ++i) {
332 AddCookieEntry(cookie_info, 332 AddCookieEntry(cookie_info,
333 gaia_accounts[i].first, 333 gaia_accounts[i].first,
334 gaia_accounts[i].second ? "Valid" : "Invalid"); 334 gaia_accounts[i].second ? "Valid" : "Invalid");
335 } 335 }
336 336
337 if (gaia_accounts.size() == 0) 337 if (gaia_accounts.size() == 0)
338 AddCookieEntry(cookie_info, "No Accounts Present.", ""); 338 AddCookieEntry(cookie_info, "No Accounts Present.", "");
339 339
340 // Update the observers that the cookie's accounts are updated. 340 // Update the observers that the cookie's accounts are updated.
341 FOR_EACH_OBSERVER(AboutSigninInternals::Observer, 341 FOR_EACH_OBSERVER(AboutSigninInternals::Observer,
342 signin_observers_, 342 signin_observers_,
343 OnCookieAccountsFetched(signin_status.Pass())); 343 OnCookieAccountsFetched(signin_status));
344 } 344 }
345 345
346 AboutSigninInternals::TokenInfo::TokenInfo( 346 AboutSigninInternals::TokenInfo::TokenInfo(
347 const std::string& consumer_id, 347 const std::string& consumer_id,
348 const OAuth2TokenService::ScopeSet& scopes) 348 const OAuth2TokenService::ScopeSet& scopes)
349 : consumer_id(consumer_id), 349 : consumer_id(consumer_id),
350 scopes(scopes), 350 scopes(scopes),
351 request_time(base::Time::Now()), 351 request_time(base::Time::Now()),
352 error(GoogleServiceAuthError::AuthErrorNone()), 352 error(GoogleServiceAuthError::AuthErrorNone()),
353 removed_(false) {} 353 removed_(false) {}
(...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after
481 std::sort(it->second.begin(), it->second.end(), TokenInfo::LessThan); 481 std::sort(it->second.begin(), it->second.end(), TokenInfo::LessThan);
482 const std::vector<TokenInfo*>& tokens = it->second; 482 const std::vector<TokenInfo*>& tokens = it->second;
483 for (size_t i = 0; i < tokens.size(); ++i) { 483 for (size_t i = 0; i < tokens.size(); ++i) {
484 base::DictionaryValue* token_info = tokens[i]->ToValue(); 484 base::DictionaryValue* token_info = tokens[i]->ToValue();
485 token_details->Append(token_info); 485 token_details->Append(token_info);
486 } 486 }
487 } 487 }
488 488
489 return signin_status.Pass(); 489 return signin_status.Pass();
490 } 490 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698