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

Unified 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 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 side-by-side diff with in-line comments
Download patch
Index: chrome/common/extensions/api/instance_id.idl
diff --git a/chrome/common/extensions/api/instance_id.idl b/chrome/common/extensions/api/instance_id.idl
new file mode 100644
index 0000000000000000000000000000000000000000..6e006e443d4d8c2f485aa1b8ce9780fc7fe8dcf5
--- /dev/null
+++ b/chrome/common/extensions/api/instance_id.idl
@@ -0,0 +1,90 @@
+// Copyright 2015 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.
+
+// Use the <code>chrome.instanceID</code> API to access the InstanceID service.
+[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.
+namespace instanceID {
+ // Parameters for getToken.
+ dictionary GetTokenParams {
+ // Identifies the entity that is authorized to access resources associated
+ // with this Instance ID. It can be another Instance ID or a project ID.
+ DOMString audience;
+
+ // Identifies authorized actions that the authorized entity can take.
+ // E.g. for sending GCM messages, <code>GCM</code> scope should be used.
+ DOMString scope;
+
+ // Allows including a small number of string key/value pairs that will be
+ // associated with the token and may be used in processing the request.
+ 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
+ };
+
+ // Parameters for deleteToken.
+ dictionary DeleteTokenParams {
+ // The audience that is passed for obtaining a token.
+ DOMString audience;
+
+ // The scope that is passed for obtaining a token.
+ DOMString scope;
+ };
+
+ // |instanceID| : The Instance ID assigned to the app.
+ callback GetIDCallback = void(DOMString instanceID);
+
+ // |creationTime| : The time when the Instance ID has been generated,
+ // represented in milliseconds since the epoch.
+ callback GetCreationTimeCallback = void(long creationTime);
+
+ // |token| : The token assigned by the requested service.
+ callback GetTokenCallback = void(DOMString token);
+
+ callback DeleteIDCallback = void();
+
+ callback DeleteTokenCallback = void();
+
+ interface Functions {
+ // Retrieves an identifier for the app instance. The instance ID will be
+ // returned by the <code>callback</code>.
+ // The same ID will be returned as long as the application identity has not
+ // been revoked or expired.
+ // |callback| : Function called when the retrieval completes. It should
+ // check $(ref:runtime.lastError) for error when instanceID is empty.
+ static void getID(GetIDCallback callback);
+
+ // Retrieves the time when the InstanceID has been generated. The creation
+ // time will be returned by the <code>callback</code>.
+ // |callback| : Function called when the retrieval completes. It should
+ // check $(ref:runtime.lastError) for error when creationTime is zero.
+ static void getCreationTime(GetCreationTimeCallback callback);
+
+ // Return a token that allows the identified audience to access the service
+ // defined as scope.
+ // |getTokenParams| : getToken parameters.
+ // |callback| : Function called when the retrieval completes. It should
+ // check $(ref:runtime.lastError) for error when token is empty.
+ static void getToken(GetTokenParams getTokenParams,
+ GetTokenCallback callback);
+
+ // Revokes a granted token.
+ // |deleteTokenParams| : deleteToken parameters.
+ // |callback| : Function called when the deletion completes. The token
+ // was revoked successfully if $(ref:runtime.lastError) is not set.
+ static void deleteToken(DeleteTokenParams deleteTokenParams,
+ DeleteTokenCallback callback);
+
+ // Resets the app instance identifier and revokes all tokens associated with
+ // it.
+ // |callback| : Function called when the deletion completes. The instance
+ // identifier was revoked successfully if $(ref:runtime.lastError) is
+ // not set.
+ static void deleteID(DeleteIDCallback callback);
+ };
+
+ interface Events {
+ // Fired when all the granted tokens need to be refreshed. The Instance ID
+ // also needs to be refreshed when updateID is set to true.
+ // |updateID| : Instance ID also needs to be refreshed.
+ static void onTokenRefresh(boolean updateID);
+ };
+};

Powered by Google App Engine
This is Rietveld 408576698