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 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
65 $('user-manager-tutorial').hidden = true; | 65 $('user-manager-tutorial').hidden = true; |
66 }, | 66 }, |
67 | 67 |
68 /** | 68 /** |
69 * Add user button click handler. | 69 * Add user button click handler. |
70 * @private | 70 * @private |
71 */ | 71 */ |
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 | |
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 | |
78 e.stopPropagation(); | 75 e.stopPropagation(); |
79 }, | 76 }, |
80 | 77 |
| 78 /** |
| 79 * Add a button click handler to dismiss the last tutorial bubble. |
| 80 * @private |
| 81 */ |
| 82 handleDismissBubbleClick_: function(e) { |
| 83 $('user-manager-tutorial').hidden = true; |
| 84 e.stopPropagation(); |
| 85 }, |
| 86 |
81 endTutorial_: function(e) { | 87 endTutorial_: function(e) { |
82 $('inner-container').classList.remove('disabled'); | 88 $('inner-container').classList.remove('disabled'); |
83 }, | 89 }, |
84 | 90 |
85 decorate: function() { | 91 decorate: function() { |
86 // Transitions between the tutorial slides. | 92 // Transitions between the tutorial slides. |
87 for (var i = 0; i < this.slides_.length; ++i) { | 93 for (var i = 0; i < this.slides_.length; ++i) { |
88 var buttonNext = $(this.slides_[i] + '-next'); | 94 var buttonNext = $(this.slides_[i] + '-next'); |
89 var buttonSkip = $(this.slides_[i] + '-skip'); | 95 var buttonSkip = $(this.slides_[i] + '-skip'); |
90 if (buttonNext) | 96 if (buttonNext) |
91 buttonNext.addEventListener('click', this.next_.bind(this)); | 97 buttonNext.addEventListener('click', this.next_.bind(this)); |
92 if (buttonSkip) | 98 if (buttonSkip) |
93 buttonSkip.addEventListener('click', this.skip_.bind(this)); | 99 buttonSkip.addEventListener('click', this.skip_.bind(this)); |
94 } | 100 } |
95 $('slide-add-user').addEventListener('click', | 101 $('slide-add-user').addEventListener('click', |
96 this.handleAddUserClick_.bind(this)); | 102 this.handleAddUserClick_.bind(this)); |
| 103 $('dismiss-bubble-button').addEventListener('click', |
| 104 this.handleDismissBubbleClick_.bind(this)); |
97 } | 105 } |
98 }; | 106 }; |
99 | 107 |
100 /** | 108 /** |
101 * Initializes the tutorial manager. | 109 * Initializes the tutorial manager. |
102 */ | 110 */ |
103 UserManagerTutorial.startTutorial = function() { | 111 UserManagerTutorial.startTutorial = function() { |
104 $('user-manager-tutorial').hidden = false; | 112 $('user-manager-tutorial').hidden = false; |
105 | 113 |
106 // If there's only one pod, show the slides to the side of the pod. | 114 // If there's only one pod, show the slides to the side of the pod. |
(...skipping 14 matching lines...) Expand all Loading... |
121 */ | 129 */ |
122 UserManagerTutorial.initialize = function() { | 130 UserManagerTutorial.initialize = function() { |
123 UserManagerTutorial.getInstance().decorate(); | 131 UserManagerTutorial.getInstance().decorate(); |
124 }; | 132 }; |
125 | 133 |
126 // Export. | 134 // Export. |
127 return { | 135 return { |
128 UserManagerTutorial: UserManagerTutorial | 136 UserManagerTutorial: UserManagerTutorial |
129 }; | 137 }; |
130 }); | 138 }); |
OLD | NEW |