Commit ed15e91e authored by dpapad's avatar dpapad Committed by Commit Bot

Welcome WebUI: Cleanup "NTP background" and "Google apps" metrics proxies.

These were previously defined within shared/module_metrics_proxy.js,
even though they are only used within their respective folders.

Moreover module_metrics_proxy.js was working around a Closure compiler
bug, which resulted in a weird pattern (having code after cr.define),
making it harder to auto-generate a JS Module from this file, which
is the motivation for this change.

Bug: 965770
Change-Id: I098490ccb82af60fbdc632a91a1fb7b7da13e040
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1696684Reviewed-by: default avatarHector Carmona <hcarmona@chromium.org>
Commit-Queue: Demetrios Papadopoulos <dpapad@chromium.org>
Cr-Commit-Position: refs/heads/master@{#676252}
parent 91d5eaff
......@@ -6,6 +6,8 @@ import("//third_party/closure_compiler/compile_js.gni")
js_type_check("closure_compile") {
deps = [
":google_app_proxy",
":google_apps_metrics_proxy",
":nux_google_apps",
]
}
......@@ -13,9 +15,9 @@ js_type_check("closure_compile") {
js_library("nux_google_apps") {
deps = [
":google_app_proxy",
":google_apps_metrics_proxy",
"../:navigation_behavior",
"../shared:bookmark_proxy",
"../shared:module_metrics_proxy",
"../shared:nux_types",
"../shared:step_indicator",
"//third_party/polymer/v1_0/components-chromium/iron-a11y-announcer:iron-a11y-announcer-extracted",
......@@ -31,3 +33,9 @@ js_library("google_app_proxy") {
]
externs_list = [ "$externs_path/chrome_send.js" ]
}
js_library("google_apps_metrics_proxy") {
deps = [
"../shared:module_metrics_proxy",
]
}
<link rel="import" href="chrome://resources/html/cr.html">
<link rel="import" href="../shared/module_metrics_proxy.html">
<script src="google_apps_metrics_proxy.js"></script>
// Copyright 2019 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('welcome', function() {
class GoogleAppsMetricsProxyImpl extends welcome.ModuleMetricsProxyImpl {
constructor() {
super(
'FirstRun.NewUserExperience.GoogleAppsInteraction',
welcome.NuxGoogleAppsInteractions);
}
}
cr.addSingletonGetter(GoogleAppsMetricsProxyImpl);
return {
GoogleAppsMetricsProxyImpl: GoogleAppsMetricsProxyImpl,
};
});
......@@ -13,9 +13,9 @@
<link rel="import" href="../shared/bookmark_proxy.html">
<link rel="import" href="../shared/chooser_shared_css.html">
<link rel="import" href="../shared/i18n_setup.html">
<link rel="import" href="../shared/module_metrics_proxy.html">
<link rel="import" href="../shared/step_indicator.html">
<link rel="import" href="google_app_proxy.html">
<link rel="import" href="google_apps_metrics_proxy.html">
<dom-module id="nux-google-apps">
<template>
......
......@@ -6,15 +6,17 @@ import("//third_party/closure_compiler/compile_js.gni")
js_type_check("closure_compile") {
deps = [
":ntp_background_metrics_proxy",
":ntp_background_proxy",
":nux_ntp_background",
]
}
js_library("nux_ntp_background") {
deps = [
":ntp_background_metrics_proxy",
":ntp_background_proxy",
"../:navigation_behavior",
"../shared:module_metrics_proxy",
"../shared:nux_types",
"//ui/webui/resources/js:cr",
"//ui/webui/resources/js:i18n_behavior",
......@@ -28,3 +30,9 @@ js_library("ntp_background_proxy") {
]
externs_list = [ "$externs_path/chrome_send.js" ]
}
js_library("ntp_background_metrics_proxy") {
deps = [
"../shared:module_metrics_proxy",
]
}
<link rel="import" href="chrome://resources/html/cr.html">
<link rel="import" href="../shared/module_metrics_proxy.html">
<script src="ntp_background_metrics_proxy.js"></script>
// 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('welcome', function() {
class NtpBackgroundMetricsProxyImpl extends welcome.ModuleMetricsProxyImpl {
constructor() {
super(
'FirstRun.NewUserExperience.NtpBackgroundInteraction',
welcome.NuxNtpBackgroundInteractions);
}
getInteractions() {
return this.interactions_;
}
}
cr.addSingletonGetter(NtpBackgroundMetricsProxyImpl);
return {
NtpBackgroundMetricsProxyImpl: NtpBackgroundMetricsProxyImpl,
};
});
......@@ -11,8 +11,8 @@
<link rel="import" href="../shared/animations_css.html">
<link rel="import" href="../shared/chooser_shared_css.html">
<link rel="import" href="../shared/i18n_setup.html">
<link rel="import" href="../shared/module_metrics_proxy.html">
<link rel="import" href="../shared/step_indicator.html">
<link rel="import" href="ntp_background_metrics_proxy.html">
<link rel="import" href="ntp_background_proxy.html">
<dom-module id="nux-ntp-background">
......
......@@ -223,6 +223,14 @@
file="set_as_default/nux_set_as_default_proxy.js"
compress="gzip"
type="chrome_html" />
<structure name="IDR_GOOGLE_APPS_METRICS_PROXY_HTML"
file="google_apps/google_apps_metrics_proxy.html"
compress="gzip"
type="chrome_html" />
<structure name="IDR_GOOGLE_APPS_METRICS_PROXY_JS"
file="google_apps/google_apps_metrics_proxy.js"
compress="gzip"
type="chrome_html" />
<!-- NUX NTP background-->
<structure name="IDR_NUX_NTP_BACKGROUND_HTML"
......@@ -241,6 +249,14 @@
file="ntp_background/ntp_background_proxy.js"
compress="gzip"
type="chrome_html" />
<structure name="IDR_NUX_NTP_BACKGROUND_METRICS_PROXY_HTML"
file="ntp_background/ntp_background_metrics_proxy.html"
compress="gzip"
type="chrome_html" />
<structure name="IDR_NUX_NTP_BACKGROUND_METRICS_PROXY_JS"
file="ntp_background/ntp_background_metrics_proxy.js"
compress="gzip"
type="chrome_html" />
</structures>
</release>
</grit>
......@@ -7,6 +7,7 @@ import("//third_party/closure_compiler/compile_js.gni")
js_type_check("closure_compile") {
deps = [
":bookmark_proxy",
":module_metrics_proxy",
":nux_types",
":step_indicator",
]
......
......@@ -3,6 +3,49 @@
// found in the LICENSE file.
cr.define('welcome', function() {
/**
* NuxNtpBackgroundInteractions enum.
* These values are persisted to logs and should not be renumbered or
* re-used.
* See tools/metrics/histograms/enums.xml.
* @enum {number}
*/
const NuxNtpBackgroundInteractions = {
PageShown: 0,
DidNothingAndNavigatedAway: 1,
DidNothingAndChoseSkip: 2,
DidNothingAndChoseNext: 3,
ChoseAnOptionAndNavigatedAway: 4,
ChoseAnOptionAndChoseSkip: 5,
ChoseAnOptionAndChoseNext: 6,
NavigatedAwayThroughBrowserHistory: 7,
BackgroundImageFailedToLoad: 8,
BackgroundImageNeverLoaded: 9,
};
/**
* NuxGoogleAppsInteractions enum.
* These values are persisted to logs and should not be renumbered or
* re-used.
* See tools/metrics/histograms/enums.xml.
* @enum {number}
*/
const NuxGoogleAppsInteractions = {
PageShown: 0,
NotUsed_DEPRECATED: 1,
GetStarted_DEPRECATED: 2,
DidNothingAndNavigatedAway: 3,
DidNothingAndChoseSkip: 4,
ChoseAnOptionAndNavigatedAway: 5,
ChoseAnOptionAndChoseSkip: 6,
ChoseAnOptionAndChoseNext: 7,
ClickedDisabledNextButtonAndNavigatedAway: 8,
ClickedDisabledNextButtonAndChoseSkip: 9,
ClickedDisabledNextButtonAndChoseNext: 10,
DidNothingAndChoseNext: 11,
NavigatedAwayThroughBrowserHistory: 12,
};
/** @interface */
class ModuleMetricsProxy {
recordPageShown() {}
......@@ -190,76 +233,10 @@ cr.define('welcome', function() {
}
return {
ModuleMetricsProxy: ModuleMetricsProxy,
ModuleMetricsProxyImpl: ModuleMetricsProxyImpl,
ModuleMetricsManager: ModuleMetricsManager,
ModuleMetricsProxyImpl: ModuleMetricsProxyImpl,
ModuleMetricsProxy: ModuleMetricsProxy,
NuxGoogleAppsInteractions: NuxGoogleAppsInteractions,
NuxNtpBackgroundInteractions: NuxNtpBackgroundInteractions,
};
});
welcome.GoogleAppsMetricsProxyImpl =
class extends welcome.ModuleMetricsProxyImpl {
constructor() {
/**
* NuxGoogleAppsInteractions enum.
* These values are persisted to logs and should not be renumbered or
* re-used.
* See tools/metrics/histograms/enums.xml.
* @enum {number}
*/
const NuxGoogleAppsInteractions = {
PageShown: 0,
NotUsed_DEPRECATED: 1,
GetStarted_DEPRECATED: 2,
DidNothingAndNavigatedAway: 3,
DidNothingAndChoseSkip: 4,
ChoseAnOptionAndNavigatedAway: 5,
ChoseAnOptionAndChoseSkip: 6,
ChoseAnOptionAndChoseNext: 7,
ClickedDisabledNextButtonAndNavigatedAway: 8,
ClickedDisabledNextButtonAndChoseSkip: 9,
ClickedDisabledNextButtonAndChoseNext: 10,
DidNothingAndChoseNext: 11,
NavigatedAwayThroughBrowserHistory: 12,
};
super(
'FirstRun.NewUserExperience.GoogleAppsInteraction',
NuxGoogleAppsInteractions);
}
};
welcome.NtpBackgroundMetricsProxyImpl =
class extends welcome.ModuleMetricsProxyImpl {
constructor() {
/**
* NuxNtpBackgroundInteractions enum.
* These values are persisted to logs and should not be renumbered or
* re-used.
* See tools/metrics/histograms/enums.xml.
* @enum {number}
*/
const NuxNtpBackgroundInteractions = {
PageShown: 0,
DidNothingAndNavigatedAway: 1,
DidNothingAndChoseSkip: 2,
DidNothingAndChoseNext: 3,
ChoseAnOptionAndNavigatedAway: 4,
ChoseAnOptionAndChoseSkip: 5,
ChoseAnOptionAndChoseNext: 6,
NavigatedAwayThroughBrowserHistory: 7,
BackgroundImageFailedToLoad: 8,
BackgroundImageNeverLoaded: 9,
};
super(
'FirstRun.NewUserExperience.NtpBackgroundInteraction',
NuxNtpBackgroundInteractions);
}
getInteractions() {
return this.interactions_;
}
};
cr.addSingletonGetter(welcome.GoogleAppsMetricsProxyImpl);
cr.addSingletonGetter(welcome.NtpBackgroundMetricsProxyImpl);
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment