| Index: chrome/browser/extensions/api/identity/identity_api.h
|
| ===================================================================
|
| --- chrome/browser/extensions/api/identity/identity_api.h (revision 146190)
|
| +++ chrome/browser/extensions/api/identity/identity_api.h (working copy)
|
| @@ -13,6 +13,7 @@
|
| #include "chrome/browser/extensions/app_notify_channel_setup.h"
|
| #include "chrome/browser/extensions/extension_install_prompt.h"
|
| #include "chrome/browser/extensions/extension_function.h"
|
| +#include "chrome/browser/ui/webui/signin/login_ui_service.h"
|
| #include "chrome/common/net/gaia/oauth2_mint_token_flow.h"
|
|
|
| class GoogleServiceAuthError;
|
| @@ -21,31 +22,49 @@
|
|
|
| class GetAuthTokenFunction : public AsyncExtensionFunction,
|
| public OAuth2MintTokenFlow::Delegate,
|
| - public ExtensionInstallPrompt::Delegate {
|
| + public ExtensionInstallPrompt::Delegate,
|
| + public LoginUIService::Observer {
|
| public:
|
| DECLARE_EXTENSION_FUNCTION_NAME("experimental.identity.getAuthToken");
|
|
|
| GetAuthTokenFunction();
|
|
|
| - private:
|
| + protected:
|
| virtual ~GetAuthTokenFunction();
|
|
|
| + private:
|
| // ExtensionFunction:
|
| virtual bool RunImpl() OVERRIDE;
|
|
|
| // OAuth2MintTokenFlow::Delegate implementation:
|
| virtual void OnMintTokenSuccess(const std::string& access_token) OVERRIDE;
|
| - virtual void OnMintTokenFailure(const GoogleServiceAuthError& error) OVERRIDE;
|
| + virtual void OnMintTokenFailure(
|
| + const GoogleServiceAuthError& error) OVERRIDE;
|
| virtual void OnIssueAdviceSuccess(
|
| const IssueAdviceInfo& issue_advice) OVERRIDE;
|
|
|
| + // LoginUIService::Observer implementation.
|
| + virtual void OnLoginUIShown(LoginUIService::LoginUI* ui) OVERRIDE;
|
| + virtual void OnLoginUIClosed(LoginUIService::LoginUI* ui) OVERRIDE;
|
| +
|
| // ExtensionInstallPrompt::Delegate implementation:
|
| virtual void InstallUIProceed() OVERRIDE;
|
| virtual void InstallUIAbort(bool user_initiated) OVERRIDE;
|
|
|
| + // Shows the login UI in a browser popup.
|
| + bool StartLogin();
|
| // Starts a MintTokenFlow with the given mode; Returns success.
|
| bool StartFlow(OAuth2MintTokenFlow::Mode mode);
|
|
|
| + void ShowLoginPopup();
|
| + const Extension::OAuth2Info& GetOAuth2Info() const;
|
| +
|
| + // Checks if there is a master login token to mint tokens for the extension.
|
| + bool HasLoginToken() const;
|
| +
|
| + // Gets the token mint flow mode based on a command-line flag.
|
| + OAuth2MintTokenFlow::Mode GetTokenFlowMode() const;
|
| +
|
| bool interactive_;
|
| scoped_ptr<OAuth2MintTokenFlow> flow_;
|
|
|
|
|