Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(255)

Side by Side Diff: chrome/common/extensions/api/instance_id.idl

Issue 1088593004: Add the IDL for chrome.instanceID API. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Sync again Created 5 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
(Empty)
1 // Copyright 2015 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 // Use the <code>chrome.instanceID</code> API to access the InstanceID service.
6 namespace instanceID {
7 // Parameters for getToken.
8 dictionary GetTokenParams {
9 // Identifies the entity that is authorized to access resources associated
10 // with this Instance ID. It can be another Instance ID or a project ID.
11 DOMString audience;
12
13 // Identifies authorized actions that the authorized entity can take.
14 // E.g. for sending GCM messages, <code>GCM</code> scope should be used.
15 DOMString scope;
16
17 // Allows including a small number of string key/value pairs that will be
18 // associated with the token and may be used in processing the request.
19 object? options;
20 };
21
22 // Parameters for deleteToken.
23 dictionary DeleteTokenParams {
24 // The audience that is passed for obtaining a token.
25 DOMString audience;
26
27 // The scope that is passed for obtaining a token.
28 DOMString scope;
29 };
30
31 // |instanceID| : The Instance ID assigned to the app.
32 callback GetIDCallback = void(DOMString instanceID);
33
34 // |creationTime| : The time when the Instance ID has been generated,
35 // represented in milliseconds since the epoch.
36 callback GetCreationTimeCallback = void(long creationTime);
37
38 // |token| : The token assigned by the requested service.
39 callback GetTokenCallback = void(DOMString token);
40
41 callback DeleteIDCallback = void();
42
43 callback DeleteTokenCallback = void();
44
45 interface Functions {
46 // Retrieves an identifier for the app instance. The instance ID will be
47 // returned by the <code>callback</code>.
48 // The same ID will be returned as long as the application identity has not
49 // been revoked or expired.
50 // |callback| : Function called when the retrieval completes. It should
51 // check $(ref:runtime.lastError) for error when instanceID is empty.
52 static void getID(GetIDCallback callback);
53
54 // Retrieves the time when the InstanceID has been generated. The creation
55 // time will be returned by the <code>callback</code>.
56 // |callback| : Function called when the retrieval completes. It should
57 // check $(ref:runtime.lastError) for error when creationTime is zero.
58 static void getCreationTime(GetCreationTimeCallback callback);
59
60 // Return a token that allows the identified audience to access the service
61 // defined as scope.
62 // |getTokenParams| : getToken parameters.
63 // |callback| : Function called when the retrieval completes. It should
64 // check $(ref:runtime.lastError) for error when token is empty.
65 static void getToken(GetTokenParams getTokenParams,
66 GetTokenCallback callback);
67
68 // Revokes a granted token.
69 // |deleteTokenParams| : deleteToken parameters.
70 // |callback| : Function called when the deletion completes. The token
71 // was revoked successfully if $(ref:runtime.lastError) is not set.
72 static void deleteToken(DeleteTokenParams deleteTokenParams,
73 DeleteTokenCallback callback);
74
75 // Resets the app instance identifier and revokes all tokens associated with
76 // it.
77 // |callback| : Function called when the deletion completes. The instance
78 // identifier was revoked successfully if $(ref:runtime.lastError) is
79 // not set.
80 static void deleteID(DeleteIDCallback callback);
81 };
82
83 interface Events {
84 // Fired when all the granted tokens need to be refreshed. The Instance ID
85 // also needs to be refreshed when updateID is set to true.
86 // |updateID| : Instance ID also needs to be refreshed.
87 static void onTokenRefresh(boolean updateID);
88 };
89 };
OLDNEW
« no previous file with comments | « chrome/common/extensions/api/_api_features.json ('k') | chrome/common/extensions/api/schemas.gypi » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698