- add sources.
[platform/framework/web/crosswalk.git] / src / chrome / browser / resources / chromeos / first_run / step.js
1 // Copyright 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 /**
6  * Prototype for first-run tutorial steps.
7  */
8
9 cr.define('cr.FirstRun', function() {
10   var Step = cr.ui.define('div');
11
12   Step.prototype = {
13     __proto__: HTMLDivElement.prototype,
14
15     // Name of step.
16     name_: null,
17
18     // Button leading to next tutorial step.
19     nextButton_: null,
20
21     decorate: function() {
22       this.name_ = this.getAttribute('id');
23       this.nextButton_ = this.getElementsByClassName('next-button')[0];
24       if (!this.nextButton_)
25         throw Error('Next button not found.');
26       this.nextButton_.addEventListener('click', (function(e) {
27         chrome.send('nextButtonClicked', [this.getName()]);
28         e.stopPropagation();
29       }).bind(this));
30     },
31
32     getName: function() {
33       return this.name_;
34     }
35   };
36
37   return {Step: Step};
38 });