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 AccountInfo { |
| 9 // A unique identifier for the account. This ID will not change |
| 10 // for the lifetime of the account. |
| 11 DOMString id; |
| 12 }; |
| 13 |
8 dictionary TokenDetails { | 14 dictionary TokenDetails { |
9 // Fetching a token may require the user to sign-in to Chrome, or | 15 // Fetching a token may require the user to sign-in to Chrome, or |
10 // approve the application's requested scopes. If the interactive | 16 // approve the application's requested scopes. If the interactive |
11 // flag is <code>true</code>, <code>getAuthToken</code> will | 17 // flag is <code>true</code>, <code>getAuthToken</code> will |
12 // prompt the user as necessary. When the flag is | 18 // prompt the user as necessary. When the flag is |
13 // <code>false</code> or omitted, <code>getAuthToken</code> will | 19 // <code>false</code> or omitted, <code>getAuthToken</code> will |
14 // return failure any time a prompt would be required. | 20 // return failure any time a prompt would be required. |
15 boolean? interactive; | 21 boolean? interactive; |
| 22 |
| 23 // The account ID whose token should be returned. If not |
| 24 // specified, the primary account for the profile will be used. |
| 25 // |
| 26 // <code>account</code> is only supported when the |
| 27 // "enable-new-profile-management" flag is set. |
| 28 AccountInfo? account; |
16 }; | 29 }; |
17 | 30 |
18 dictionary InvalidTokenDetails { | 31 dictionary InvalidTokenDetails { |
19 // The specific token that should be removed from the cache. | 32 // The specific token that should be removed from the cache. |
20 DOMString token; | 33 DOMString token; |
21 }; | 34 }; |
22 | 35 |
23 dictionary WebAuthFlowDetails { | 36 dictionary WebAuthFlowDetails { |
24 // The URL that initiates the auth flow. | 37 // The URL that initiates the auth flow. |
25 DOMString url; | 38 DOMString url; |
26 | 39 |
27 // Whether to launch auth flow in interactive mode. | 40 // Whether to launch auth flow in interactive mode. |
28 // | 41 // |
29 // Since some auth flows may immediately redirect to a result URL, | 42 // Since some auth flows may immediately redirect to a result URL, |
30 // <code>launchWebAuthFlow</code> hides its web view until the | 43 // <code>launchWebAuthFlow</code> hides its web view until the |
31 // first navigation either redirects to the final URL, or finishes | 44 // first navigation either redirects to the final URL, or finishes |
32 // loading a page meant to be displayed. | 45 // loading a page meant to be displayed. |
33 // | 46 // |
34 // If the interactive flag is <code>true</code>, the window will | 47 // If the interactive flag is <code>true</code>, the window will |
35 // be displayed when a page load completes. If the flag is | 48 // be displayed when a page load completes. If the flag is |
36 // <code>false</code> or omitted, <code>launchWebAuthFlow</code> | 49 // <code>false</code> or omitted, <code>launchWebAuthFlow</code> |
37 // will return with an error if the initial navigation does not | 50 // will return with an error if the initial navigation does not |
38 // complete the flow. | 51 // complete the flow. |
39 boolean? interactive; | 52 boolean? interactive; |
40 }; | 53 }; |
41 | 54 |
42 dictionary AccountInfo { | |
43 // A unique identifier for the account. This ID will not change | |
44 // for the lifetime of the account. | |
45 DOMString id; | |
46 }; | |
47 | |
48 callback GetAuthTokenCallback = void (optional DOMString token); | 55 callback GetAuthTokenCallback = void (optional DOMString token); |
49 callback GetAccountsCallback = void (AccountInfo[] accounts); | 56 callback GetAccountsCallback = void (AccountInfo[] accounts); |
50 callback InvalidateAuthTokenCallback = void (); | 57 callback InvalidateAuthTokenCallback = void (); |
51 callback LaunchWebAuthFlowCallback = void (optional DOMString responseUrl); | 58 callback LaunchWebAuthFlowCallback = void (optional DOMString responseUrl); |
52 | 59 |
53 interface Functions { | 60 interface Functions { |
54 // Retrieves a list of AccountInfo objects describing the accounts | 61 // Retrieves a list of AccountInfo objects describing the accounts |
55 // present on the profile.<br> | 62 // present on the profile.<br> |
56 // <code>getAccounts</code> is only supported on dev channel. | 63 // <code>getAccounts</code> is only supported on dev channel. |
57 static void getAccounts(GetAccountsCallback callback); | 64 static void getAccounts(GetAccountsCallback callback); |
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
112 // | 119 // |
113 // |path| : The path appended to the end of the generated URL. | 120 // |path| : The path appended to the end of the generated URL. |
114 [nocompile] static DOMString getRedirectURL(optional DOMString path); | 121 [nocompile] static DOMString getRedirectURL(optional DOMString path); |
115 }; | 122 }; |
116 | 123 |
117 interface Events { | 124 interface Events { |
118 // Fired when signin state changes for an account on the user's profile. | 125 // Fired when signin state changes for an account on the user's profile. |
119 static void onSignInChanged(AccountInfo account, boolean signedIn); | 126 static void onSignInChanged(AccountInfo account, boolean signedIn); |
120 }; | 127 }; |
121 }; | 128 }; |
OLD | NEW |