Chromium Code Reviews| Index: chrome/browser/resources/translate_internals/index.js |
| diff --git a/chrome/browser/resources/translate_internals/index.js b/chrome/browser/resources/translate_internals/index.js |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..ee150ff63b07bf236fe80c176ca6ec6cbeea0d7f |
| --- /dev/null |
| +++ b/chrome/browser/resources/translate_internals/index.js |
| @@ -0,0 +1,62 @@ |
| +// Copyright 2013 The Chromium Authors. All rights reserved. |
| +// Use of this source code is governed by a BSD-style license that can be |
| +// found in the LICENSE file. |
| + |
| +(function() { |
| + 'use strict'; |
| + |
| + cr.define('cr.translateInternals', function() { |
| + |
| + /** |
| + * Initializes UI and sends a message to the browser for |
| + * initialization. |
| + */ |
| + function initialize() { |
| + cr.ui.decorate('tabbox', cr.ui.TabBox); |
| + chrome.send('requestInfo'); |
| + } |
| + |
| + /** |
| + * Handles the message of 'prefsUpdated' from the browser. |
| + * @param {Object} detail The object which represents pref values. |
| + */ |
| + function onPrefsUpdated(detail) { |
| + var pre = $('tabpanelPrefs').querySelector('pre'); |
| + var content = JSON.stringify(detail, null, 2); |
| + pre.textContent = content; |
| + } |
| + |
| + /** |
| + * The callback entry point from the browser. This function will be |
| + * called by the browser. |
| + * @param {string} message The name of the sent message |
| + * @param {Object} detail The argument of the sent message |
| + */ |
| + function messageHandler(message, detail) { |
| + switch (message) { |
| + case 'prefsUpdated': |
|
Evan Stade
2013/04/15 19:25:13
is this the proper indentation?
hajimehoshi
2013/04/16 02:01:42
Done.
|
| + cr.translateInternals.onPrefsUpdated(detail); |
| + break; |
| + default: |
| + console.error('Unknown message: ', message); |
|
Evan Stade
2013/04/15 19:25:13
you are right, no need for space after :
hajimehoshi
2013/04/16 02:01:42
Done.
|
| + break; |
| + } |
| + } |
| + |
| + return { |
| + initialize: initialize, |
| + messageHandler: messageHandler, |
| + onPrefsUpdated: onPrefsUpdated |
| + }; |
| + }); |
| + |
| + /** |
| + * The entry point of the UI. |
| + */ |
| + function main() { |
| + cr.doc.addEventListener('DOMContentLoaded', |
| + cr.translateInternals.initialize); |
|
Evan Stade
2013/04/15 19:25:13
indent this argument to align with argument on pre
hajimehoshi
2013/04/16 02:01:42
Done.
|
| + } |
| + |
| + main(); |
| +})(); |