| 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 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 80 // Starts an auth flow at the specified URL. | 80 // Starts an auth flow at the specified URL. |
| 81 // | 81 // |
| 82 // This method enables auth flows with non-Google identity | 82 // This method enables auth flows with non-Google identity |
| 83 // providers by launching a web view and navigating it to the | 83 // providers by launching a web view and navigating it to the |
| 84 // first URL in the provider's auth flow. When the provider | 84 // first URL in the provider's auth flow. When the provider |
| 85 // redirects to a URL matching the pattern | 85 // redirects to a URL matching the pattern |
| 86 // <code>https://<app-id>.chromiumapp.org/*</code>, the | 86 // <code>https://<app-id>.chromiumapp.org/*</code>, the |
| 87 // window will close, and the final redirect URL will be passed to | 87 // window will close, and the final redirect URL will be passed to |
| 88 // the <var>callback</var> function. | 88 // the <var>callback</var> function. |
| 89 // | 89 // |
| 90 // For a good user experience it is important interactive auth flows are |
| 91 // initiated by UI in your app explaining what the authorization is for. |
| 92 // Failing to do this will cause your users to get authorization requests |
| 93 // - or even Chrome sign in screens if they are not signed in - with |
| 94 // no context. In particular, do not launch an interactive auth flow when |
| 95 // your app is first launched. |
| 96 // |
| 90 // |details| : WebAuth flow options. | 97 // |details| : WebAuth flow options. |
| 91 // |callback| : Called with the URL redirected back to your application. | 98 // |callback| : Called with the URL redirected back to your application. |
| 92 static void launchWebAuthFlow(WebAuthFlowDetails details, | 99 static void launchWebAuthFlow(WebAuthFlowDetails details, |
| 93 LaunchWebAuthFlowCallback callback); | 100 LaunchWebAuthFlowCallback callback); |
| 94 | 101 |
| 95 // Generates a redirect URL to be used in |launchWebAuthFlow|. | 102 // Generates a redirect URL to be used in |launchWebAuthFlow|. |
| 96 // | 103 // |
| 97 // The generated URLs match the pattern | 104 // The generated URLs match the pattern |
| 98 // <code>https://<app-id>.chromiumapp.org/*</code>. | 105 // <code>https://<app-id>.chromiumapp.org/*</code>. |
| 99 // | 106 // |
| 100 // |path| : The path appended to the end of the generated URL. | 107 // |path| : The path appended to the end of the generated URL. |
| 101 [nocompile] static DOMString getRedirectURL(optional DOMString path); | 108 [nocompile] static DOMString getRedirectURL(optional DOMString path); |
| 102 }; | 109 }; |
| 103 | 110 |
| 104 interface Events { | 111 interface Events { |
| 105 // Fired when signin state changes for an account on the user's profile. | 112 // Fired when signin state changes for an account on the user's profile. |
| 106 static void onSignInChanged(AccountInfo account, boolean signedIn); | 113 static void onSignInChanged(AccountInfo account, boolean signedIn); |
| 107 }; | 114 }; |
| 108 }; | 115 }; |
| OLD | NEW |