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="speech_manager.js"> | 9 <include src="speech_manager.js"> |
10 | 10 |
(...skipping 30 matching lines...) Expand all Loading... |
41 /** | 41 /** |
42 * Invoked when the app-list bubble is shown. | 42 * Invoked when the app-list bubble is shown. |
43 * | 43 * |
44 * @param {boolean} hotwordEnabled Whether the hotword is enabled or not. | 44 * @param {boolean} hotwordEnabled Whether the hotword is enabled or not. |
45 */ | 45 */ |
46 function onAppListShown(hotwordEnabled) { | 46 function onAppListShown(hotwordEnabled) { |
47 speechManager.onShown(hotwordEnabled); | 47 speechManager.onShown(hotwordEnabled); |
48 } | 48 } |
49 | 49 |
50 /** | 50 /** |
| 51 * Invoked when the app-list doodle is updated. |
| 52 * |
| 53 * @param {Object} data The data object representing the current doodle. |
| 54 */ |
| 55 function onAppListDoodleUpdated(data, base_url) { |
| 56 var defaultLogo = $('default_logo'); |
| 57 var doodle = $('doodle'); |
| 58 if (!data.ddljson || !data.ddljson.transparent_large_image) { |
| 59 defaultLogo.style.display = 'block'; |
| 60 doodle.style.display = 'none'; |
| 61 return; |
| 62 } |
| 63 |
| 64 doodle.onload = function() { |
| 65 defaultLogo.style.display = 'none'; |
| 66 doodle.style.display = 'block'; |
| 67 }; |
| 68 doodle.src = base_url + data.ddljson.transparent_large_image.url; |
| 69 } |
| 70 |
| 71 /** |
51 * Invoked when the app-list bubble is hidden. | 72 * Invoked when the app-list bubble is hidden. |
52 */ | 73 */ |
53 function onAppListHidden() { | 74 function onAppListHidden() { |
54 speechManager.onHidden(); | 75 speechManager.onHidden(); |
55 } | 76 } |
56 | 77 |
57 /** | 78 /** |
58 * Invoked when the user explicitly wants to toggle the speech recognition | 79 * Invoked when the user explicitly wants to toggle the speech recognition |
59 * state. | 80 * state. |
60 */ | 81 */ |
61 function toggleSpeechRecognition() { | 82 function toggleSpeechRecognition() { |
62 speechManager.toggleSpeechRecognition(); | 83 speechManager.toggleSpeechRecognition(); |
63 } | 84 } |
64 | 85 |
65 return { | 86 return { |
66 initialize: initialize, | 87 initialize: initialize, |
67 setHotwordEnabled: setHotwordEnabled, | 88 setHotwordEnabled: setHotwordEnabled, |
68 setNaclArch: setNaclArch, | 89 setNaclArch: setNaclArch, |
| 90 onAppListDoodleUpdated: onAppListDoodleUpdated, |
69 onAppListShown: onAppListShown, | 91 onAppListShown: onAppListShown, |
70 onAppListHidden: onAppListHidden, | 92 onAppListHidden: onAppListHidden, |
71 toggleSpeechRecognition: toggleSpeechRecognition | 93 toggleSpeechRecognition: toggleSpeechRecognition |
72 }; | 94 }; |
73 }); | 95 }); |
74 | 96 |
75 document.addEventListener('DOMContentLoaded', appList.startPage.initialize); | 97 document.addEventListener('DOMContentLoaded', appList.startPage.initialize); |
OLD | NEW |