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 |
11 cr.define('appList.startPage', function() { | 11 cr.define('appList.startPage', function() { |
12 'use strict'; | 12 'use strict'; |
13 | 13 |
14 var speechManager = null; | 14 var speechManager = null; |
15 | 15 |
16 // The element containing the current Google Doodle. | 16 // The element containing the current Google Doodle. |
17 var doodle = null; | 17 var doodle = null; |
18 | 18 |
| 19 // TODO(calamity): This is used for manual inspection of the doodle data. |
| 20 // Remove this once http://crbug.com/462082 is diagnosed. |
| 21 var doodleData = null; |
| 22 |
19 /** | 23 /** |
20 * Initialize the page. | 24 * Initialize the page. |
21 */ | 25 */ |
22 function initialize() { | 26 function initialize() { |
23 speechManager = new speech.SpeechManager(); | 27 speechManager = new speech.SpeechManager(); |
24 chrome.send('initialize'); | 28 chrome.send('initialize'); |
25 } | 29 } |
26 | 30 |
27 /** | 31 /** |
28 * Invoked when the hotword plugin availability is changed. | 32 * Invoked when the hotword plugin availability is changed. |
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
77 * | 81 * |
78 * @param {Object} data The data object representing the current doodle. | 82 * @param {Object} data The data object representing the current doodle. |
79 */ | 83 */ |
80 function onAppListDoodleUpdated(data, base_url) { | 84 function onAppListDoodleUpdated(data, base_url) { |
81 if (this.doodle) { | 85 if (this.doodle) { |
82 this.doodle.parentNode.removeChild(this.doodle); | 86 this.doodle.parentNode.removeChild(this.doodle); |
83 this.doodle = null; | 87 this.doodle = null; |
84 } | 88 } |
85 | 89 |
86 var doodleData = data.ddljson; | 90 var doodleData = data.ddljson; |
| 91 this.doodleData = doodleData; |
87 if (!doodleData || !doodleData.transparent_large_image) { | 92 if (!doodleData || !doodleData.transparent_large_image) { |
88 setDoodleVisible(false); | 93 setDoodleVisible(false); |
89 return; | 94 return; |
90 } | 95 } |
91 | 96 |
92 // Set the page's base URL so that links will resolve relative to the Google | 97 // Set the page's base URL so that links will resolve relative to the Google |
93 // homepage. | 98 // homepage. |
94 $('base').href = base_url; | 99 $('base').href = base_url; |
95 | 100 |
96 this.doodle = document.createElement('div'); | 101 this.doodle = document.createElement('div'); |
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
145 initialize: initialize, | 150 initialize: initialize, |
146 setHotwordEnabled: setHotwordEnabled, | 151 setHotwordEnabled: setHotwordEnabled, |
147 setNaclArch: setNaclArch, | 152 setNaclArch: setNaclArch, |
148 onAppListDoodleUpdated: onAppListDoodleUpdated, | 153 onAppListDoodleUpdated: onAppListDoodleUpdated, |
149 onAppListShown: onAppListShown, | 154 onAppListShown: onAppListShown, |
150 onAppListHidden: onAppListHidden, | 155 onAppListHidden: onAppListHidden, |
151 toggleSpeechRecognition: toggleSpeechRecognition | 156 toggleSpeechRecognition: toggleSpeechRecognition |
152 }; | 157 }; |
153 }); | 158 }); |
154 | 159 |
155 document.addEventListener('contextmenu', function(e) { e.preventDefault(); }); | 160 // TODO(calamity): Suppress context the menu once http://crbug.com/462082 is |
| 161 // diagnosed. |
156 document.addEventListener('DOMContentLoaded', appList.startPage.initialize); | 162 document.addEventListener('DOMContentLoaded', appList.startPage.initialize); |
OLD | NEW |