OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 function Loader(pages) { | 5 function Loader(pages) { |
6 this.pages_ = pages; | 6 this.pages_ = pages; |
7 this.pagesLoaded_ = false; | 7 this.pagesLoaded_ = false; |
8 this.loadedCount_ = false; | 8 this.loadedCount_ = false; |
9 } | 9 } |
10 | 10 |
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
57 onAlarm_: function(alarm) { | 57 onAlarm_: function(alarm) { |
58 if (alarm.name != this.ALARM_NAME) | 58 if (alarm.name != this.ALARM_NAME) |
59 return; | 59 return; |
60 | 60 |
61 this.preparePages_(); | 61 this.preparePages_(); |
62 }, | 62 }, |
63 | 63 |
64 onMessage_: function(event) { | 64 onMessage_: function(event) { |
65 var msg = event.data; | 65 var msg = event.data; |
66 if (msg.method == 'validate') { | 66 if (msg.method == 'validate') { |
67 var reply_msg = { | 67 var replyMsg = { |
68 method: 'validationResults', | 68 method: 'validationResults', |
69 os: 'ChromeOS' | 69 os: 'ChromeOS' |
70 }; | 70 }; |
71 event.source.postMessage(reply_msg, event.origin); | 71 event.source.postMessage(replyMsg, event.origin); |
72 } else { | 72 } else { |
73 console.log('#### Loader.onMessage_: unknown message'); | 73 console.log('#### Loader.onMessage_: unknown message'); |
74 } | 74 } |
75 }, | 75 }, |
76 | 76 |
77 // Find an extension in the |list| with matching extension |id|. | 77 // Find an extension in the |list| with matching extension |id|. |
78 getExtensionById_: function(list, id) { | 78 getExtensionById_: function(list, id) { |
79 for (var i = 0; i < list.length; i++) { | 79 for (var i = 0; i < list.length; i++) { |
80 if (list[i].id == id) | 80 if (list[i].id == id) |
81 return list[i]; | 81 return list[i]; |
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
136 iframe.onload = function() { | 136 iframe.onload = function() { |
137 this.incrementLoadCounter_(); | 137 this.incrementLoadCounter_(); |
138 }.bind(this); | 138 }.bind(this); |
139 iframe.src = pageUrl; | 139 iframe.src = pageUrl; |
140 iframe.name = 'frame_' + index; | 140 iframe.name = 'frame_' + index; |
141 document.body.appendChild(iframe); | 141 document.body.appendChild(iframe); |
142 } | 142 } |
143 }; | 143 }; |
144 | 144 |
145 Loader.getInstance().initialize(); | 145 Loader.getInstance().initialize(); |
OLD | NEW |