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

Side by Side Diff: remoting/webapp/crd/js/oauth2_api.js

Issue 955283002: Converted remoting.Error from an enum to a class (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Requested changes. Created 5 years, 9 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
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 /** 5 /**
6 * @fileoverview 6 * @fileoverview
7 * OAuth2 API flow implementations. 7 * OAuth2 API flow implementations.
8 */ 8 */
9 9
10 'use strict'; 10 'use strict';
11 11
12 /** @suppress {duplicate} */ 12 /** @suppress {duplicate} */
13 var remoting = remoting || {}; 13 var remoting = remoting || {};
14 14
15 /** @interface */ 15 /** @interface */
16 remoting.OAuth2Api = function() { 16 remoting.OAuth2Api = function() {
17 }; 17 };
18 18
19 /** 19 /**
20 * Asynchronously retrieves a new access token from the server. 20 * Asynchronously retrieves a new access token from the server.
21 * 21 *
22 * @param {function(string, number): void} onDone Callback to invoke when 22 * @param {function(string, number): void} onDone Callback to invoke when
23 * the access token and expiration time are successfully fetched. 23 * the access token and expiration time are successfully fetched.
24 * @param {function(remoting.Error):void} onError Callback invoked if an 24 * @param {function(!remoting.Error):void} onError Callback invoked if an
25 * error occurs. 25 * error occurs.
26 * @param {string} clientId OAuth2 client ID. 26 * @param {string} clientId OAuth2 client ID.
27 * @param {string} clientSecret OAuth2 client secret. 27 * @param {string} clientSecret OAuth2 client secret.
28 * @param {string} refreshToken OAuth2 refresh token to be redeemed. 28 * @param {string} refreshToken OAuth2 refresh token to be redeemed.
29 * @return {void} Nothing. 29 * @return {void} Nothing.
30 */ 30 */
31 remoting.OAuth2Api.prototype.refreshAccessToken = function( 31 remoting.OAuth2Api.prototype.refreshAccessToken = function(
32 onDone, onError, clientId, clientSecret, refreshToken) { 32 onDone, onError, clientId, clientSecret, refreshToken) {
33 }; 33 };
34 34
35 /** 35 /**
36 * Asynchronously exchanges an authorization code for access and refresh tokens. 36 * Asynchronously exchanges an authorization code for access and refresh tokens.
37 * 37 *
38 * @param {function(string, string, number): void} onDone Callback to 38 * @param {function(string, string, number): void} onDone Callback to
39 * invoke when the refresh token, access token and access token expiration 39 * invoke when the refresh token, access token and access token expiration
40 * time are successfully fetched. 40 * time are successfully fetched.
41 * @param {function(remoting.Error):void} onError Callback invoked if an 41 * @param {function(!remoting.Error):void} onError Callback invoked if an
42 * error occurs. 42 * error occurs.
43 * @param {string} clientId OAuth2 client ID. 43 * @param {string} clientId OAuth2 client ID.
44 * @param {string} clientSecret OAuth2 client secret. 44 * @param {string} clientSecret OAuth2 client secret.
45 * @param {string} code OAuth2 authorization code. 45 * @param {string} code OAuth2 authorization code.
46 * @param {string} redirectUri Redirect URI used to obtain this code. 46 * @param {string} redirectUri Redirect URI used to obtain this code.
47 * @return {void} Nothing. 47 * @return {void} Nothing.
48 */ 48 */
49 remoting.OAuth2Api.prototype.exchangeCodeForTokens = function( 49 remoting.OAuth2Api.prototype.exchangeCodeForTokens = function(
50 onDone, onError, clientId, clientSecret, code, redirectUri) { 50 onDone, onError, clientId, clientSecret, code, redirectUri) {
51 }; 51 };
52 52
53 /** 53 /**
54 * Get the user's email address. 54 * Get the user's email address.
55 * 55 *
56 * TODO(jamiewalch): Reorder these parameters to match the typical chrome API 56 * TODO(jamiewalch): Reorder these parameters to match the typical chrome API
57 * convention of having callbacks at the end and remove the token parameter 57 * convention of having callbacks at the end and remove the token parameter
58 * to match remoting.HostListApi. 58 * to match remoting.HostListApi.
59 * 59 *
60 * @param {function(string):void} onDone Callback invoked when the email 60 * @param {function(string):void} onDone Callback invoked when the email
61 * address is available. 61 * address is available.
62 * @param {function(remoting.Error):void} onError Callback invoked if an 62 * @param {function(!remoting.Error):void} onError Callback invoked if an
63 * error occurs. 63 * error occurs.
64 * @param {string} token Access token. 64 * @param {string} token Access token.
65 * @return {void} Nothing. 65 * @return {void} Nothing.
66 */ 66 */
67 remoting.OAuth2Api.prototype.getEmail = function(onDone, onError, token) { 67 remoting.OAuth2Api.prototype.getEmail = function(onDone, onError, token) {
68 }; 68 };
69 69
70 /** 70 /**
71 * Get the user's email address and full name. 71 * Get the user's email address and full name.
72 * 72 *
73 * @param {function(string, string):void} onDone Callback invoked when the email 73 * @param {function(string, string):void} onDone Callback invoked when the email
74 * address and full name are available. 74 * address and full name are available.
75 * @param {function(remoting.Error):void} onError Callback invoked if an 75 * @param {function(!remoting.Error):void} onError Callback invoked if an
76 * error occurs. 76 * error occurs.
77 * @param {string} token Access token. 77 * @param {string} token Access token.
78 * @return {void} Nothing. 78 * @return {void} Nothing.
79 */ 79 */
80 remoting.OAuth2Api.prototype.getUserInfo = function(onDone, onError, token) { 80 remoting.OAuth2Api.prototype.getUserInfo = function(onDone, onError, token) {
81 }; 81 };
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698