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

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

Issue 10537182: The user's consent to crash dumps reporting can now be set via the UI (Windows only). The checkbox … (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebased Created 8 years, 6 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/_locales/en/messages.json ('k') | remoting/webapp/host_plugin_proto.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 'use strict'; 5 'use strict';
6 6
7 /** @suppress {duplicate} */ 7 /** @suppress {duplicate} */
8 var remoting = remoting || {}; 8 var remoting = remoting || {};
9 9
10 /** @constructor */ 10 /** @constructor */
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
59 if (typeof(result) == 'undefined') { 59 if (typeof(result) == 'undefined') {
60 // If the plug-in can't be instantiated, for example on ChromeOS, then 60 // If the plug-in can't be instantiated, for example on ChromeOS, then
61 // return something sensible. 61 // return something sensible.
62 return remoting.HostController.State.NOT_IMPLEMENTED; 62 return remoting.HostController.State.NOT_IMPLEMENTED;
63 } else { 63 } else {
64 return result; 64 return result;
65 } 65 }
66 }; 66 };
67 67
68 /** 68 /**
69 * @param {function(boolean, boolean, boolean):void} callback Callback to be
70 * called when done.
71 */
72 remoting.HostController.prototype.getConsent = function(callback) {
73 this.plugin_.getUsageStatsConsent(callback);
74 };
75
76 /**
69 * Show or hide daemon-specific parts of the UI. 77 * Show or hide daemon-specific parts of the UI.
70 * @return {void} Nothing. 78 * @return {void} Nothing.
71 */ 79 */
72 remoting.HostController.prototype.updateDom = function() { 80 remoting.HostController.prototype.updateDom = function() {
73 var match = ''; 81 var match = '';
74 var state = this.state(); 82 var state = this.state();
75 switch (state) { 83 switch (state) {
76 case remoting.HostController.State.STARTED: 84 case remoting.HostController.State.STARTED:
77 remoting.updateModalUi('enabled', 'data-daemon-state'); 85 remoting.updateModalUi('enabled', 'data-daemon-state');
78 break; 86 break;
(...skipping 23 matching lines...) Expand all
102 chrome.i18n.getMessage(/*i18n-content*/'TOOLTIP_CONNECT', 110 chrome.i18n.getMessage(/*i18n-content*/'TOOLTIP_CONNECT',
103 this.localHost.hostName); 111 this.localHost.hostName);
104 } 112 }
105 document.getElementById('this-host-name').title = connectStr; 113 document.getElementById('this-host-name').title = connectStr;
106 document.getElementById('this-host-icon').title = connectStr; 114 document.getElementById('this-host-icon').title = connectStr;
107 }; 115 };
108 116
109 /** 117 /**
110 * Registers and starts the host. 118 * Registers and starts the host.
111 * @param {string} hostPin Host PIN. 119 * @param {string} hostPin Host PIN.
120 * @param {boolean} consent The user's consent to crash dump reporting.
112 * @param {function(remoting.HostController.AsyncResult):void} callback 121 * @param {function(remoting.HostController.AsyncResult):void} callback
113 * callback Callback to be called when done. 122 * callback Callback to be called when done.
114 * @return {void} Nothing. 123 * @return {void} Nothing.
115 */ 124 */
116 remoting.HostController.prototype.start = function(hostPin, callback) { 125 remoting.HostController.prototype.start = function(hostPin, consent, callback) {
117 /** @type {remoting.HostController} */ 126 /** @type {remoting.HostController} */
118 var that = this; 127 var that = this;
119 var hostName = this.plugin_.getHostName(); 128 var hostName = this.plugin_.getHostName();
120 129
121 /** @return {string} */ 130 /** @return {string} */
122 function generateUuid() { 131 function generateUuid() {
123 var random = new Uint16Array(8); 132 var random = new Uint16Array(8);
124 window.crypto.getRandomValues(random); 133 window.crypto.getRandomValues(random);
125 /** @type {Array.<string>} */ 134 /** @type {Array.<string>} */
126 var e = new Array(); 135 var e = new Array();
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
173 remoting.oauth2.USE_OFFICIAL_CLIENT_ID, 182 remoting.oauth2.USE_OFFICIAL_CLIENT_ID,
174 host_id: newHostId, 183 host_id: newHostId,
175 host_name: hostName, 184 host_name: hostName,
176 host_secret_hash: hostSecretHash, 185 host_secret_hash: hostSecretHash,
177 private_key: privateKey 186 private_key: privateKey
178 }); 187 });
179 /** @param {remoting.HostController.AsyncResult} result */ 188 /** @param {remoting.HostController.AsyncResult} result */
180 var onStartDaemon = function(result) { 189 var onStartDaemon = function(result) {
181 onStarted(callback, result, hostName); 190 onStarted(callback, result, hostName);
182 }; 191 };
183 that.plugin_.startDaemon(hostConfig, onStartDaemon); 192 that.plugin_.startDaemon(hostConfig, consent, onStartDaemon);
184 } else { 193 } else {
185 console.log('Failed to register the host. Status: ' + xhr.status + 194 console.log('Failed to register the host. Status: ' + xhr.status +
186 ' response: ' + xhr.responseText); 195 ' response: ' + xhr.responseText);
187 callback(remoting.HostController.AsyncResult.FAILED_DIRECTORY); 196 callback(remoting.HostController.AsyncResult.FAILED_DIRECTORY);
188 } 197 }
189 }; 198 };
190 199
191 /** 200 /**
192 * @param {string} privateKey 201 * @param {string} privateKey
193 * @param {string} publicKey 202 * @param {string} publicKey
(...skipping 169 matching lines...) Expand 10 before | Expand all | Expand 10 after
363 try { 372 try {
364 this.plugin_.getDaemonConfig(onConfig); 373 this.plugin_.getDaemonConfig(onConfig);
365 } catch (err) { 374 } catch (err) {
366 this.setHost(null); 375 this.setHost(null);
367 onDone(); 376 onDone();
368 } 377 }
369 }; 378 };
370 379
371 /** @type {remoting.HostController} */ 380 /** @type {remoting.HostController} */
372 remoting.hostController = null; 381 remoting.hostController = null;
OLDNEW
« no previous file with comments | « remoting/webapp/_locales/en/messages.json ('k') | remoting/webapp/host_plugin_proto.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698