OLD | NEW |
---|---|
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef CHROME_BROWSER_EXTENSIONS_API_IDENTITY_IDENTITY_API_H_ | 5 #ifndef CHROME_BROWSER_EXTENSIONS_API_IDENTITY_IDENTITY_API_H_ |
6 #define CHROME_BROWSER_EXTENSIONS_API_IDENTITY_IDENTITY_API_H_ | 6 #define CHROME_BROWSER_EXTENSIONS_API_IDENTITY_IDENTITY_API_H_ |
7 #pragma once | 7 #pragma once |
8 | 8 |
9 #include <string> | 9 #include <string> |
10 | 10 |
11 #include "base/memory/weak_ptr.h" | 11 #include "base/memory/weak_ptr.h" |
12 #include "chrome/browser/extensions/api/identity/extension_auth_flow.h" | |
12 #include "chrome/browser/extensions/app_notify_channel_setup.h" | 13 #include "chrome/browser/extensions/app_notify_channel_setup.h" |
13 #include "chrome/browser/extensions/extension_function.h" | 14 #include "chrome/browser/extensions/extension_function.h" |
14 #include "chrome/common/net/gaia/oauth2_mint_token_flow.h" | 15 #include "chrome/common/net/gaia/oauth2_mint_token_flow.h" |
15 | 16 |
16 class GoogleServiceAuthError; | 17 class GoogleServiceAuthError; |
17 | 18 |
19 namespace content { | |
20 class WebContents; | |
Mihai Parparita -not on Chrome
2012/05/04 22:37:18
This is unused.
Munjal (Google)
2012/05/08 19:26:35
Done.
| |
21 } | |
22 | |
18 namespace extensions { | 23 namespace extensions { |
19 | 24 |
20 class GetAuthTokenFunction : public AsyncExtensionFunction, | 25 class GetAuthTokenFunction : public AsyncExtensionFunction, |
21 public OAuth2MintTokenFlow::Delegate { | 26 public OAuth2MintTokenFlow::Delegate { |
22 public: | 27 public: |
23 DECLARE_EXTENSION_FUNCTION_NAME("experimental.identity.getAuthToken"); | 28 DECLARE_EXTENSION_FUNCTION_NAME("experimental.identity.getAuthToken"); |
24 | 29 |
25 GetAuthTokenFunction(); | 30 GetAuthTokenFunction(); |
26 | 31 |
27 private: | 32 private: |
28 virtual ~GetAuthTokenFunction(); | 33 virtual ~GetAuthTokenFunction(); |
29 | 34 |
30 // ExtensionFunction: | 35 // ExtensionFunction: |
31 virtual bool RunImpl() OVERRIDE; | 36 virtual bool RunImpl() OVERRIDE; |
32 | 37 |
33 // OAuth2MintTokenFlow::Delegate implementation: | 38 // OAuth2MintTokenFlow::Delegate implementation: |
34 virtual void OnMintTokenSuccess(const std::string& access_token) OVERRIDE; | 39 virtual void OnMintTokenSuccess(const std::string& access_token) OVERRIDE; |
35 virtual void OnMintTokenFailure(const GoogleServiceAuthError& error) OVERRIDE; | 40 virtual void OnMintTokenFailure(const GoogleServiceAuthError& error) OVERRIDE; |
36 | 41 |
37 scoped_ptr<OAuth2MintTokenFlow> flow_; | 42 scoped_ptr<OAuth2MintTokenFlow> flow_; |
38 }; | 43 }; |
39 | 44 |
45 class LaunchAuthFlowFunction : public AsyncExtensionFunction, | |
46 public ExtensionAuthFlow::Delegate { | |
47 public: | |
48 LaunchAuthFlowFunction(); | |
49 | |
50 private: | |
51 virtual ~LaunchAuthFlowFunction(); | |
52 virtual bool RunImpl() OVERRIDE; | |
53 | |
54 // ExtensionAuthFlow::Delegate implementation. | |
55 virtual void OnAuthFlowCompleted(const std::string& redirect_url) OVERRIDE; | |
56 virtual void OnAuthFlowFailed() OVERRIDE; | |
57 | |
58 scoped_ptr<ExtensionAuthFlow> auth_flow_; | |
59 | |
60 DECLARE_EXTENSION_FUNCTION_NAME("experimental.identity.launchAuthFlow"); | |
61 }; | |
62 | |
40 } // namespace extensions | 63 } // namespace extensions |
41 | 64 |
42 #endif // CHROME_BROWSER_EXTENSIONS_API_IDENTITY_IDENTITY_API_H_ | 65 #endif // CHROME_BROWSER_EXTENSIONS_API_IDENTITY_IDENTITY_API_H_ |
OLD | NEW |