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 (function() { | 5 (function() { |
6 'use strict'; | 6 'use strict'; |
7 | 7 |
8 cr.define('cr.translateInternals', function() { | 8 cr.define('cr.translateInternals', function() { |
9 | 9 |
10 var detectionLogs_ = null; | 10 var detectionLogs_ = null; |
(...skipping 390 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
401 break; | 401 break; |
402 } | 402 } |
403 } | 403 } |
404 | 404 |
405 /** | 405 /** |
406 * The callback of button#detetion-logs-dump. | 406 * The callback of button#detetion-logs-dump. |
407 */ | 407 */ |
408 function onDetectionLogsDump() { | 408 function onDetectionLogsDump() { |
409 var data = JSON.stringify(cr.translateInternals.detectionLogs()); | 409 var data = JSON.stringify(cr.translateInternals.detectionLogs()); |
410 var blob = new Blob([data], {'type': 'text/json'}); | 410 var blob = new Blob([data], {'type': 'text/json'}); |
411 var url = webkitURL.createObjectURL(blob); | 411 var url = URL.createObjectURL(blob); |
412 var filename = 'translate_internals_detect_logs_dump.json'; | 412 var filename = 'translate_internals_detect_logs_dump.json'; |
413 | 413 |
414 var a = document.createElement('a'); | 414 var a = document.createElement('a'); |
415 a.setAttribute('href', url); | 415 a.setAttribute('href', url); |
416 a.setAttribute('download', filename); | 416 a.setAttribute('download', filename); |
417 | 417 |
418 var event = document.createEvent('MouseEvent'); | 418 var event = document.createEvent('MouseEvent'); |
419 event.initMouseEvent('click', true, true, window, 0, | 419 event.initMouseEvent('click', true, true, window, 0, |
420 0, 0, 0, 0, 0, 0, 0, 0, 0, null); | 420 0, 0, 0, 0, 0, 0, 0, 0, 0, null); |
421 a.dispatchEvent(event); | 421 a.dispatchEvent(event); |
422 } | 422 } |
423 | 423 |
424 return { | 424 return { |
425 detectionLogs: detectionLogs, | 425 detectionLogs: detectionLogs, |
426 initialize: initialize, | 426 initialize: initialize, |
427 messageHandler: messageHandler, | 427 messageHandler: messageHandler, |
428 }; | 428 }; |
429 }); | 429 }); |
430 | 430 |
431 /** | 431 /** |
432 * The entry point of the UI. | 432 * The entry point of the UI. |
433 */ | 433 */ |
434 function main() { | 434 function main() { |
435 cr.doc.addEventListener('DOMContentLoaded', | 435 cr.doc.addEventListener('DOMContentLoaded', |
436 cr.translateInternals.initialize); | 436 cr.translateInternals.initialize); |
437 } | 437 } |
438 | 438 |
439 main(); | 439 main(); |
440 })(); | 440 })(); |
OLD | NEW |