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

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 trivial 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..3e2a61d3ee61b49b6df15a943f932004090db119
--- /dev/null
+++ b/chrome/browser/resources/translate_internals/index.js
@@ -0,0 +1,55 @@
+// Copyright (c) 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() {
+
+ function initialize() {
+ cr.ui.decorate('tabbox', cr.ui.TabBox);
+ chrome.send('requestInfo');
+ }
+
+ function escapeHTML(str) {
+ return str.replace(/&/g, '&amp;').replace(/</g, '&lt;').
+ replace(/>/g, '&gt;').replace(/"/g, '&quot;');
+ }
+
+ function onPrefsUpdated(detail) {
+ 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
+ var pre = $('tabpanelPrefs').querySelector('pre');
+ var content = JSON.stringify(detail, null, 2);
+ 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.
+ }
+
+ /**
+ * The callback entry point from the browser.
+ * 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.
+ */
+ function messageHandler(message, detail) {
+ switch (message) {
+ case 'prefsUpdated':
+ cr.translateInternals.onPrefsUpdated(detail);
+ break;
+ default:
+ 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.
+ break;
+ }
+ }
+
+ return {
+ initialize: initialize,
+ messageHandler: messageHandler,
+ onPrefsUpdated: onPrefsUpdated
+ };
+ });
+
+ function main() {
+ cr.doc.addEventListener('DOMContentLoaded',
+ cr.translateInternals.initialize);
+ }
+
+ main();
+})();

Powered by Google App Engine
This is Rietveld 408576698