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

Unified Diff: chrome/browser/signin/profile_oauth2_token_service_request.h

Issue 299943003: Refactor ProfileOAuth2TokenServiceRequest into OAuth2TokenServiceRequest (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Allow ProfileOAuth2TokenServiceRequestTest to free UI thread resources. Created 6 years, 7 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: chrome/browser/signin/profile_oauth2_token_service_request.h
diff --git a/chrome/browser/signin/profile_oauth2_token_service_request.h b/chrome/browser/signin/profile_oauth2_token_service_request.h
index e7f628dde3f11e9601de33aaf4221942b903c715..e0d26ca456dd28d6861cafd2b375cec1732595a8 100644
--- a/chrome/browser/signin/profile_oauth2_token_service_request.h
+++ b/chrome/browser/signin/profile_oauth2_token_service_request.h
@@ -10,6 +10,7 @@
#include "base/threading/non_thread_safe.h"
#include "google_apis/gaia/oauth2_token_service.h"
+#include "google_apis/gaia/oauth2_token_service_proxy.h"
class Profile;
@@ -25,7 +26,6 @@ class ProfileOAuth2TokenServiceRequest : public OAuth2TokenService::Request,
public base::NonThreadSafe {
public:
// Creates and starts a request for |account_id| and |scopes|.
- // Uses the primary account id if |account_id| is the empty string.
static ProfileOAuth2TokenServiceRequest* CreateAndStart(
Profile* profile,
const std::string& account_id,
@@ -38,16 +38,34 @@ class ProfileOAuth2TokenServiceRequest : public OAuth2TokenService::Request,
virtual std::string GetAccountId() const OVERRIDE;
private:
- class Core;
- friend class Core;
+ typedef base::Callback<void(OAuth2TokenService*)> GetTokenServiceCallback;
ProfileOAuth2TokenServiceRequest(Profile* profile,
const std::string& account_id,
const OAuth2TokenService::ScopeSet& scopes,
OAuth2TokenService::Consumer* consumer);
+ // Retrieve |profile|'s OAuth2TokenService and task runner. Pass them to
+ // |callback| in the |callers_task_runner| thread.
+ static void GetTokenService(
+ Profile* profile,
+ const scoped_refptr<base::SequencedTaskRunner>& callers_task_runner,
+ const GetTokenServiceCallback& callback);
+
+ void ContinueWithTokenService(OAuth2TokenService* token_service);
+
+ // Invoked when the request has completed.
+ void RequestTokenDone(const GoogleServiceAuthError& error,
+ const std::string& access_token,
+ const base::Time& expiration_time);
+
+ std::string account_id_;
+ OAuth2TokenService::ScopeSet scopes_;
OAuth2TokenService::Consumer* const consumer_;
- scoped_refptr<Core> core_;
+ scoped_ptr<OAuth2TokenServiceProxy> proxy_;
+
+ // Must be last data member.
+ base::WeakPtrFactory<ProfileOAuth2TokenServiceRequest> weak_ptr_factory_;
DISALLOW_COPY_AND_ASSIGN(ProfileOAuth2TokenServiceRequest);
};

Powered by Google App Engine
This is Rietveld 408576698