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

Unified 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/resources/translate_internals/translate_internals.js
diff --git a/chrome/browser/resources/translate_internals/translate_internals.js b/chrome/browser/resources/translate_internals/translate_internals.js
new file mode 100644
index 0000000000000000000000000000000000000000..5c5bbe623daa81114e2b36df02521a37b116f823
--- /dev/null
+++ b/chrome/browser/resources/translate_internals/translate_internals.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 p = $('tabpanel-prefs').querySelector('p');
+ var content = JSON.stringify(detail, null, 2);
+ p.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':
+ cr.translateInternals.onPrefsUpdated(detail);
+ break;
+ default:
+ console.error('Unknown message:', message);
+ break;
+ }
+ }
+
+ return {
+ initialize: initialize,
+ messageHandler: messageHandler,
+ onPrefsUpdated: onPrefsUpdated
+ };
+ });
+
+ /**
+ * The entry point of the UI.
+ */
+ function main() {
+ cr.doc.addEventListener('DOMContentLoaded',
+ cr.translateInternals.initialize);
+ }
+
+ main();
+})();

Powered by Google App Engine
This is Rietveld 408576698