Chromium Code Reviews| OLD | NEW |
|---|---|
| (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 [implemented_in = "chrome/browser/extensions/api/instance_id/instance_id_api.h"] | |
|
not at google - send to devlin
2015/04/22 17:21:42
the implemented_in is unnecessary; this should be
jianli
2015/04/22 20:18:20
Done.
| |
| 7 namespace instanceID { | |
| 8 // Parameters for getToken. | |
| 9 dictionary GetTokenParams { | |
| 10 // Identifies the entity that is authorized to access resources associated | |
| 11 // with this Instance ID. It can be another Instance ID or a project ID. | |
| 12 DOMString audience; | |
| 13 | |
| 14 // Identifies authorized actions that the authorized entity can take. | |
| 15 // E.g. for sending GCM messages, <code>GCM</code> scope should be used. | |
| 16 DOMString scope; | |
| 17 | |
| 18 // Allows including a small number of string key/value pairs that will be | |
| 19 // associated with the token and may be used in processing the request. | |
| 20 object? options; | |
|
fgorski
2015/04/22 17:34:59
Please ask Costin if this should be a string to st
jianli
2015/04/22 20:18:21
Yes, this was what I am told.
fgorski
2015/04/22 20:55:47
OK, what I was looking for is perhaps a way to spe
| |
| 21 }; | |
| 22 | |
| 23 // Parameters for deleteToken. | |
| 24 dictionary DeleteTokenParams { | |
| 25 // The audience that is passed for obtaining a token. | |
| 26 DOMString audience; | |
| 27 | |
| 28 // The scope that is passed for obtaining a token. | |
| 29 DOMString scope; | |
| 30 }; | |
| 31 | |
| 32 // |instanceID| : The Instance ID assigned to the app. | |
| 33 callback GetIDCallback = void(DOMString instanceID); | |
| 34 | |
| 35 // |creationTime| : The time when the Instance ID has been generated, | |
| 36 // represented in milliseconds since the epoch. | |
| 37 callback GetCreationTimeCallback = void(long creationTime); | |
| 38 | |
| 39 // |token| : The token assigned by the requested service. | |
| 40 callback GetTokenCallback = void(DOMString token); | |
| 41 | |
| 42 callback DeleteIDCallback = void(); | |
| 43 | |
| 44 callback DeleteTokenCallback = void(); | |
| 45 | |
| 46 interface Functions { | |
| 47 // Retrieves an identifier for the app instance. The instance ID will be | |
| 48 // returned by the <code>callback</code>. | |
| 49 // The same ID will be returned as long as the application identity has not | |
| 50 // been revoked or expired. | |
| 51 // |callback| : Function called when the retrieval completes. It should | |
| 52 // check $(ref:runtime.lastError) for error when instanceID is empty. | |
| 53 static void getID(GetIDCallback callback); | |
| 54 | |
| 55 // Retrieves the time when the InstanceID has been generated. The creation | |
| 56 // time will be returned by the <code>callback</code>. | |
| 57 // |callback| : Function called when the retrieval completes. It should | |
| 58 // check $(ref:runtime.lastError) for error when creationTime is zero. | |
| 59 static void getCreationTime(GetCreationTimeCallback callback); | |
| 60 | |
| 61 // Return a token that allows the identified audience to access the service | |
| 62 // defined as scope. | |
| 63 // |getTokenParams| : getToken parameters. | |
| 64 // |callback| : Function called when the retrieval completes. It should | |
| 65 // check $(ref:runtime.lastError) for error when token is empty. | |
| 66 static void getToken(GetTokenParams getTokenParams, | |
| 67 GetTokenCallback callback); | |
| 68 | |
| 69 // Revokes a granted token. | |
| 70 // |deleteTokenParams| : deleteToken parameters. | |
| 71 // |callback| : Function called when the deletion completes. The token | |
| 72 // was revoked successfully if $(ref:runtime.lastError) is not set. | |
| 73 static void deleteToken(DeleteTokenParams deleteTokenParams, | |
| 74 DeleteTokenCallback callback); | |
| 75 | |
| 76 // Resets the app instance identifier and revokes all tokens associated with | |
| 77 // it. | |
| 78 // |callback| : Function called when the deletion completes. The instance | |
| 79 // identifier was revoked successfully if $(ref:runtime.lastError) is | |
| 80 // not set. | |
| 81 static void deleteID(DeleteIDCallback callback); | |
| 82 }; | |
| 83 | |
| 84 interface Events { | |
| 85 // Fired when all the granted tokens need to be refreshed. The Instance ID | |
| 86 // also needs to be refreshed when updateID is set to true. | |
| 87 // |updateID| : Instance ID also needs to be refreshed. | |
| 88 static void onTokenRefresh(boolean updateID); | |
| 89 }; | |
| 90 }; | |
| OLD | NEW |