summaryrefslogtreecommitdiffstats
path: root/chromium/chrome/browser/resources/welcome/google_apps/google_app_proxy.js
diff options
context:
space:
mode:
Diffstat (limited to 'chromium/chrome/browser/resources/welcome/google_apps/google_app_proxy.js')
-rw-r--r--chromium/chrome/browser/resources/welcome/google_apps/google_app_proxy.js108
1 files changed, 52 insertions, 56 deletions
diff --git a/chromium/chrome/browser/resources/welcome/google_apps/google_app_proxy.js b/chromium/chrome/browser/resources/welcome/google_apps/google_app_proxy.js
index b4edc677e8a..63d890d8cf6 100644
--- a/chromium/chrome/browser/resources/welcome/google_apps/google_app_proxy.js
+++ b/chromium/chrome/browser/resources/welcome/google_apps/google_app_proxy.js
@@ -2,69 +2,65 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-cr.define('welcome', function() {
+import {addSingletonGetter, sendWithPromise} from 'chrome://resources/js/cr.m.js';
+import {BookmarkListItem} from '../shared/nux_types.js';
+
+/**
+ * NuxGoogleAppsSelections enum.
+ * These values are persisted to logs and should not be renumbered or
+ * re-used.
+ * See tools/metrics/histograms/enums.xml.
+ * @enum {number}
+ */
+const NuxGoogleAppsSelections = {
+ GMAIL_DEPRECATED: 0,
+ YOU_TUBE: 1,
+ MAPS: 2,
+ TRANSLATE: 3,
+ NEWS: 4,
+ CHROME_WEB_STORE: 5,
+};
+
+/** @interface */
+export class GoogleAppProxy {
/**
- * NuxGoogleAppsSelections enum.
- * These values are persisted to logs and should not be renumbered or
- * re-used.
- * See tools/metrics/histograms/enums.xml.
- * @enum {number}
+ * Google app IDs are local to the list of Google apps, so their icon must
+ * be cached by the handler that provided the IDs.
+ * @param {number} appId
*/
- const NuxGoogleAppsSelections = {
- GMAIL_DEPRECATED: 0,
- YOU_TUBE: 1,
- MAPS: 2,
- TRANSLATE: 3,
- NEWS: 4,
- CHROME_WEB_STORE: 5,
- };
+ cacheBookmarkIcon(appId) {}
- /** @interface */
- class GoogleAppProxy {
- /**
- * Google app IDs are local to the list of Google apps, so their icon must
- * be cached by the handler that provided the IDs.
- * @param {number} appId
- */
- cacheBookmarkIcon(appId) {}
+ /**
+ * Returns a promise for an array of Google apps.
+ * @return {!Promise<!Array<!BookmarkListItem>>}
+ */
+ getAppList() {}
- /**
- * Returns a promise for an array of Google apps.
- * @return {!Promise<!Array<!welcome.BookmarkListItem>>}
- */
- getAppList() {}
+ /**
+ * @param {number} providerId This should match one of the histogram enum
+ * value for NuxGoogleAppsSelections.
+ */
+ recordProviderSelected(providerId) {}
+}
- /**
- * @param {number} providerId This should match one of the histogram enum
- * value for NuxGoogleAppsSelections.
- */
- recordProviderSelected(providerId) {}
+/** @implements {GoogleAppProxy} */
+export class GoogleAppProxyImpl {
+ /** @override */
+ cacheBookmarkIcon(appId) {
+ chrome.send('cacheGoogleAppIcon', [appId]);
}
- /** @implements {welcome.GoogleAppProxy} */
- class GoogleAppProxyImpl {
- /** @override */
- cacheBookmarkIcon(appId) {
- chrome.send('cacheGoogleAppIcon', [appId]);
- }
-
- /** @override */
- getAppList() {
- return cr.sendWithPromise('getGoogleAppsList');
- }
-
- /** @override */
- recordProviderSelected(providerId) {
- chrome.metricsPrivate.recordEnumerationValue(
- 'FirstRun.NewUserExperience.GoogleAppsSelection', providerId,
- Object.keys(NuxGoogleAppsSelections).length);
- }
+ /** @override */
+ getAppList() {
+ return sendWithPromise('getGoogleAppsList');
}
- cr.addSingletonGetter(GoogleAppProxyImpl);
+ /** @override */
+ recordProviderSelected(providerId) {
+ chrome.metricsPrivate.recordEnumerationValue(
+ 'FirstRun.NewUserExperience.GoogleAppsSelection', providerId,
+ Object.keys(NuxGoogleAppsSelections).length);
+ }
+}
- return {
- GoogleAppProxy: GoogleAppProxy,
- GoogleAppProxyImpl: GoogleAppProxyImpl,
- };
-});
+addSingletonGetter(GoogleAppProxyImpl);