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 28 matching lines...) Expand all Loading... |
39 */ | 39 */ |
40 function setNaclArch(arch) { | 40 function setNaclArch(arch) { |
41 speechManager.setNaclArch(arch); | 41 speechManager.setNaclArch(arch); |
42 } | 42 } |
43 | 43 |
44 /** | 44 /** |
45 * Invoked when the app-list bubble is shown. | 45 * Invoked when the app-list bubble is shown. |
46 * | 46 * |
47 * @param {boolean} hotwordEnabled Whether the hotword is enabled or not. | 47 * @param {boolean} hotwordEnabled Whether the hotword is enabled or not. |
48 */ | 48 */ |
49 function onAppListShown(hotwordEnabled) { | 49 function onAppListShown(hotwordEnabled, legacySpeechEnabled) { |
50 speechManager.onShown(hotwordEnabled); | 50 if (legacySpeechEnabled) |
| 51 speechManager.onShown(hotwordEnabled); |
| 52 |
| 53 chrome.send('appListShown', [this.doodle != null]); |
51 } | 54 } |
52 | 55 |
53 /** | 56 /** |
54 * Sets the doodle's visibility, hiding or showing the default logo. | 57 * Sets the doodle's visibility, hiding or showing the default logo. |
55 * | 58 * |
56 * @param {boolean} visible Whether the doodle should be made visible. | 59 * @param {boolean} visible Whether the doodle should be made visible. |
57 */ | 60 */ |
58 function setDoodleVisible(visible) { | 61 function setDoodleVisible(visible) { |
59 var doodle = $('doodle'); | 62 var doodle = $('doodle'); |
60 var defaultLogo = $('default_logo'); | 63 var defaultLogo = $('default_logo'); |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
105 setDoodleVisible(true); | 108 setDoodleVisible(true); |
106 }; | 109 }; |
107 doodleImage.src = doodleData.transparent_large_image.url; | 110 doodleImage.src = doodleData.transparent_large_image.url; |
108 | 111 |
109 if (doodleData.target_url) { | 112 if (doodleData.target_url) { |
110 var doodleLink = document.createElement('a'); | 113 var doodleLink = document.createElement('a'); |
111 doodleLink.id = 'doodle_link'; | 114 doodleLink.id = 'doodle_link'; |
112 doodleLink.href = doodleData.target_url; | 115 doodleLink.href = doodleData.target_url; |
113 doodleLink.target = '_blank'; | 116 doodleLink.target = '_blank'; |
114 doodleLink.appendChild(doodleImage); | 117 doodleLink.appendChild(doodleImage); |
| 118 doodleLink.onclick = function() { |
| 119 chrome.send('doodleClicked'); |
| 120 return true; |
| 121 }; |
115 this.doodle.appendChild(doodleLink); | 122 this.doodle.appendChild(doodleLink); |
116 } else { | 123 } else { |
117 this.doodle.appendChild(doodleImage); | 124 this.doodle.appendChild(doodleImage); |
118 } | 125 } |
119 $('logo_container').appendChild(this.doodle); | 126 $('logo_container').appendChild(this.doodle); |
120 } | 127 } |
121 | 128 |
122 /** | 129 /** |
123 * Invoked when the app-list bubble is hidden. | 130 * Invoked when the app-list bubble is hidden. |
124 */ | 131 */ |
(...skipping 15 matching lines...) Expand all Loading... |
140 setNaclArch: setNaclArch, | 147 setNaclArch: setNaclArch, |
141 onAppListDoodleUpdated: onAppListDoodleUpdated, | 148 onAppListDoodleUpdated: onAppListDoodleUpdated, |
142 onAppListShown: onAppListShown, | 149 onAppListShown: onAppListShown, |
143 onAppListHidden: onAppListHidden, | 150 onAppListHidden: onAppListHidden, |
144 toggleSpeechRecognition: toggleSpeechRecognition | 151 toggleSpeechRecognition: toggleSpeechRecognition |
145 }; | 152 }; |
146 }); | 153 }); |
147 | 154 |
148 document.addEventListener('contextmenu', function(e) { e.preventDefault(); }); | 155 document.addEventListener('contextmenu', function(e) { e.preventDefault(); }); |
149 document.addEventListener('DOMContentLoaded', appList.startPage.initialize); | 156 document.addEventListener('DOMContentLoaded', appList.startPage.initialize); |
OLD | NEW |