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

Unified Diff: content/browser/service_worker/service_worker_internals_ui.cc

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
« no previous file with comments | « content/browser/service_worker/service_worker_internals_ui.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/browser/service_worker/service_worker_internals_ui.cc
diff --git a/content/browser/service_worker/service_worker_internals_ui.cc b/content/browser/service_worker/service_worker_internals_ui.cc
index 42a9a1f09cfbcf56bb1b9fbdedc650623ec870f2..0d4e4445fcc8d7248e8e11d53dbab3b7cbf47c86 100644
--- a/content/browser/service_worker/service_worker_internals_ui.cc
+++ b/content/browser/service_worker/service_worker_internals_ui.cc
@@ -379,6 +379,13 @@ ServiceWorkerInternalsUI::ServiceWorkerInternalsUI(WebUI* web_ui)
WebUIDataSource::Add(browser_context, source);
web_ui->RegisterMessageCallback(
+ "GetOptions",
+ base::Bind(&ServiceWorkerInternalsUI::GetOptions,
+ base::Unretained(this)));
+ web_ui->RegisterMessageCallback(
+ "SetOption",
+ base::Bind(&ServiceWorkerInternalsUI::SetOption, base::Unretained(this)));
+ web_ui->RegisterMessageCallback(
"getAllRegistrations",
base::Bind(&ServiceWorkerInternalsUI::GetAllRegistrations,
base::Unretained(this)));
@@ -417,6 +424,25 @@ ServiceWorkerInternalsUI::~ServiceWorkerInternalsUI() {
BrowserContext::ForEachStoragePartition(browser_context, remove_observer_cb);
}
+void ServiceWorkerInternalsUI::GetOptions(const ListValue* args) {
+ DictionaryValue options;
+ options.SetBoolean("debug_on_start",
+ EmbeddedWorkerDevToolsManager::GetInstance()
+ ->debug_service_worker_on_start());
+ web_ui()->CallJavascriptFunction("serviceworker.onOptions", options);
+}
+
+void ServiceWorkerInternalsUI::SetOption(const ListValue* args) {
+ std::string option_name;
+ bool option_boolean;
+ if (!args->GetString(0, &option_name) || option_name != "debug_on_start" ||
+ !args->GetBoolean(1, &option_boolean)) {
+ return;
+ }
+ EmbeddedWorkerDevToolsManager::GetInstance()
+ ->set_debug_service_worker_on_start(option_boolean);
+}
+
void ServiceWorkerInternalsUI::GetAllRegistrations(const ListValue* args) {
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
BrowserContext* browser_context =
« no previous file with comments | « content/browser/service_worker/service_worker_internals_ui.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698