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

Side by Side Diff: chrome/browser/resources/print_preview/settings/more_settings.js

Issue 601573002: Add UMA stats for new Print Preview UI elements. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Add INVITATION_AVAILABLE UMA stat. Created 6 years, 3 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 unified diff | Download patch
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 cr.define('print_preview', function() { 5 cr.define('print_preview', function() {
6 'use strict'; 6 'use strict';
7 7
8 /** 8 /**
9 * Toggles visibility of the specified printing options sections. 9 * Toggles visibility of the specified printing options sections.
10 * @param {!print_preview.DestinationStore} destinationStore To listen for 10 * @param {!print_preview.DestinationStore} destinationStore To listen for
(...skipping 13 matching lines...) Expand all
24 this.settingsSections_ = settingsSections; 24 this.settingsSections_ = settingsSections;
25 25
26 /** @private {MoreSettings.SettingsToShow} */ 26 /** @private {MoreSettings.SettingsToShow} */
27 this.settingsToShow_ = MoreSettings.SettingsToShow.MOST_POPULAR; 27 this.settingsToShow_ = MoreSettings.SettingsToShow.MOST_POPULAR;
28 28
29 /** @private {boolean} */ 29 /** @private {boolean} */
30 this.capabilitiesReady_ = false; 30 this.capabilitiesReady_ = false;
31 31
32 /** @private {boolean} */ 32 /** @private {boolean} */
33 this.firstDestinationReady_ = false; 33 this.firstDestinationReady_ = false;
34
35 /**
36 * Used to record usage statistics.
37 * @private {!print_preview.PrintSettingsUiMetricsContext}
38 */
39 this.metrics_ = new print_preview.PrintSettingsUiMetricsContext();
34 }; 40 };
35 41
36 /** 42 /**
37 * Which settings are visible to the user. 43 * Which settings are visible to the user.
38 * @enum {number} 44 * @enum {number}
39 */ 45 */
40 MoreSettings.SettingsToShow = { 46 MoreSettings.SettingsToShow = {
41 MOST_POPULAR: 1, 47 MOST_POPULAR: 1,
42 ALL: 2 48 ALL: 2
43 }; 49 };
44 50
45 MoreSettings.prototype = { 51 MoreSettings.prototype = {
46 __proto__: print_preview.Component.prototype, 52 __proto__: print_preview.Component.prototype,
47 53
54 /** @return {boolean} Returns {@code true} if settings are expanded. */
55 get isExpanded() {
56 return this.settingsToShow_ == MoreSettings.SettingsToShow.ALL;
57 },
58
48 /** @override */ 59 /** @override */
49 enterDocument: function() { 60 enterDocument: function() {
50 print_preview.Component.prototype.enterDocument.call(this); 61 print_preview.Component.prototype.enterDocument.call(this);
51 62
52 this.tracker.add(this.getElement(), 'click', this.onClick_.bind(this)); 63 this.tracker.add(this.getElement(), 'click', this.onClick_.bind(this));
53 this.tracker.add( 64 this.tracker.add(
54 this.destinationStore_, 65 this.destinationStore_,
55 print_preview.DestinationStore.EventType.DESTINATION_SELECT, 66 print_preview.DestinationStore.EventType.DESTINATION_SELECT,
56 this.onDestinationChanged_.bind(this)); 67 this.onDestinationChanged_.bind(this));
57 this.tracker.add( 68 this.tracker.add(
(...skipping 15 matching lines...) Expand all
73 * Toggles "more/fewer options" state and notifies all the options sections 84 * Toggles "more/fewer options" state and notifies all the options sections
74 * to reflect the new state. 85 * to reflect the new state.
75 * @private 86 * @private
76 */ 87 */
77 onClick_: function() { 88 onClick_: function() {
78 this.settingsToShow_ = 89 this.settingsToShow_ =
79 this.settingsToShow_ == MoreSettings.SettingsToShow.MOST_POPULAR ? 90 this.settingsToShow_ == MoreSettings.SettingsToShow.MOST_POPULAR ?
80 MoreSettings.SettingsToShow.ALL : 91 MoreSettings.SettingsToShow.ALL :
81 MoreSettings.SettingsToShow.MOST_POPULAR; 92 MoreSettings.SettingsToShow.MOST_POPULAR;
82 this.updateState_(false); 93 this.updateState_(false);
94 this.metrics_.record(this.isExpanded ?
95 print_preview.Metrics.PrintSettingsUiBucket.MORE_SETTINGS_CLICKED :
96 print_preview.Metrics.PrintSettingsUiBucket.LESS_SETTINGS_CLICKED);
83 }, 97 },
84 98
85 /** 99 /**
86 * Called when the destination selection has changed. Updates UI elements. 100 * Called when the destination selection has changed. Updates UI elements.
87 * @private 101 * @private
88 */ 102 */
89 onDestinationChanged_: function() { 103 onDestinationChanged_: function() {
90 this.firstDestinationReady_ = true; 104 this.firstDestinationReady_ = true;
91 this.capabilitiesReady_ = false; 105 this.capabilitiesReady_ = false;
92 this.updateState_(false); 106 this.updateState_(false);
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
149 section.setCollapseContent(collapseContent, noAnimation); 163 section.setCollapseContent(collapseContent, noAnimation);
150 }); 164 });
151 } 165 }
152 }; 166 };
153 167
154 // Export 168 // Export
155 return { 169 return {
156 MoreSettings: MoreSettings 170 MoreSettings: MoreSettings
157 }; 171 };
158 }); 172 });
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698