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

Unified Diff: content/browser/resources/service_worker/serviceworker_internals.js

Issue 299693002: Add option to open the DevTools window for ServiceWorker on start in serviceworker-internals. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase Created 6 years, 7 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: content/browser/resources/service_worker/serviceworker_internals.js
diff --git a/content/browser/resources/service_worker/serviceworker_internals.js b/content/browser/resources/service_worker/serviceworker_internals.js
index 38b5e140f4e8bcc1cc518740180dc44d92dcbd5b..dfa3f62f68c01f7653f26e7a8a0d07d7466aab85 100644
--- a/content/browser/resources/service_worker/serviceworker_internals.js
+++ b/content/browser/resources/service_worker/serviceworker_internals.js
@@ -21,7 +21,31 @@ cr.define('serviceworker', function() {
}
function update() {
- chrome.send('getAllRegistrations');
+ chrome.send('GetOptions');
+ chrome.send('getAllRegistrations');
+ }
+
+ function onOptions(options) {
+ var template;
+ var container = $('serviceworker-options');
+ if (container.childNodes) {
+ template = container.childNodes[0];
+ }
+ if (!template) {
+ template = jstGetTemplate('serviceworker-options-template');
+ container.appendChild(template);
+ }
+ jstProcess(new JsEvalContext(options), template);
+ var inputs = container.querySelectorAll('input[type=\'checkbox\']');
+ for (var i = 0; i < inputs.length; ++i) {
+ if (!inputs[i].hasClickEvent) {
+ inputs[i].addEventListener('click', (function(event) {
+ chrome.send('SetOption',
+ [event.target.className, event.target.checked]);
+ }).bind(this), false);
+ inputs[i].hasClickEvent = true;
+ }
+ }
}
function progressNodeFor(link) {
@@ -264,6 +288,7 @@ cr.define('serviceworker', function() {
return {
initialize: initialize,
+ onOptions: onOptions,
onOperationComplete: onOperationComplete,
onPartitionData: onPartitionData,
onWorkerStarted: onWorkerStarted,

Powered by Google App Engine
This is Rietveld 408576698