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

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

Issue 12647008: Refactor OAuth2TokenService to have profile- and device-based implementations. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: rebase again Created 7 years, 8 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/android_profile_oauth2_token_service.h
diff --git a/chrome/browser/signin/android_profile_oauth2_token_service.h b/chrome/browser/signin/android_profile_oauth2_token_service.h
new file mode 100644
index 0000000000000000000000000000000000000000..14556c0309faed2cafb6cd9d645da37965433e84
--- /dev/null
+++ b/chrome/browser/signin/android_profile_oauth2_token_service.h
@@ -0,0 +1,51 @@
+// Copyright 2013 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef CHROME_BROWSER_SIGNIN_ANDROID_PROFILE_OAUTH2_TOKEN_SERVICE_H_
+#define CHROME_BROWSER_SIGNIN_ANDROID_PROFILE_OAUTH2_TOKEN_SERVICE_H_
+
+#include <string>
+
+#include "chrome/browser/signin/profile_oauth2_token_service.h"
+
+namespace net {
+class URLRequestContextGetter;
+}
+
+class TokenService;
+
+// A specialization of ProfileOAuth2TokenService that will be returned by
+// ProfileOAuth2TokenServiceFactory for OS_ANDROID. This instance uses
+// native Android features to lookup OAuth2 tokens.
+//
+// See |ProfileOAuth2TokenService| for usage details.
+//
+// Note: requests should be started from the UI thread. To start a
+// request from other thread, please use ProfileOAuth2TokenServiceRequest.
+class AndroidProfileOAuth2TokenService : public ProfileOAuth2TokenService {
+ public:
+ // Start the OAuth2 access token for the given scopes using
+ // ProfileSyncServiceAndroid.
+ virtual scoped_ptr<OAuth2TokenService::Request> StartRequest(
+ const OAuth2TokenService::ScopeSet& scopes,
+ OAuth2TokenService::Consumer* consumer) OVERRIDE;
+
+ virtual void InvalidateToken(const ScopeSet& scopes,
+ const std::string& invalid_token) OVERRIDE;
+
+ protected:
+ friend class ProfileOAuth2TokenServiceFactory;
+ explicit AndroidProfileOAuth2TokenService(
+ net::URLRequestContextGetter* getter);
+ virtual ~AndroidProfileOAuth2TokenService();
+
+ // Takes injected TokenService for testing.
+ bool ShouldCacheForRefreshToken(TokenService *token_service,
+ const std::string& refresh_token);
+
+ private:
+ DISALLOW_COPY_AND_ASSIGN(AndroidProfileOAuth2TokenService);
+};
+
+#endif // CHROME_BROWSER_SIGNIN_ANDROID_PROFILE_OAUTH2_TOKEN_SERVICE_H_
« no previous file with comments | « chrome/browser/prefs/browser_prefs.cc ('k') | chrome/browser/signin/android_profile_oauth2_token_service.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698