| OLD | NEW |
| (Empty) | |
| 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. |
| 4 |
| 5 (function() { |
| 6 'use strict'; |
| 7 |
| 8 cr.define('cr.translateInternals', function() { |
| 9 |
| 10 function initialize() { |
| 11 cr.ui.decorate('tabbox', cr.ui.TabBox); |
| 12 chrome.send('requestInfo'); |
| 13 } |
| 14 |
| 15 function escapeHTML(str) { |
| 16 return str.replace(/&/g, '&').replace(/</g, '<'). |
| 17 replace(/>/g, '>').replace(/"/g, '"'); |
| 18 } |
| 19 |
| 20 function onPrefsUpdated(detail) { |
| 21 console.log(detail); |
| 22 var pre = $('tabpanelPrefs').querySelector('pre'); |
| 23 var content = JSON.stringify(detail, null, 2); |
| 24 pre.innerHTML = escapeHTML(content); |
| 25 } |
| 26 |
| 27 /** |
| 28 * The callback entry point from the browser. |
| 29 * This function will be called by the browser. |
| 30 */ |
| 31 function messageHandler(message, detail) { |
| 32 switch (message) { |
| 33 case 'prefsUpdated': |
| 34 cr.translateInternals.onPrefsUpdated(detail); |
| 35 break; |
| 36 default: |
| 37 console.error('Unknown message:', message); |
| 38 break; |
| 39 } |
| 40 } |
| 41 |
| 42 return { |
| 43 initialize: initialize, |
| 44 messageHandler: messageHandler, |
| 45 onPrefsUpdated: onPrefsUpdated |
| 46 }; |
| 47 }); |
| 48 |
| 49 function main() { |
| 50 cr.doc.addEventListener('DOMContentLoaded', |
| 51 cr.translateInternals.initialize); |
| 52 } |
| 53 |
| 54 main(); |
| 55 })(); |
| OLD | NEW |