summaryrefslogtreecommitdiffstats
path: root/remoting/webapp
diff options
context:
space:
mode:
authoralexeypa@chromium.org <alexeypa@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-06-22 01:04:36 +0000
committeralexeypa@chromium.org <alexeypa@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-06-22 01:04:36 +0000
commitc481bb685b669e1eeb83582c682ffa69d44cd21f (patch)
treed68bdcbcd4b2d7a068e942ca6ccf10b63579ba92 /remoting/webapp
parent97e99569e2c85f40084ed9245122951154b72ad8 (diff)
downloadchromium_src-c481bb685b669e1eeb83582c682ffa69d44cd21f.zip
chromium_src-c481bb685b669e1eeb83582c682ffa69d44cd21f.tar.gz
chromium_src-c481bb685b669e1eeb83582c682ffa69d44cd21f.tar.bz2
The user's consent to crash dumps reporting can now be set via the UI (Windows only). The checkbox is presented on the Start/Change PIN dialog. The user's selection is then written to usagestats under ClientStateMedium key.
BUG=130678 Review URL: https://chromiumcodereview.appspot.com/10537182 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@143504 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'remoting/webapp')
-rw-r--r--remoting/webapp/_locales/en/messages.json4
-rw-r--r--remoting/webapp/host_controller.js13
-rw-r--r--remoting/webapp/host_plugin_proto.js8
-rw-r--r--remoting/webapp/host_setup_dialog.js29
-rw-r--r--remoting/webapp/main.css17
-rw-r--r--remoting/webapp/main.html9
6 files changed, 75 insertions, 5 deletions
diff --git a/remoting/webapp/_locales/en/messages.json b/remoting/webapp/_locales/en/messages.json
index cf5e90b..4ca21a7 100644
--- a/remoting/webapp/_locales/en/messages.json
+++ b/remoting/webapp/_locales/en/messages.json
@@ -226,6 +226,10 @@
"message": "You must enable remote connections if you want to use Chromoting to access this computer.",
"description": "Message displayed when the current computer is not accepting remote connections, instructing the user how to enable them."
},
+ "HOST_SETUP_CRASH_REPORTING_MESSAGE": {
+ "message": "Help us improve Chromoting by allowing us to collect usage statistics and crash reports.",
+ "description": "Message displayed next to the checkbox that the user can select to allow crash dump collection and reporting."
+ },
"HOST_SETUP_DIALOG_DESCRIPTION": {
"message": "To protect access to this computer, please choose a PIN. This PIN will be required when connecting from another location.",
"description": "Explanatory text displayed when the user enables remote access or changes the PIN."
diff --git a/remoting/webapp/host_controller.js b/remoting/webapp/host_controller.js
index 5f45dae..63ef1f1 100644
--- a/remoting/webapp/host_controller.js
+++ b/remoting/webapp/host_controller.js
@@ -66,6 +66,14 @@ remoting.HostController.prototype.state = function() {
};
/**
+ * @param {function(boolean, boolean, boolean):void} callback Callback to be
+ * called when done.
+ */
+remoting.HostController.prototype.getConsent = function(callback) {
+ this.plugin_.getUsageStatsConsent(callback);
+};
+
+/**
* Show or hide daemon-specific parts of the UI.
* @return {void} Nothing.
*/
@@ -109,11 +117,12 @@ remoting.HostController.prototype.setTooltips = function() {
/**
* Registers and starts the host.
* @param {string} hostPin Host PIN.
+ * @param {boolean} consent The user's consent to crash dump reporting.
* @param {function(remoting.HostController.AsyncResult):void} callback
* callback Callback to be called when done.
* @return {void} Nothing.
*/
-remoting.HostController.prototype.start = function(hostPin, callback) {
+remoting.HostController.prototype.start = function(hostPin, consent, callback) {
/** @type {remoting.HostController} */
var that = this;
var hostName = this.plugin_.getHostName();
@@ -180,7 +189,7 @@ remoting.HostController.prototype.start = function(hostPin, callback) {
var onStartDaemon = function(result) {
onStarted(callback, result, hostName);
};
- that.plugin_.startDaemon(hostConfig, onStartDaemon);
+ that.plugin_.startDaemon(hostConfig, consent, onStartDaemon);
} else {
console.log('Failed to register the host. Status: ' + xhr.status +
' response: ' + xhr.responseText);
diff --git a/remoting/webapp/host_plugin_proto.js b/remoting/webapp/host_plugin_proto.js
index da1697f..f845965 100644
--- a/remoting/webapp/host_plugin_proto.js
+++ b/remoting/webapp/host_plugin_proto.js
@@ -63,11 +63,17 @@ remoting.HostPlugin.prototype.getDaemonConfig = function(callback) {};
* @return {void} Nothing. */
remoting.HostPlugin.prototype.getDaemonVersion = function(callback) {};
+/** @param {function(boolean, boolean, boolean):void} callback Callback to be
+ * called with the consent.
+ * @return {void} Nothing. */
+remoting.HostPlugin.prototype.getUsageStatsConsent = function(callback) {};
+
/** @param {string} config Host configuration.
* @param {function(remoting.HostController.AsyncResult):void} callback
* Callback to be called when finished.
* @return {void} Nothing. */
-remoting.HostPlugin.prototype.startDaemon = function(config, callback) {};
+remoting.HostPlugin.prototype.startDaemon = function(
+ config, consent, callback) {};
/** @param {function(remoting.HostController.AsyncResult):void} callback
* Callback to be called when finished.
diff --git a/remoting/webapp/host_setup_dialog.js b/remoting/webapp/host_setup_dialog.js
index 1e80910..fe60ecb 100644
--- a/remoting/webapp/host_setup_dialog.js
+++ b/remoting/webapp/host_setup_dialog.js
@@ -17,6 +17,7 @@ remoting.HostSetupFlow = function(sequence) {
this.currentStep_ = 0;
this.state_ = sequence[0];
this.pin = '';
+ this.consent = false;
};
/** @enum {number} */
@@ -136,6 +137,10 @@ remoting.HostSetupDialog = function(hostController) {
this.pinEntry_.addEventListener('keypress', onDaemonPinEntryKeyPress, false);
this.pinEntry_.addEventListener('keypress', noDigitsInPin, false);
this.pinConfirm_.addEventListener('keypress', noDigitsInPin, false);
+
+ this.usageStats_ = document.getElementById('usagestats-consent');
+ this.usageStatsCheckbox_ =
+ document.getElementById('usagestats-consent-checkbox');
};
/**
@@ -145,6 +150,25 @@ remoting.HostSetupDialog = function(hostController) {
* @return {void} Nothing.
*/
remoting.HostSetupDialog.prototype.showForStart = function() {
+ /** @type {remoting.HostSetupDialog} */
+ var that = this;
+
+ /**
+ * @param {boolean} supported True if crash dump reporting is supported by
+ * the host.
+ * @param {boolean} allowed True if crash dump reporting is allowed.
+ * @param {boolean} set_by_policy True if crash dump reporting is controlled
+ * by policy.
+ */
+ var onGetConsent = function(supported, allowed, set_by_policy) {
+ that.usageStats_.hidden = !supported;
+ that.usageStatsCheckbox_.checked = allowed;
+ that.usageStatsCheckbox_.disabled = set_by_policy;
+ };
+ this.usageStats_.hidden = false;
+ this.usageStatsCheckbox_.checked = true;
+ this.hostController_.getConsent(onGetConsent);
+
var flow = [
remoting.HostSetupFlow.State.ASK_PIN,
remoting.HostSetupFlow.State.STARTING_HOST,
@@ -165,6 +189,7 @@ remoting.HostSetupDialog.prototype.showForStart = function() {
* @return {void} Nothing.
*/
remoting.HostSetupDialog.prototype.showForPin = function() {
+ this.usageStats_.hidden = true;
this.startNewFlow_(
[remoting.HostSetupFlow.State.ASK_PIN,
remoting.HostSetupFlow.State.UPDATING_PIN,
@@ -296,7 +321,7 @@ remoting.HostSetupDialog.prototype.startHost_ = function() {
flow.switchToNextStep(result);
that.updateState_();
}
- this.hostController_.start(this.flow_.pin, onHostStarted);
+ this.hostController_.start(this.flow_.pin, this.flow_.consent, onHostStarted);
};
remoting.HostSetupDialog.prototype.updatePin_ = function() {
@@ -367,6 +392,8 @@ remoting.HostSetupDialog.prototype.onPinSubmit_ = function() {
}
this.pinErrorDiv_.hidden = true;
this.flow_.pin = pin1;
+ this.flow_.consent = !this.usageStats_.hidden &&
+ (this.usageStatsCheckbox_.value == "on");
this.flow_.switchToNextStep(remoting.HostController.AsyncResult.OK);
this.updateState_();
};
diff --git a/remoting/webapp/main.css b/remoting/webapp/main.css
index 2eb073a..d76c035 100644
--- a/remoting/webapp/main.css
+++ b/remoting/webapp/main.css
@@ -465,7 +465,7 @@ button {
margin-top: 24px;
}
-#ask-pin-form label {
+#ask-pin-form .table-label {
min-width: 120px;
text-align: __MSG_@@bidi_end_edge__;
display: inline-block;
@@ -475,6 +475,21 @@ button {
margin-bottom: 8px;
}
+#ask-pin-form #usagestats-consent-checkbox {
+ /*
+ * TODO(alexeypa): 'float' is overkill for such a simple layout. Find
+ * a simpler way to express it. See: http://crbug.com/134063
+ */
+ float: left;
+ height: auto;
+ vertical-align: top;
+}
+
+#ask-pin-form #usagestats-consent-label {
+ font-weight: normal;
+ line-height: normal;
+}
+
#current-email {
color: rgba(0, 0, 0, 0.5);
}
diff --git a/remoting/webapp/main.html b/remoting/webapp/main.html
index 1c1d822..17a338c 100644
--- a/remoting/webapp/main.html
+++ b/remoting/webapp/main.html
@@ -221,6 +221,15 @@ found in the LICENSE file.
</td>
<tr>
</table>
+ <div id="usagestats-consent"
+ hidden>
+ <input id="usagestats-consent-checkbox" type="checkbox">
+ <label id="usagestats-consent-label"
+ for="usagestats-consent-checkbox">
+ <span i18n-content="HOST_SETUP_CRASH_REPORTING_MESSAGE">
+ </span>
+ </label>
+ </div>
<div id="daemon-pin-error-div" class="message centered" hidden>
<span id="daemon-pin-error-message" class="error-state">
</span>