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

Unified Diff: chrome/browser/resources/translate_internals/index.js

Issue 13842010: Added chrome://translate-internals (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fixed the mistakes 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/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();
+})();

Powered by Google App Engine
This is Rietveld 408576698