| OLD | NEW |
| 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('cr.ui.login', function() { | 5 cr.define('cr.ui.login', function() { |
| 6 /** | 6 /** |
| 7 * Constructs a slide manager for the user manager tutorial. | 7 * Constructs a slide manager for the user manager tutorial. |
| 8 * | 8 * |
| 9 * @constructor | 9 * @constructor |
| 10 */ | 10 */ |
| (...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 72 handleAddUserClick_: function(e) { | 72 handleAddUserClick_: function(e) { |
| 73 chrome.send('addUser'); | 73 chrome.send('addUser'); |
| 74 $('user-manager-tutorial').hidden = true; | 74 $('user-manager-tutorial').hidden = true; |
| 75 // Prevent further propagation of click event. Otherwise, the click event | 75 // Prevent further propagation of click event. Otherwise, the click event |
| 76 // handler of document object will set wallpaper to user's wallpaper when | 76 // handler of document object will set wallpaper to user's wallpaper when |
| 77 // there is only one existing user. See http://crbug.com/166477 | 77 // there is only one existing user. See http://crbug.com/166477 |
| 78 e.stopPropagation(); | 78 e.stopPropagation(); |
| 79 }, | 79 }, |
| 80 | 80 |
| 81 endTutorial_: function(e) { | 81 endTutorial_: function(e) { |
| 82 $('inner-container').style.opacity = '1'; | 82 $('inner-container').classList.remove('disabled'); |
| 83 $('inner-container').style.pointerEvents = ''; | |
| 84 }, | 83 }, |
| 85 | 84 |
| 86 decorate: function() { | 85 decorate: function() { |
| 87 // Transitions between the tutorial slides. | 86 // Transitions between the tutorial slides. |
| 88 for (var i = 0; i < this.slides_.length; ++i) { | 87 for (var i = 0; i < this.slides_.length; ++i) { |
| 89 var buttonNext = $(this.slides_[i] + '-next'); | 88 var buttonNext = $(this.slides_[i] + '-next'); |
| 90 var buttonSkip = $(this.slides_[i] + '-skip'); | 89 var buttonSkip = $(this.slides_[i] + '-skip'); |
| 91 if (buttonNext) | 90 if (buttonNext) |
| 92 buttonNext.addEventListener('click', this.next_.bind(this)); | 91 buttonNext.addEventListener('click', this.next_.bind(this)); |
| 93 if (buttonSkip) | 92 if (buttonSkip) |
| 94 buttonSkip.addEventListener('click', this.skip_.bind(this)); | 93 buttonSkip.addEventListener('click', this.skip_.bind(this)); |
| 95 } | 94 } |
| 96 $('slide-add-user').addEventListener('click', | 95 $('slide-add-user').addEventListener('click', |
| 97 this.handleAddUserClick_.bind(this)); | 96 this.handleAddUserClick_.bind(this)); |
| 98 } | 97 } |
| 99 }; | 98 }; |
| 100 | 99 |
| 101 /** | 100 /** |
| 102 * Initializes the tutorial manager. | 101 * Initializes the tutorial manager. |
| 103 */ | 102 */ |
| 104 UserManagerTutorial.startTutorial = function() { | 103 UserManagerTutorial.startTutorial = function() { |
| 105 $('user-manager-tutorial').hidden = false; | 104 $('user-manager-tutorial').hidden = false; |
| 106 | 105 |
| 107 // Disable interacting with the pods while the tutorial is showing. | 106 // If there's only one pod, show the slides to the side of the pod. |
| 108 $('pod-row').focusPod(); // No focused pods. | 107 // Otherwise, center the slides and disable interacting with the pods |
| 109 $('inner-container').style.opacity = '0.4'; | 108 // while the tutorial is showing. |
| 110 $('inner-container').style.pointerEvents = 'none'; | 109 if ($('pod-row').pods.length == 1) { |
| 110 $('slide-welcome').classList.add('single-pod'); |
| 111 $('slide-your-chrome').classList.add('single-pod'); |
| 112 $('slide-complete').classList.add('single-pod'); |
| 113 } else { |
| 114 $('pod-row').focusPod(); // No focused pods. |
| 115 $('inner-container').classList.add('disabled'); |
| 116 } |
| 111 }; | 117 }; |
| 112 | 118 |
| 113 /** | 119 /** |
| 114 * Initializes the tutorial manager. | 120 * Initializes the tutorial manager. |
| 115 */ | 121 */ |
| 116 UserManagerTutorial.initialize = function() { | 122 UserManagerTutorial.initialize = function() { |
| 117 UserManagerTutorial.getInstance().decorate(); | 123 UserManagerTutorial.getInstance().decorate(); |
| 118 }; | 124 }; |
| 119 | 125 |
| 120 // Export. | 126 // Export. |
| 121 return { | 127 return { |
| 122 UserManagerTutorial: UserManagerTutorial | 128 UserManagerTutorial: UserManagerTutorial |
| 123 }; | 129 }; |
| 124 }); | 130 }); |
| OLD | NEW |