OLD | NEW |
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 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 // Use the <code>chrome.identity</code> API to get OAuth2 access tokens. | 5 // Use the <code>chrome.identity</code> API to get OAuth2 access tokens. |
6 namespace identity { | 6 namespace identity { |
7 | 7 |
8 dictionary TokenDetails { | 8 dictionary TokenDetails { |
9 // Fetching a token may require the user to sign-in to Chrome, or | 9 // Fetching a token may require the user to sign-in to Chrome, or |
10 // approve the application's requested scopes. If the interactive | 10 // approve the application's requested scopes. If the interactive |
(...skipping 28 matching lines...) Expand all Loading... |
39 boolean? interactive; | 39 boolean? interactive; |
40 }; | 40 }; |
41 | 41 |
42 dictionary AccountInfo { | 42 dictionary AccountInfo { |
43 // A unique identifier for the account. This ID will not change | 43 // A unique identifier for the account. This ID will not change |
44 // for the lifetime of the account. | 44 // for the lifetime of the account. |
45 DOMString id; | 45 DOMString id; |
46 }; | 46 }; |
47 | 47 |
48 callback GetAuthTokenCallback = void (optional DOMString token); | 48 callback GetAuthTokenCallback = void (optional DOMString token); |
| 49 callback GetAccountsCallback = void (AccountInfo[] accounts); |
49 callback InvalidateAuthTokenCallback = void (); | 50 callback InvalidateAuthTokenCallback = void (); |
50 callback LaunchWebAuthFlowCallback = void (optional DOMString responseUrl); | 51 callback LaunchWebAuthFlowCallback = void (optional DOMString responseUrl); |
51 | 52 |
52 interface Functions { | 53 interface Functions { |
| 54 // Retrieves a list of AccountInfo objects describing the accounts |
| 55 // present on the profile.<br> |
| 56 // <code>getAccounts</code> is only supported on dev channel. |
| 57 static void getAccounts(GetAccountsCallback callback); |
| 58 |
53 // Gets an OAuth2 access token using the client ID and scopes | 59 // Gets an OAuth2 access token using the client ID and scopes |
54 // specified in the <a | 60 // specified in the <a |
55 // href="app_identity.html#update_manifest"><code>oauth2</code> | 61 // href="app_identity.html#update_manifest"><code>oauth2</code> |
56 // section of manifest.json</a>. | 62 // section of manifest.json</a>. |
57 // | 63 // |
58 // The Identity API caches access tokens in memory, so it's ok to | 64 // The Identity API caches access tokens in memory, so it's ok to |
59 // call <code>getAuthToken</code> any time a token is | 65 // call <code>getAuthToken</code> any time a token is |
60 // required. The token cache automatically handles expiration. | 66 // required. The token cache automatically handles expiration. |
61 // | 67 // |
62 // |details| : Token options. | 68 // |details| : Token options. |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
106 // | 112 // |
107 // |path| : The path appended to the end of the generated URL. | 113 // |path| : The path appended to the end of the generated URL. |
108 [nocompile] static DOMString getRedirectURL(optional DOMString path); | 114 [nocompile] static DOMString getRedirectURL(optional DOMString path); |
109 }; | 115 }; |
110 | 116 |
111 interface Events { | 117 interface Events { |
112 // Fired when signin state changes for an account on the user's profile. | 118 // Fired when signin state changes for an account on the user's profile. |
113 static void onSignInChanged(AccountInfo account, boolean signedIn); | 119 static void onSignInChanged(AccountInfo account, boolean signedIn); |
114 }; | 120 }; |
115 }; | 121 }; |
OLD | NEW |