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

Unified Diff: chrome/browser/extensions/api/identity/identity_api.h

Issue 274853002: Identity API: add chrome.identity.getAccounts (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: add IDENTITY_GETACCOUNTS to histograms.xml 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/extensions/api/identity/identity_api.h
diff --git a/chrome/browser/extensions/api/identity/identity_api.h b/chrome/browser/extensions/api/identity/identity_api.h
index a4346208a21601824630c55517511ae8a97395ae..8551c1c4632b3323000d3fb48513a577423cf1bd 100644
--- a/chrome/browser/extensions/api/identity/identity_api.h
+++ b/chrome/browser/extensions/api/identity/identity_api.h
@@ -108,6 +108,10 @@ class IdentityAPI : public BrowserContextKeyedAPI,
const CachedTokens& GetAllCachedTokens();
+ // Account queries.
+ std::vector<std::string> GetAccounts() const;
+
+ // Global error reporting.
void ReportAuthError(const GoogleServiceAuthError& error);
GoogleServiceAuthError GetAuthStatusForTest() const;
@@ -124,6 +128,8 @@ class IdentityAPI : public BrowserContextKeyedAPI,
void AddShutdownObserver(ShutdownObserver* observer);
void RemoveShutdownObserver(ShutdownObserver* observer);
+ void SetAccountStateForTest(AccountIds ids, bool is_signed_in);
+
private:
friend class BrowserContextKeyedAPIFactory<IdentityAPI>;
@@ -141,6 +147,20 @@ class IdentityAPI : public BrowserContextKeyedAPI,
template <>
void BrowserContextKeyedAPIFactory<IdentityAPI>::DeclareFactoryDependencies();
+class IdentityGetAccountsFunction : public ChromeUIThreadExtensionFunction {
+ public:
+ DECLARE_EXTENSION_FUNCTION("identity.getAccounts",
+ IDENTITY_GETACCOUNTS);
+
+ IdentityGetAccountsFunction();
+
+ private:
+ virtual ~IdentityGetAccountsFunction();
+
+ // UIThreadExtensionFunction implementation.
+ virtual ExtensionFunction::ResponseAction Run() OVERRIDE;
+};
+
// identity.getAuthToken fetches an OAuth 2 function for the
// caller. The request has three sub-flows: non-interactive,
// interactive, and sign-in.

Powered by Google App Engine
This is Rietveld 408576698