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

Unified Diff: chrome/browser/resources/chromeos/arc_support/background.js

Issue 2388763002: Remove controller concept from the ARC support extension. (Closed)
Patch Set: Address comments. Created 4 years, 2 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 | « chrome/browser/chromeos/arc/arc_support_host.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/resources/chromeos/arc_support/background.js
diff --git a/chrome/browser/resources/chromeos/arc_support/background.js b/chrome/browser/resources/chromeos/arc_support/background.js
index e9d07f91861133c48f097d4ff83cbf89a05ac5da..a4a54dd4f0986f15adda654ec98fdd8a54ca3a9e 100644
--- a/chrome/browser/resources/chromeos/arc_support/background.js
+++ b/chrome/browser/resources/chromeos/arc_support/background.js
@@ -79,11 +79,11 @@ var INNER_HEIGHT = 688;
/**
* Sends a native message to ArcSupportHost.
- * @param {string} code The action code in message.
- * @param {Object=} opt_Props Extra properties for the message.
+ * @param {string} event The event type in message.
+ * @param {Object=} opt_props Extra properties for the message.
*/
-function sendNativeMessage(code, opt_Props) {
- var message = Object.assign({'action': code}, opt_Props);
+function sendNativeMessage(event, opt_props) {
+ var message = Object.assign({'event': event}, opt_props);
port.postMessage(message);
}
@@ -511,7 +511,7 @@ chrome.app.runtime.onLaunched.addListener(function() {
if (results && results.length == 1 && typeof results[0] == 'string' &&
results[0].substring(0, authCodePrefix.length) == authCodePrefix) {
var authCode = results[0].substring(authCodePrefix.length);
- sendNativeMessage('setAuthCode', {code: authCode});
+ sendNativeMessage('onAuthSucceeded', {code: authCode});
} else {
setErrorMessage(appWindow.contentWindow.loadTimeData.getString(
'authorizationFailed'));
@@ -572,23 +572,13 @@ chrome.app.runtime.onLaunched.addListener(function() {
termsAccepted = true;
var enableMetrics = doc.getElementById('enable-metrics');
- if (!enableMetrics.hidden) {
- sendNativeMessage('enableMetrics', {
- 'enabled': enableMetrics.checked
- });
- }
-
var enableBackupRestore = doc.getElementById('enable-backup-restore');
- sendNativeMessage('setBackupRestore', {
- 'enabled': enableBackupRestore.checked
- });
-
var enableLocationService = doc.getElementById('enable-location-service');
- sendNativeMessage('setLocationService', {
- 'enabled': enableLocationService.checked
+ sendNativeMessage('onAgreed', {
+ isMetricsEnabled: !enableMetrics.hidden && enableMetrics.checked,
+ isBackupRestoreEnabled: enableBackupRestore.checked,
+ isLocationServiceEnabled: enableLocationService.checked
});
-
- sendNativeMessage('startLso');
};
var onCancel = function() {
@@ -599,14 +589,16 @@ chrome.app.runtime.onLaunched.addListener(function() {
var onRetry = function() {
if (termsAccepted) {
- sendNativeMessage('startLso');
+ // Reuse the onAgree() in case that the user has already accepted
+ // the ToS.
+ onAgree();
} else {
loadInitialTerms();
}
};
var onSendFeedback = function() {
- sendNativeMessage('sendFeedback');
+ sendNativeMessage('onSendFeedbackClicked');
};
doc.getElementById('button-agree').addEventListener('click', onAgree);
« no previous file with comments | « chrome/browser/chromeos/arc/arc_support_host.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698