summaryrefslogtreecommitdiff
path: root/chromium/extensions/shell/common/api/identity.idl
blob: f5e681e9b6f8d49a9b1122cc74768b4cd4cab27f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
// Copyright 2014 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

// Simplified implementation of the <code>chrome.identity</code> for app_shell.
namespace identity {

  dictionary GetAuthTokenDetails {
    // Ignored parameter. Exists only for compatibility.
    boolean? interactive;
  };

  dictionary InvalidTokenDetails {
    // Ignored parameter. Exists only for compatibility.
    DOMString? token;
  };

  // Called with the OAuth2 access token on success or undefined on error.
  callback GetAuthTokenCallback = void (optional DOMString token);
  
  // Called by removeCachedAuthToken().
  callback InvalidateAuthTokenCallback = void ();

  interface Functions {
    // Returns an OAuth2 access token for the current app_shell user for scopes
    // from the manifest. Does not prompt the user. 
    static void getAuthToken(GetAuthTokenDetails options,
                             GetAuthTokenCallback callback);

    // Stub. Calls callback immediately because app_shell does not cache access
    // tokens the way Chrome does.
    static void removeCachedAuthToken(InvalidTokenDetails details,
                                      InvalidateAuthTokenCallback callback);
  };

  interface Events {
    // Stub. Never fired because app_shell only supports a single user account.
    static void onSignInChanged(object account, boolean signedIn);
  };
};