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

Side by Side Diff: chrome/browser/resources/md_user_manager/user_manager_tutorial.js

Issue 2600683002: Run tools/clang-format-js on some of chrome/browser/resources/ (Closed)
Patch Set: hackhackhack Created 3 years, 11 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 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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 /** 5 /**
6 * @fileoverview 'user-manager-tutorial' is the element that controls the 6 * @fileoverview 'user-manager-tutorial' is the element that controls the
7 * tutorial steps for the user manager page. 7 * tutorial steps for the user manager page.
8 */ 8 */
9 (function() { 9 (function() {
10 10
11 /** @enum {string} */ 11 /** @enum {string} */
12 var TutorialSteps = { 12 var TutorialSteps = {
13 YOUR_CHROME: 'yourChrome', 13 YOUR_CHROME: 'yourChrome',
14 FRIENDS: 'friends', 14 FRIENDS: 'friends',
15 GUESTS: 'guests', 15 GUESTS: 'guests',
16 COMPLETE: 'complete', 16 COMPLETE: 'complete',
17 NOT_YOU: 'notYou' 17 NOT_YOU: 'notYou'
18 }; 18 };
19 19
20 Polymer({ 20 Polymer({
21 is: 'user-manager-tutorial', 21 is: 'user-manager-tutorial',
22 22
23 properties: { 23 properties: {
24 /** 24 /**
25 * True if the tutorial is currently hidden. 25 * True if the tutorial is currently hidden.
26 * @private {boolean} 26 * @private {boolean}
27 */ 27 */
28 hidden_: { 28 hidden_: {type: Boolean, value: true},
29 type: Boolean, 29
30 value: true 30 /**
31 * Current tutorial step ID.
32 * @type {string}
33 */
34 currentStep_: {type: String, value: ''},
35
36 /**
37 * Enum values for the step IDs.
38 * @private {TutorialSteps}
39 */
40 steps_: {readOnly: true, type: Object, value: TutorialSteps}
31 }, 41 },
32 42
33 /** 43 /**
34 * Current tutorial step ID.
35 * @type {string}
36 */
37 currentStep_: {
38 type: String,
39 value: ''
40 },
41
42 /**
43 * Enum values for the step IDs.
44 * @private {TutorialSteps}
45 */
46 steps_: {
47 readOnly: true,
48 type: Object,
49 value: TutorialSteps
50 }
51 },
52
53 /**
54 * Determines whether a given step is displaying. 44 * Determines whether a given step is displaying.
55 * @param {string} currentStep Index of the current step 45 * @param {string} currentStep Index of the current step
56 * @param {string} step Name of the given step 46 * @param {string} step Name of the given step
57 * @return {boolean} 47 * @return {boolean}
58 * @private 48 * @private
59 */ 49 */
60 isStepHidden_: function(currentStep, step) { 50 isStepHidden_: function(currentStep, step) {
61 return currentStep != step; 51 return currentStep != step;
62 }, 52 },
63 53
64 /** 54 /**
65 * Navigates to the next step. 55 * Navigates to the next step.
66 * @param {!Event} event 56 * @param {!Event} event
67 * @private 57 * @private
68 */ 58 */
69 onNextTap_: function(event) { 59 onNextTap_: function(event) {
70 var element = Polymer.dom(event).rootTarget; 60 var element = Polymer.dom(event).rootTarget;
71 this.currentStep_ = element.dataset.next; 61 this.currentStep_ = element.dataset.next;
72 }, 62 },
73 63
74 /** 64 /**
75 * Handler for the link in the last step. Takes user to the create-profile 65 * Handler for the link in the last step. Takes user to the create-profile
76 * page in order to add a new profile. 66 * page in order to add a new profile.
77 * @param {!Event} event 67 * @param {!Event} event
78 * @private 68 * @private
79 */ 69 */
80 onAddUserTap_: function(event) { 70 onAddUserTap_: function(event) {
81 this.onDissmissTap_(); 71 this.onDissmissTap_();
82 // Event is caught by user-manager-pages. 72 // Event is caught by user-manager-pages.
83 this.fire('change-page', {page: 'create-user-page'}); 73 this.fire('change-page', {page: 'create-user-page'});
84 }, 74 },
85 75
86 /** 76 /**
87 * Starts the tutorial. 77 * Starts the tutorial.
88 */ 78 */
89 startTutorial: function() { 79 startTutorial: function() {
90 this.currentStep_ = TutorialSteps.YOUR_CHROME; 80 this.currentStep_ = TutorialSteps.YOUR_CHROME;
91 this.hidden_ = false; 81 this.hidden_ = false;
92 82
93 // If there's only one pod, show the steps to the side of the pod. 83 // If there's only one pod, show the steps to the side of the pod.
94 // Otherwise, center the steps and disable interacting with the pods 84 // Otherwise, center the steps and disable interacting with the pods
95 // while the tutorial is showing. 85 // while the tutorial is showing.
96 var podRow = /** @type {{focusPod: !function(), pods: !Array}} */ 86 var podRow = /** @type {{focusPod: !function(), pods: !Array}} */
97 ($('pod-row')); 87 ($('pod-row'));
98 88
99 this.classList.toggle('single-pod', podRow.pods.length == 1); 89 this.classList.toggle('single-pod', podRow.pods.length == 1);
100 90
101 podRow.focusPod(); // No focused pods. 91 podRow.focusPod(); // No focused pods.
102 $('inner-container').classList.add('disabled'); 92 $('inner-container').classList.add('disabled');
103 }, 93 },
104 94
105 /** 95 /**
106 * Ends the tutorial. 96 * Ends the tutorial.
107 * @private 97 * @private
108 */ 98 */
109 onDissmissTap_: function() { 99 onDissmissTap_: function() {
110 $('inner-container').classList.remove('disabled'); 100 $('inner-container').classList.remove('disabled');
111 this.hidden_ = true; 101 this.hidden_ = true;
112 } 102 }
113 }); 103 });
114 })(); 104 })();
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698