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 <include src="speech_manager.js"/> |
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
60 | 60 |
61 /** | 61 /** |
62 * Sets the recommended apps. | 62 * Sets the recommended apps. |
63 * @param {Array.<Object>} apps An array of app info dictionary. | 63 * @param {Array.<Object>} apps An array of app info dictionary. |
64 */ | 64 */ |
65 function setRecommendedApps(apps) { | 65 function setRecommendedApps(apps) { |
66 $('start-page').setRecommendedApps(apps); | 66 $('start-page').setRecommendedApps(apps); |
67 } | 67 } |
68 | 68 |
69 /** | 69 /** |
70 * Invoked when the hotword plugin should be loaded. | 70 * Invoked when the hotword plugin availability is changed. |
| 71 * |
| 72 * @param {boolean} enabled Whether the plugin is enabled or not. |
71 */ | 73 */ |
72 function maybeInitializePlugin() { | 74 function setHotwordEnabled(enabled) { |
73 speechManager.maybeInitializePlugin(); | 75 speechManager.setHotwordEnabled(enabled); |
74 } | 76 } |
75 | 77 |
76 /** | 78 /** |
77 * Invoked when the app-list bubble is shown. | 79 * Invoked when the app-list bubble is shown. |
78 */ | 80 */ |
79 function onAppListShown() { | 81 function onAppListShown() { |
80 speechManager.onShown(); | 82 speechManager.onShown(); |
81 } | 83 } |
82 | 84 |
83 /** | 85 /** |
84 * Invoked when the app-list bubble is hidden. | 86 * Invoked when the app-list bubble is hidden. |
85 */ | 87 */ |
86 function onAppListHidden() { | 88 function onAppListHidden() { |
87 speechManager.onHidden(); | 89 speechManager.onHidden(); |
88 } | 90 } |
89 | 91 |
90 /** | 92 /** |
91 * Invoked when the user explicitly wants to toggle the speech recognition | 93 * Invoked when the user explicitly wants to toggle the speech recognition |
92 * state. | 94 * state. |
93 */ | 95 */ |
94 function toggleSpeechRecognition() { | 96 function toggleSpeechRecognition() { |
95 speechManager.toggleSpeechRecognition(); | 97 speechManager.toggleSpeechRecognition(); |
96 } | 98 } |
97 | 99 |
98 return { | 100 return { |
99 initialize: initialize, | 101 initialize: initialize, |
100 setRecommendedApps: setRecommendedApps, | 102 setRecommendedApps: setRecommendedApps, |
101 maybeInitializePlugin: maybeInitializePlugin, | 103 setHotwordEnabled: setHotwordEnabled, |
102 onAppListShown: onAppListShown, | 104 onAppListShown: onAppListShown, |
103 onAppListHidden: onAppListHidden, | 105 onAppListHidden: onAppListHidden, |
104 toggleSpeechRecognition: toggleSpeechRecognition | 106 toggleSpeechRecognition: toggleSpeechRecognition |
105 }; | 107 }; |
106 }); | 108 }); |
107 | 109 |
108 document.addEventListener('contextmenu', function(e) { e.preventDefault(); }); | 110 document.addEventListener('contextmenu', function(e) { e.preventDefault(); }); |
109 document.addEventListener('DOMContentLoaded', appList.startPage.initialize); | 111 document.addEventListener('DOMContentLoaded', appList.startPage.initialize); |
OLD | NEW |