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

Unified Diff: components/signin/core/browser/account_fetcher_service.h

Issue 1380103004: Delay fetching account info until OnRefreshTokensLoaded(). (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fix iOs Created 5 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 side-by-side diff with in-line comments
Download patch
Index: components/signin/core/browser/account_fetcher_service.h
diff --git a/components/signin/core/browser/account_fetcher_service.h b/components/signin/core/browser/account_fetcher_service.h
index a049b8d15ac633a814312eb26f3d9413791bf6b6..c82d8caaca325bb49fff81daf81dfcd83920dfb6 100644
--- a/components/signin/core/browser/account_fetcher_service.h
+++ b/components/signin/core/browser/account_fetcher_service.h
@@ -5,8 +5,6 @@
#ifndef COMPONENTS_SIGNIN_CORE_BROWSER_ACCOUNT_FETCHER_SERVICE_H_
#define COMPONENTS_SIGNIN_CORE_BROWSER_ACCOUNT_FETCHER_SERVICE_H_
-#include <list>
-
#include "base/containers/scoped_ptr_hash_map.h"
#include "base/threading/non_thread_safe.h"
#include "base/timer/timer.h"
@@ -44,16 +42,11 @@ class AccountFetcherService : public KeyedService,
void Initialize(SigninClient* signin_client,
OAuth2TokenService* token_service,
- AccountTrackerService* account_tracker_service,
- invalidation::InvalidationService* invalidation_service);
+ AccountTrackerService* account_tracker_service);
// KeyedService implementation
void Shutdown() override;
- // To be called after the Profile is fully initialized; permits network
- // calls to be executed.
- void EnableNetworkFetches();
-
// Indicates if all user information has been fetched. If the result is false,
// there are still unfininshed fetchers.
virtual bool IsAllUserInfoFetched() const;
@@ -64,9 +57,21 @@ class AccountFetcherService : public KeyedService,
return account_tracker_service_;
}
+ void SetupInvalidations(
+ invalidation::InvalidationService* invalidation_service);
+
+ // base::TestSimpleTaskRunner::RunUntilIdle() does not handle recursive
+ // delayed schedule calls. Hence we disable this scheduling in tests.
+ void DisableScheduledRefreshForTesting();
+
// Called by ChildAccountInfoFetcher.
void SetIsChildAccount(const std::string& account_id, bool is_child_account);
+ // OAuth2TokenService::Observer implementation.
+ void OnRefreshTokenAvailable(const std::string& account_id) override;
+ void OnRefreshTokenRevoked(const std::string& account_id) override;
+ void OnRefreshTokensLoaded() override;
+
private:
friend class AccountInfoFetcher;
friend class ChildAccountInfoFetcherImpl;
@@ -102,20 +107,16 @@ class AccountFetcherService : public KeyedService,
scoped_ptr<base::DictionaryValue> user_info);
void OnUserInfoFetchFailure(const std::string& account_id);
- // OAuth2TokenService::Observer implementation.
- void OnRefreshTokenAvailable(const std::string& account_id) override;
- void OnRefreshTokenRevoked(const std::string& account_id) override;
- void OnRefreshTokensLoaded() override;
-
AccountTrackerService* account_tracker_service_; // Not owned.
OAuth2TokenService* token_service_; // Not owned.
SigninClient* signin_client_; // Not owned.
invalidation::InvalidationService* invalidation_service_; // Not owned.
bool network_fetches_enabled_;
- std::list<std::string> pending_user_info_fetches_;
base::Time last_updated_;
base::OneShotTimer timer_;
bool shutdown_called_;
+ // Only disabled in tests.
+ bool scheduled_refresh_enabled_;
std::string child_request_account_id_;
scoped_ptr<ChildAccountInfoFetcher> child_info_request_;
« no previous file with comments | « components/invalidation/public/invalidator_state.h ('k') | components/signin/core/browser/account_fetcher_service.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698