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

Unified Diff: chrome/browser/resources/md_user_manager/user_manager_tutorial.js

Issue 1725563003: MD user manager (learn more page, user manager tutorial) (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fixed what was breaking browser test accross all platforms Created 4 years, 9 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/resources/md_user_manager/user_manager_tutorial.js
diff --git a/chrome/browser/resources/md_user_manager/user_manager_tutorial.js b/chrome/browser/resources/md_user_manager/user_manager_tutorial.js
new file mode 100644
index 0000000000000000000000000000000000000000..10ca08a20a820ea616404f557ccad6ed2bf8bacf
--- /dev/null
+++ b/chrome/browser/resources/md_user_manager/user_manager_tutorial.js
@@ -0,0 +1,118 @@
+// Copyright 2016 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.
+
+/**
+ * @fileoverview 'user-manager-tutorial' is the element that controls the
+ * tutorial steps for the user manager page.
+ */
+(function() {
+
+/** @enum {string} */
+var TutorialSteps = {
+ YOUR_CHROME: 'yourChrome',
+ FRIENDS: 'friends',
+ GUESTS: 'guests',
+ COMPLETE: 'complete',
+ NOT_YOU: 'notYou'
+};
+
+Polymer({
+ is: 'user-manager-tutorial',
+
+ behaviors: [
+ I18nBehavior,
+ ],
+
+ properties: {
+ /**
+ * True if the tutorial is currently hidden.
+ * @private {boolean}
+ */
+ hidden_: {
+ type: Boolean,
+ value: true
+ },
+
+ /**
+ * Current tutorial step ID.
+ * @type {string}
+ */
+ currentStep_: {
+ type: String,
+ value: ''
+ },
+
+ /**
+ * Enum values for the step IDs.
+ * @private {TutorialSteps}
+ */
+ steps_: {
+ readOnly: true,
+ type: Object,
+ value: TutorialSteps
+ }
+ },
+
+ /**
+ * Determines whether a given step is displaying.
+ * @param {string} currentStep Index of the current step
+ * @param {string} step Name of the given step
+ * @return {boolean}
+ * @private
+ */
+ isStepHidden_: function(currentStep, step) {
+ return currentStep != step;
+ },
+
+ /**
+ * Navigates to the next step.
+ * @param {!Event} event
+ * @private
+ */
+ onNextTap_: function(event) {
+ var element = Polymer.dom(event).rootTarget;
+ this.currentStep_ = element.dataset.next;
+ },
+
+ /**
+ * Handler for the link in the last step. Takes user to the create-profile
+ * page in order to add a new profile.
+ * @param {!Event} event
+ * @private
+ */
+ onAddUserTap_: function(event) {
+ this.onDissmissTap_();
+ // Event is caught by user-manager-pages.
+ this.fire('change-page', {page: 'create-user-page'});
+ },
+
+ /**
+ * Starts the tutorial.
+ */
+ startTutorial: function() {
+ this.currentStep_ = TutorialSteps.YOUR_CHROME;
+ this.hidden_ = false;
+
+ // If there's only one pod, show the steps to the side of the pod.
+ // Otherwise, center the steps and disable interacting with the pods
+ // while the tutorial is showing.
+ var podRow = /** @type {{focusPod: !function(), pods: !Array}} */
+ ($('pod-row'));
+
+ this.classList.toggle('single-pod', podRow.pods.length == 1);
+
+ podRow.focusPod(); // No focused pods.
+ $('inner-container').classList.add('disabled');
+ },
+
+ /**
+ * Ends the tutorial.
+ * @private
+ */
+ onDissmissTap_: function() {
+ $('inner-container').classList.remove('disabled');
+ this.hidden_ = true;
+ }
+});
+})();

Powered by Google App Engine
This is Rietveld 408576698