OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 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 | 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 App launcher start page implementation. | 6 * @fileoverview App launcher start page implementation. |
7 */ | 7 */ |
8 | 8 |
9 <include src="recommended_apps.js"/> | 9 <include src="recommended_apps.js"/> |
| 10 <include src="speech_manager.js"/> |
10 | 11 |
11 cr.define('appList.startPage', function() { | 12 cr.define('appList.startPage', function() { |
12 'use strict'; | 13 'use strict'; |
13 | 14 |
| 15 var speechManager = null; |
| 16 |
14 /** | 17 /** |
15 * Creates a StartPage object. | 18 * Creates a StartPage object. |
16 * @constructor | 19 * @constructor |
17 * @extends {HTMLDivElement} | 20 * @extends {HTMLDivElement} |
18 */ | 21 */ |
19 var StartPage = cr.ui.define('div'); | 22 var StartPage = cr.ui.define('div'); |
20 | 23 |
21 StartPage.prototype = { | 24 StartPage.prototype = { |
22 __proto__: HTMLDivElement.prototype, | 25 __proto__: HTMLDivElement.prototype, |
23 | 26 |
(...skipping 20 matching lines...) Expand all Loading... |
44 setRecommendedApps: function(apps) { | 47 setRecommendedApps: function(apps) { |
45 this.recommendedApps_.setApps(apps); | 48 this.recommendedApps_.setApps(apps); |
46 } | 49 } |
47 }; | 50 }; |
48 | 51 |
49 /** | 52 /** |
50 * Initialize the page. | 53 * Initialize the page. |
51 */ | 54 */ |
52 function initialize() { | 55 function initialize() { |
53 StartPage.decorate($('start-page')); | 56 StartPage.decorate($('start-page')); |
| 57 speechManager = new speech.SpeechManager(); |
54 chrome.send('initialize'); | 58 chrome.send('initialize'); |
55 } | 59 } |
56 | 60 |
57 /** | 61 /** |
58 * Sets the recommended apps. | 62 * Sets the recommended apps. |
59 * @param {Array.<Object>} apps An array of app info dictionary. | 63 * @param {Array.<Object>} apps An array of app info dictionary. |
60 */ | 64 */ |
61 function setRecommendedApps(apps) { | 65 function setRecommendedApps(apps) { |
62 $('start-page').setRecommendedApps(apps); | 66 $('start-page').setRecommendedApps(apps); |
63 } | 67 } |
64 | 68 |
| 69 function onAppListShown() { |
| 70 speechManager.start(); |
| 71 } |
| 72 |
| 73 function onAppListHidden() { |
| 74 speechManager.stop(); |
| 75 } |
| 76 |
65 return { | 77 return { |
66 initialize: initialize, | 78 initialize: initialize, |
67 setRecommendedApps: setRecommendedApps | 79 setRecommendedApps: setRecommendedApps, |
| 80 onAppListShown: onAppListShown, |
| 81 onAppListHidden: onAppListHidden |
68 }; | 82 }; |
69 }); | 83 }); |
70 | 84 |
71 document.addEventListener('contextmenu', function(e) { e.preventDefault(); }); | 85 document.addEventListener('contextmenu', function(e) { e.preventDefault(); }); |
72 document.addEventListener('DOMContentLoaded', appList.startPage.initialize); | 86 document.addEventListener('DOMContentLoaded', appList.startPage.initialize); |
OLD | NEW |