Chromium Code Reviews| 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); | |
|
Evan Stade
2013/04/12 16:02:25
you probably shouldn't put logs in, but if you do
hajimehoshi
2013/04/15 04:01:49
I used just for debugging, and forget to remove it
| |
| 22 var pre = $('tabpanelPrefs').querySelector('pre'); | |
| 23 var content = JSON.stringify(detail, null, 2); | |
| 24 pre.innerHTML = escapeHTML(content); | |
|
Evan Stade
2013/04/12 16:02:25
why don't you just use textContent = ?
hajimehoshi
2013/04/15 04:01:49
Done.
| |
| 25 } | |
| 26 | |
| 27 /** | |
| 28 * The callback entry point from the browser. | |
| 29 * This function will be called by the browser. | |
|
Evan Stade
2013/04/12 16:02:25
there's a style for js documentation which involve
hajimehoshi
2013/04/15 04:01:49
Done.
| |
| 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); | |
|
Evan Stade
2013/04/12 16:02:25
nit: space after :
hajimehoshi
2013/04/15 04:01:49
console.error adds space between the arugments, do
Evan Stade
2013/04/15 19:25:13
oh, so it does.
| |
| 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 |