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

Unified Diff: remoting/webapp/crd/js/host_controller.js

Issue 963103004: Remove getCached* methods from remoting.Identity. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase and jscompile fixes. Created 5 years, 10 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
« no previous file with comments | « remoting/webapp/app_remoting/js/app_remoting.js ('k') | remoting/webapp/crd/js/host_screen.js » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: remoting/webapp/crd/js/host_controller.js
diff --git a/remoting/webapp/crd/js/host_controller.js b/remoting/webapp/crd/js/host_controller.js
index 4a37ee24ea4f3098edc7340869d0231a29733bdc..17e29edd126084b6f19a9ad05645f9497f0dbebc 100644
--- a/remoting/webapp/crd/js/host_controller.js
+++ b/remoting/webapp/crd/js/host_controller.js
@@ -184,16 +184,18 @@ remoting.HostController.prototype.start = function(hostPin, consent, onDone,
private_key: privateKey
};
var hostOwner = clientBaseJid;
- var hostOwnerEmail = remoting.identity.getCachedEmail();
- if (hostOwner != xmppLogin) {
- hostConfig['host_owner'] = hostOwner;
- if (hostOwnerEmail != hostOwner) {
- hostConfig['host_owner_email'] = hostOwnerEmail;
- }
- }
- that.hostDaemonFacade_.startDaemon(
- hostConfig, consent, onStarted.bind(null, hostName, publicKey),
- onStartError);
+ remoting.identity.getEmail().then(
+ function(/** string */ hostOwnerEmail) {
+ if (hostOwner != xmppLogin) {
+ hostConfig['host_owner'] = hostOwner;
+ if (hostOwnerEmail != hostOwner) {
+ hostConfig['host_owner_email'] = hostOwnerEmail;
+ }
+ }
+ that.hostDaemonFacade_.startDaemon(
+ hostConfig, consent, onStarted.bind(null, hostName, publicKey),
+ onStartError);
+ });
}
/**
@@ -248,13 +250,14 @@ remoting.HostController.prototype.start = function(hostPin, consent, onDone,
onError);
} else {
// No authorization code returned, use regular user credential flow.
- that.hostDaemonFacade_.getPinHash(
- newHostId, hostPin, startHostWithHash.bind(
- null, hostName, publicKey, privateKey,
- remoting.identity.getCachedEmail(),
- remoting.oauth2.getRefreshToken(),
- remoting.identity.getCachedEmail()),
- onError);
+ remoting.identity.getEmail().then(
+ function(/** string */ email) {
+ that.hostDaemonFacade_.getPinHash(
+ newHostId, hostPin, startHostWithHash.bind(
+ null, hostName, publicKey, privateKey,
+ email, remoting.oauth2.getRefreshToken(), email),
+ onError);
+ });
}
} else {
console.log('Failed to register the host. Status: ' + xhr.status +
« no previous file with comments | « remoting/webapp/app_remoting/js/app_remoting.js ('k') | remoting/webapp/crd/js/host_screen.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698