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

Side by Side Diff: remoting/webapp/identity.js

Issue 22339015: s/experimental.identity/identity (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 4 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 | Annotate | Revision Log
« no previous file with comments | « remoting/webapp/appsv2.patch ('k') | remoting/webapp/jscompiler_hacks.js » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 * Wrapper class for Chrome's identity API. 7 * Wrapper class for Chrome's identity API.
8 */ 8 */
9 9
10 'use strict'; 10 'use strict';
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
44 * 44 *
45 * @param {function(string):void} onOk Function to invoke with access token if 45 * @param {function(string):void} onOk Function to invoke with access token if
46 * an access token was successfully retrieved. 46 * an access token was successfully retrieved.
47 * @param {function(remoting.Error):void} onError Function to invoke with an 47 * @param {function(remoting.Error):void} onError Function to invoke with an
48 * error code on failure. 48 * error code on failure.
49 * @return {void} Nothing. 49 * @return {void} Nothing.
50 */ 50 */
51 remoting.Identity.prototype.callWithToken = function(onOk, onError) { 51 remoting.Identity.prototype.callWithToken = function(onOk, onError) {
52 this.pendingCallbacks_.push(new remoting.Identity.Callbacks(onOk, onError)); 52 this.pendingCallbacks_.push(new remoting.Identity.Callbacks(onOk, onError));
53 if (this.pendingCallbacks_.length == 1) { 53 if (this.pendingCallbacks_.length == 1) {
54 chrome.experimental.identity.getAuthToken( 54 chrome.identity.getAuthToken(
55 { 'interactive': false }, 55 { 'interactive': false },
56 this.onAuthComplete_.bind(this, false)); 56 this.onAuthComplete_.bind(this, false));
57 } 57 }
58 }; 58 };
59 59
60 /** 60 /**
61 * Get the user's email address. 61 * Get the user's email address.
62 * 62 *
63 * @param {function(string):void} onOk Callback invoked when the email 63 * @param {function(string):void} onOk Callback invoked when the email
64 * address is available. 64 * address is available.
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
125 // now. The consent callback is responsible for continuing the auth flow. 125 // now. The consent callback is responsible for continuing the auth flow.
126 this.consentCallback_(this.onAuthContinue_.bind(this)); 126 this.consentCallback_(this.onAuthContinue_.bind(this));
127 }; 127 };
128 128
129 /** 129 /**
130 * Called in response to the user signing in to the web-app. 130 * Called in response to the user signing in to the web-app.
131 * 131 *
132 * @private 132 * @private
133 */ 133 */
134 remoting.Identity.prototype.onAuthContinue_ = function() { 134 remoting.Identity.prototype.onAuthContinue_ = function() {
135 chrome.experimental.identity.getAuthToken( 135 chrome.identity.getAuthToken(
136 { 'interactive': true }, 136 { 'interactive': true },
137 this.onAuthComplete_.bind(this, true)); 137 this.onAuthComplete_.bind(this, true));
138 }; 138 };
139 139
140 /** 140 /**
141 * Internal representation for pair of callWithToken callbacks. 141 * Internal representation for pair of callWithToken callbacks.
142 * 142 *
143 * @param {function(string):void} onOk 143 * @param {function(string):void} onOk
144 * @param {function(remoting.Error):void} onError 144 * @param {function(remoting.Error):void} onError
145 * @constructor 145 * @constructor
146 * @private 146 * @private
147 */ 147 */
148 remoting.Identity.Callbacks = function(onOk, onError) { 148 remoting.Identity.Callbacks = function(onOk, onError) {
149 /** @type {function(string):void} */ 149 /** @type {function(string):void} */
150 this.onOk = onOk; 150 this.onOk = onOk;
151 /** @type {function(remoting.Error):void} */ 151 /** @type {function(remoting.Error):void} */
152 this.onError = onError; 152 this.onError = onError;
153 }; 153 };
OLDNEW
« no previous file with comments | « remoting/webapp/appsv2.patch ('k') | remoting/webapp/jscompiler_hacks.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698