Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(8)

Side by Side Diff: chrome/browser/resources/translate_internals/translate_internals.js

Issue 13842010: Added chrome://translate-internals (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Bug fix for Windows (SendMessage could be replaced with SendMessageW) Created 7 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
(Empty)
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
3 // found in the LICENSE file.
4
5 (function() {
6 'use strict';
7
8 cr.define('cr.translateInternals', function() {
9
10 /**
11 * Initializes UI and sends a message to the browser for
12 * initialization.
13 */
14 function initialize() {
15 cr.ui.decorate('tabbox', cr.ui.TabBox);
16 chrome.send('requestInfo');
17 }
18
19 /**
20 * Handles the message of 'prefsUpdated' from the browser.
21 * @param {Object} detail The object which represents pref values.
22 */
23 function onPrefsUpdated(detail) {
24 var p = $('tabpanel-prefs').querySelector('p');
25 var content = JSON.stringify(detail, null, 2);
26 p.textContent = content;
27 }
28
29 /**
30 * The callback entry point from the browser. This function will be
31 * called by the browser.
32 * @param {string} message The name of the sent message
33 * @param {Object} detail The argument of the sent message
34 */
35 function messageHandler(message, detail) {
36 switch (message) {
37 case 'prefsUpdated':
38 cr.translateInternals.onPrefsUpdated(detail);
39 break;
40 default:
41 console.error('Unknown message:', message);
42 break;
43 }
44 }
45
46 return {
47 initialize: initialize,
48 messageHandler: messageHandler,
49 onPrefsUpdated: onPrefsUpdated
50 };
51 });
52
53 /**
54 * The entry point of the UI.
55 */
56 function main() {
57 cr.doc.addEventListener('DOMContentLoaded',
58 cr.translateInternals.initialize);
59 }
60
61 main();
62 })();
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698