Welcome WebUI: Dependency cleanups and moving nux.AppProxy interface.
- Add missing import in welcome_app.html.
- Remove unnecessary i18n_setup.html import in google_app_proxy.html
- Move nux.AppProxy interface to the only placed it is actually used
and rename to nux.GoogleAppProxy. This interface was previously used
by more places, but not the case anymore.
These were discovered while attempting to convert chrome://welcome
to JS modules and Polymer3.
Bug: 965770
Change-Id: Id1c0be2a8174e288f329276e2ed2f6bebc447122
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1690745
Commit-Queue: Demetrios Papadopoulos <dpapad@chromium.org>
Commit-Queue: Hector Carmona <hcarmona@chromium.org>
Auto-Submit: Demetrios Papadopoulos <dpapad@chromium.org>
Reviewed-by: Hector Carmona <hcarmona@chromium.org>
Cr-Commit-Position: refs/heads/master@{#675411}
diff --git a/chrome/browser/resources/welcome/onboarding_welcome/google_apps/BUILD.gn b/chrome/browser/resources/welcome/onboarding_welcome/google_apps/BUILD.gn
index d903215..7a39dd1 100644
--- a/chrome/browser/resources/welcome/onboarding_welcome/google_apps/BUILD.gn
+++ b/chrome/browser/resources/welcome/onboarding_welcome/google_apps/BUILD.gn
@@ -27,7 +27,6 @@
js_library("google_app_proxy") {
deps = [
- "../shared:app_proxy",
"//ui/webui/resources/js:cr",
]
externs_list = [ "$externs_path/chrome_send.js" ]
diff --git a/chrome/browser/resources/welcome/onboarding_welcome/google_apps/google_app_proxy.html b/chrome/browser/resources/welcome/onboarding_welcome/google_apps/google_app_proxy.html
index 88d70dd9..3c50ce8 100644
--- a/chrome/browser/resources/welcome/onboarding_welcome/google_apps/google_app_proxy.html
+++ b/chrome/browser/resources/welcome/onboarding_welcome/google_apps/google_app_proxy.html
@@ -1,3 +1,2 @@
<link rel="import" href="chrome://resources/html/cr.html">
-<link rel="import" href="chrome://welcome/shared/i18n_setup.html">
<script src="google_app_proxy.js"></script>
diff --git a/chrome/browser/resources/welcome/onboarding_welcome/google_apps/google_app_proxy.js b/chrome/browser/resources/welcome/onboarding_welcome/google_apps/google_app_proxy.js
index fb620e6e..4fc9f24 100644
--- a/chrome/browser/resources/welcome/onboarding_welcome/google_apps/google_app_proxy.js
+++ b/chrome/browser/resources/welcome/onboarding_welcome/google_apps/google_app_proxy.js
@@ -19,7 +19,29 @@
CHROME_WEB_STORE: 5,
};
- /** @implements {nux.AppProxy} */
+ /** @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<!nux.BookmarkListItem>>}
+ */
+ getAppList() {}
+
+ /**
+ * @param {number} providerId This should match one of the histogram enum
+ * value for NuxGoogleAppsSelections.
+ */
+ recordProviderSelected(providerId) {}
+ }
+
+ /** @implements {nux.GoogleAppProxy} */
class GoogleAppProxyImpl {
/** @override */
cacheBookmarkIcon(appId) {
@@ -42,6 +64,7 @@
cr.addSingletonGetter(GoogleAppProxyImpl);
return {
+ GoogleAppProxy: GoogleAppProxy,
GoogleAppProxyImpl: GoogleAppProxyImpl,
};
});
diff --git a/chrome/browser/resources/welcome/onboarding_welcome/google_apps/nux_google_apps.js b/chrome/browser/resources/welcome/onboarding_welcome/google_apps/nux_google_apps.js
index 2ed67e53..1e37e95 100644
--- a/chrome/browser/resources/welcome/onboarding_welcome/google_apps/nux_google_apps.js
+++ b/chrome/browser/resources/welcome/onboarding_welcome/google_apps/nux_google_apps.js
@@ -48,7 +48,7 @@
},
},
- /** @private {nux.AppProxy} */
+ /** @private {nux.GoogleAppProxy} */
appProxy_: null,
/** @private {?nux.ModuleMetricsManager} */
diff --git a/chrome/browser/resources/welcome/onboarding_welcome/shared/BUILD.gn b/chrome/browser/resources/welcome/onboarding_welcome/shared/BUILD.gn
index b3cb8800..d2c36998 100644
--- a/chrome/browser/resources/welcome/onboarding_welcome/shared/BUILD.gn
+++ b/chrome/browser/resources/welcome/onboarding_welcome/shared/BUILD.gn
@@ -22,12 +22,6 @@
]
}
-js_library("app_proxy") {
- deps = [
- "//ui/webui/resources/js:cr",
- ]
-}
-
js_library("module_metrics_proxy") {
deps = [
"//ui/webui/resources/js:cr",
diff --git a/chrome/browser/resources/welcome/onboarding_welcome/shared/app_proxy.js b/chrome/browser/resources/welcome/onboarding_welcome/shared/app_proxy.js
deleted file mode 100644
index 1b04fd07..0000000
--- a/chrome/browser/resources/welcome/onboarding_welcome/shared/app_proxy.js
+++ /dev/null
@@ -1,31 +0,0 @@
-// Copyright 2018 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-cr.define('nux', function() {
- /** @interface */
- class AppProxy {
- /**
- * 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<!nux.BookmarkListItem>>}
- */
- getAppList() {}
-
- /**
- * @param {number} providerId This should match one of the histogram enum
- * value for NuxGoogleAppsSelections.
- */
- recordProviderSelected(providerId) {}
- }
-
- return {
- AppProxy: AppProxy,
- };
-});
diff --git a/chrome/browser/resources/welcome/onboarding_welcome/welcome_app.html b/chrome/browser/resources/welcome/onboarding_welcome/welcome_app.html
index 76f7eb4..a520eaa 100644
--- a/chrome/browser/resources/welcome/onboarding_welcome/welcome_app.html
+++ b/chrome/browser/resources/welcome/onboarding_welcome/welcome_app.html
@@ -3,6 +3,7 @@
<link rel="import" href="chrome://resources/cr_elements/cr_toast/cr_toast.html">
<link rel="import" href="chrome://resources/cr_elements/cr_view_manager/cr_view_manager.html">
<link rel="import" href="chrome://resources/cr_elements/hidden_style_css.html">
+<link rel="import" href="chrome://resources/html/assert.html">
<link rel="import" href="google_apps/nux_google_apps.html">
<link rel="import" href="landing_view.html">
<link rel="import" href="navigation_behavior.html">
diff --git a/chrome/test/data/webui/welcome/app_chooser_test.js b/chrome/test/data/webui/welcome/app_chooser_test.js
index 3457da78..3871ed4 100644
--- a/chrome/test/data/webui/welcome/app_chooser_test.js
+++ b/chrome/test/data/webui/welcome/app_chooser_test.js
@@ -50,7 +50,7 @@
let testElement;
setup(async function() {
- testAppBrowserProxy = new TestNuxAppProxy();
+ testAppBrowserProxy = new TestGoogleAppProxy();
testAppMetricsProxy = new TestMetricsProxy();
testBookmarkBrowserProxy = new TestBookmarkProxy();
diff --git a/chrome/test/data/webui/welcome/onboarding_welcome_browsertest.js b/chrome/test/data/webui/welcome/onboarding_welcome_browsertest.js
index 8b37047..f0a05cf1 100644
--- a/chrome/test/data/webui/welcome/onboarding_welcome_browsertest.js
+++ b/chrome/test/data/webui/welcome/onboarding_welcome_browsertest.js
@@ -42,7 +42,7 @@
get extraLibraries() {
return super.extraLibraries.concat([
'app_chooser_test.js',
- 'test_nux_app_proxy.js',
+ 'test_google_app_proxy.js',
'test_metrics_proxy.js',
'test_bookmark_proxy.js',
]);
diff --git a/chrome/test/data/webui/welcome/test_nux_app_proxy.js b/chrome/test/data/webui/welcome/test_google_app_proxy.js
similarity index 90%
rename from chrome/test/data/webui/welcome/test_nux_app_proxy.js
rename to chrome/test/data/webui/welcome/test_google_app_proxy.js
index d77c0d5..6b0af9e 100644
--- a/chrome/test/data/webui/welcome/test_nux_app_proxy.js
+++ b/chrome/test/data/webui/welcome/test_google_app_proxy.js
@@ -2,8 +2,8 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-/** @implements {nux.AppProxy} */
-class TestNuxAppProxy extends TestBrowserProxy {
+/** @implements {nux.GoogleAppProxy} */
+class TestGoogleAppProxy extends TestBrowserProxy {
constructor() {
super([
'cacheBookmarkIcon',