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

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

Issue 2796683003: Expose local host state to authorized sites. (Closed)
Patch Set: Missing semicolon Created 3 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | remoting/webapp/files.gni » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: remoting/webapp/crd/js/options_export.js
diff --git a/remoting/webapp/crd/js/options_export.js b/remoting/webapp/crd/js/options_export.js
index 392b043ee065a1045a777995ba0f2561abfb348f..a3aa0f711a959b0880f7cbd293062c9321b066cf 100644
--- a/remoting/webapp/crd/js/options_export.js
+++ b/remoting/webapp/crd/js/options_export.js
@@ -20,17 +20,35 @@ remoting.OptionsExporter = function() {
remoting.OptionsExporter.migrateSettings_ = function() {
var result = new base.Deferred();
- chrome.storage.local.get(KEY_NAME, function(options) {
+ chrome.storage.local.get(OPTIONS_KEY_NAME, function(options) {
// If there are no host options stored, reformat the message response so
// that the sender doesn't interpret it as an error.
if (Object.keys(options).length == 0) {
- options[KEY_NAME] = '{}';
+ options[OPTIONS_KEY_NAME] = '{}';
}
- result.resolve(options);
+ var nativeMessagingHost = new remoting.HostDaemonFacade();
+ nativeMessagingHost.getDaemonState().then(
+ function(state) {
+ var reverse = new Map([
+ [remoting.HostController.State.NOT_IMPLEMENTED, 'NOT_IMPLEMENTED'],
+ [remoting.HostController.State.NOT_INSTALLED, 'NOT_INSTALLED'],
+ [remoting.HostController.State.STOPPED, 'STOPPED'],
+ [remoting.HostController.State.STARTING, 'STARTING'],
+ [remoting.HostController.State.STARTED, 'STARTED'],
+ [remoting.HostController.State.STOPPING, 'STOPPING'],
+ ]);
+ options[LOCAL_HOST_STATE_KEY_NAME] = reverse.get(state) || 'UNKNOWN';
+ result.resolve(options);
+ },
+ function(error) {
+ options[LOCAL_HOST_STATE_KEY_NAME] = 'UNKNOWN';
+ result.resolve(options);
+ });
})
return result.promise();
};
-var KEY_NAME = 'remoting-host-options';
+var OPTIONS_KEY_NAME = 'remoting-host-options';
+var LOCAL_HOST_STATE_KEY_NAME = 'local-host-state';
}());
« no previous file with comments | « no previous file | remoting/webapp/files.gni » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698