| 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 namespace experimental.identity { | 5 namespace experimental.identity { |
| 6 | 6 |
| 7 [inline_doc] dictionary TokenDetails { | 7 [inline_doc] dictionary TokenDetails { |
| 8 // Whether to prompt the user to log in or grant scope permissions (if they | 8 // Whether to prompt the user to log in or grant scope permissions (if they |
| 9 // have not already done so). Default is false. | 9 // have not already done so). Default is false. |
| 10 boolean? interactive; | 10 boolean? interactive; |
| 11 }; | 11 }; |
| 12 | 12 |
| 13 [inline_doc] dictionary InvalidTokenDetails { |
| 14 // The specific token that should be removed from the cache. |
| 15 DOMString token; |
| 16 }; |
| 17 |
| 13 [inline_doc] dictionary WebAuthFlowDetails { | 18 [inline_doc] dictionary WebAuthFlowDetails { |
| 14 // The URL that initiates the auth flow. | 19 // The URL that initiates the auth flow. |
| 15 DOMString url; | 20 DOMString url; |
| 16 | 21 |
| 17 // Whether to launch auth flow in interactive mode. Default is false. | 22 // Whether to launch auth flow in interactive mode. Default is false. |
| 18 boolean? interactive; | 23 boolean? interactive; |
| 19 | 24 |
| 20 // Width of the window, if one is shown in interactive mode. | 25 // Width of the window, if one is shown in interactive mode. |
| 21 long? width; | 26 long? width; |
| 22 | 27 |
| 23 // Height of the window, if one is shown in interactive mode. | 28 // Height of the window, if one is shown in interactive mode. |
| 24 long? height; | 29 long? height; |
| 25 | 30 |
| 26 // X coordinate of the window, if one is shown in interactive mode. | 31 // X coordinate of the window, if one is shown in interactive mode. |
| 27 long? left; | 32 long? left; |
| 28 | 33 |
| 29 // Y coordinate of the window, if one is shown in interactive mode. | 34 // Y coordinate of the window, if one is shown in interactive mode. |
| 30 long? top; | 35 long? top; |
| 31 }; | 36 }; |
| 32 | 37 |
| 33 callback GetAuthTokenCallback = void (optional DOMString token); | 38 callback GetAuthTokenCallback = void (optional DOMString token); |
| 39 callback InvalidateAuthTokenCallback = void (); |
| 34 callback LaunchWebAuthFlowCallback = void (optional DOMString responseUrl); | 40 callback LaunchWebAuthFlowCallback = void (optional DOMString responseUrl); |
| 35 | 41 |
| 36 interface Functions { | 42 interface Functions { |
| 37 // Gets an OAuth2 access token as specified by the manifest. | 43 // Gets an OAuth2 access token as specified by the manifest. |
| 38 // | 44 // |
| 39 // |details| : Token options. | 45 // |details| : Token options. |
| 40 // |callback| : Called with an OAuth2 access token as specified by the | 46 // |callback| : Called with an OAuth2 access token as specified by the |
| 41 // manifest, or undefined if there was an error. | 47 // manifest, or undefined if there was an error. |
| 42 static void getAuthToken(optional TokenDetails details, | 48 static void getAuthToken(optional TokenDetails details, |
| 43 GetAuthTokenCallback callback); | 49 GetAuthTokenCallback callback); |
| 44 | 50 |
| 51 // Removes an OAuth2 access token from the Identity API's token cache. |
| 52 // When an access token is discovered to be invalid, it should be |
| 53 // passed to removeCachedAuthToken to remove it from the cache. The |
| 54 // app may then retrieve a fresh token with getAuthToken. |
| 55 // |
| 56 // |details| : Token information. |
| 57 // |callback| : Called when the token has been removed from the cache. |
| 58 static void removeCachedAuthToken(InvalidTokenDetails details, |
| 59 InvalidateAuthTokenCallback callback); |
| 60 |
| 45 // Starts an auth flow at the specified URL. | 61 // Starts an auth flow at the specified URL. |
| 46 // | 62 // |
| 47 // |details| : WebAuth flow options. | 63 // |details| : WebAuth flow options. |
| 48 // |callback| : Called with the URL redirected back to your application. | 64 // |callback| : Called with the URL redirected back to your application. |
| 49 static void launchWebAuthFlow(WebAuthFlowDetails details, | 65 static void launchWebAuthFlow(WebAuthFlowDetails details, |
| 50 LaunchWebAuthFlowCallback callback); | 66 LaunchWebAuthFlowCallback callback); |
| 51 }; | 67 }; |
| 52 }; | 68 }; |
| OLD | NEW |