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

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

Issue 10701041: implement sign in dialog (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 8 years, 5 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
===================================================================
--- chrome/browser/extensions/api/identity/identity_api.h (revision 146190)
+++ chrome/browser/extensions/api/identity/identity_api.h (working copy)
@@ -13,39 +13,79 @@
#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 GetAuthTokenFunctionTest;
+class MockGetAuthTokenFunction;
class GoogleServiceAuthError;
namespace extensions {
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:
+ static const char kInvalidClientId[];
Mihai Parparita -not on Chrome 2012/07/17 01:01:00 I don't think it's worth exposing these constants
Munjal (Google) 2012/07/19 22:35:42 That is what I did first. But then I thought that
Mihai Parparita -not on Chrome 2012/07/20 18:02:32 In that case, to be consistent with other exported
Munjal (Google) 2012/07/20 18:54:14 Done.
+ static const char kInvalidScopes[];
+ static const char kAuthFailure[];
+ static const char kNoGrant[];
+ static const char kUserRejected[];
+ static const char kUserNotSignedIn[];
+
+ protected:
virtual ~GetAuthTokenFunction();
+ private:
+ friend class ::GetAuthTokenFunctionTest;
+ friend class ::MockGetAuthTokenFunction;
+
// 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 {
+ // Do nothing when login ui is shown.
+ }
+ 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);
+ virtual void StartObservingLoginService();
+ virtual void StopObservingLoginService();
+ virtual void ShowLoginPopup();
+ virtual void ShowOAuthApprovalDialog(const IssueAdviceInfo& issue_advice);
+ virtual const std::string& GetExtensionId() const;
+ virtual const Extension::OAuth2Info& GetOAuth2Info() const;
+ // Caller owns the returned instance.
+ virtual OAuth2MintTokenFlow* CreateMintTokenFlow(
+ OAuth2MintTokenFlow::Mode mode);
+
+ // Checks if there is a master login token to mint tokens for the extension.
+ virtual 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_;
@@ -59,6 +99,8 @@
public:
DECLARE_EXTENSION_FUNCTION_NAME("experimental.identity.launchWebAuthFlow");
+ static const char kInvalidRedirect[];
+
LaunchWebAuthFlowFunction();
private:

Powered by Google App Engine
This is Rietveld 408576698