- add sources.
[platform/framework/web/crosswalk.git] / src / chrome / common / extensions / api / experimental_identity.idl
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
3 // found in the LICENSE file.
4
5 // The <code>chrome.experimental.identity</code> API.
6 namespace experimental.identity {
7
8   [inline_doc] dictionary ExperimentalTokenDetails {
9     // Whether to prompt the user to log in or grant scope permissions (if they
10     // have not already done so). Default is false.
11     boolean? interactive;
12   };
13
14   [inline_doc] dictionary ExperimentalWebAuthFlowDetails {
15     // The URL that initiates the auth flow.
16     DOMString url;
17
18     // Whether to launch auth flow in interactive mode. Default is false.
19     boolean? interactive;
20
21     // Width of the window, if one is shown in interactive mode.
22     long? width;
23
24     // Height of the window, if one is shown in interactive mode.
25     long? height;
26
27     // X coordinate of the window, if one is shown in interactive mode.
28     long? left;
29
30     // Y coordinate of the window, if one is shown in interactive mode.
31     long? top;
32   };
33
34   callback GetAuthTokenCallback = void (optional DOMString token);
35   callback InvalidateAuthTokenCallback = void ();
36   callback LaunchWebAuthFlowCallback = void (optional DOMString responseUrl);
37
38   interface Functions {
39     // Gets an OAuth2 access token as specified by the manifest.
40     //
41     // |details| : Token options.
42     // |callback| : Called with an OAuth2 access token as specified by the
43     // manifest, or undefined if there was an error.
44     static void getAuthToken(optional ExperimentalTokenDetails details,
45                              GetAuthTokenCallback callback);
46
47     // Starts an auth flow at the specified URL.
48     //
49     // |details| : WebAuth flow options.
50     // |callback| : Called with the URL redirected back to your application.
51     static void launchWebAuthFlow(ExperimentalWebAuthFlowDetails details,
52                                   LaunchWebAuthFlowCallback callback);
53   };
54 };