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 21 matching lines...) Expand all Loading... |
32 // loading a page meant to be displayed. | 32 // loading a page meant to be displayed. |
33 // | 33 // |
34 // If the interactive flag is <code>true</code>, the window will | 34 // If the interactive flag is <code>true</code>, the window will |
35 // be displayed when a page load completes. If the flag is | 35 // be displayed when a page load completes. If the flag is |
36 // <code>false</code> or omitted, <code>launchWebAuthFlow</code> | 36 // <code>false</code> or omitted, <code>launchWebAuthFlow</code> |
37 // will return with an error if the initial navigation does not | 37 // will return with an error if the initial navigation does not |
38 // complete the flow. | 38 // complete the flow. |
39 boolean? interactive; | 39 boolean? interactive; |
40 }; | 40 }; |
41 | 41 |
| 42 dictionary AccountInfo { |
| 43 DOMString id; |
| 44 DOMString? email; |
| 45 }; |
| 46 |
42 callback GetAuthTokenCallback = void (optional DOMString token); | 47 callback GetAuthTokenCallback = void (optional DOMString token); |
43 callback InvalidateAuthTokenCallback = void (); | 48 callback InvalidateAuthTokenCallback = void (); |
44 callback LaunchWebAuthFlowCallback = void (optional DOMString responseUrl); | 49 callback LaunchWebAuthFlowCallback = void (optional DOMString responseUrl); |
45 | 50 |
46 interface Functions { | 51 interface Functions { |
47 // Gets an OAuth2 access token using the client ID and scopes | 52 // Gets an OAuth2 access token using the client ID and scopes |
48 // specified in the <a | 53 // specified in the <a |
49 // href="app_identity.html#update_manifest"><code>oauth2</code> | 54 // href="app_identity.html#update_manifest"><code>oauth2</code> |
50 // section of manifest.json</a>. | 55 // section of manifest.json</a>. |
51 // | 56 // |
(...skipping 26 matching lines...) Expand all Loading... |
78 // first URL in the provider's auth flow. When the provider | 83 // first URL in the provider's auth flow. When the provider |
79 // redirects to a URL matching the pattern | 84 // redirects to a URL matching the pattern |
80 // <code>https://<app-id>.chromiumapp.org/*</code>, the | 85 // <code>https://<app-id>.chromiumapp.org/*</code>, the |
81 // window will close, and the final redirect URL will be passed to | 86 // window will close, and the final redirect URL will be passed to |
82 // the <var>callback</var> function. | 87 // the <var>callback</var> function. |
83 // | 88 // |
84 // |details| : WebAuth flow options. | 89 // |details| : WebAuth flow options. |
85 // |callback| : Called with the URL redirected back to your application. | 90 // |callback| : Called with the URL redirected back to your application. |
86 static void launchWebAuthFlow(WebAuthFlowDetails details, | 91 static void launchWebAuthFlow(WebAuthFlowDetails details, |
87 LaunchWebAuthFlowCallback callback); | 92 LaunchWebAuthFlowCallback callback); |
88 } | 93 }; |
89 ; | 94 |
| 95 interface Events { |
| 96 // Fired when signin state changes for an account on the user's profile. |
| 97 static void onSignInChanged(AccountInfo account, boolean signedIn); |
| 98 }; |
90 }; | 99 }; |
OLD | NEW |