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

Unified Diff: chrome/browser/ui/webui/inspect_ui.cc

Issue 298993003: Show ServiceWorkers in chrome://inspect. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: 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: chrome/browser/ui/webui/inspect_ui.cc
diff --git a/chrome/browser/ui/webui/inspect_ui.cc b/chrome/browser/ui/webui/inspect_ui.cc
index eb2c06e95623c5e4e2dd649aeb54537a75db0ff8..39f11a36143aaf6858d0ab436110466b5f8226bb 100644
--- a/chrome/browser/ui/webui/inspect_ui.cc
+++ b/chrome/browser/ui/webui/inspect_ui.cc
@@ -366,9 +366,34 @@ content::WebUIDataSource* InspectUI::CreateInspectUIHTMLSource() {
source->AddResourcePath("inspect.css", IDR_INSPECT_CSS);
source->AddResourcePath("inspect.js", IDR_INSPECT_JS);
source->SetDefaultResource(IDR_INSPECT_HTML);
+ source->OverrideContentSecurityPolicyFrameSrc(
+ "frame-src chrome://serviceworker-internals;");
+ serviceworker_webui_.reset(web_ui()->GetWebContents()->CreateWebUI(
+ GURL(content::kChromeUIServiceWorkerInternalsURL)));
+ serviceworker_webui_->OverrideJavaScriptFrame(
+ content::kChromeUIServiceWorkerInternalsHost);
return source;
}
+void InspectUI::RenderViewCreated(content::RenderViewHost* render_view_host) {
+ serviceworker_webui_->GetController()->RenderViewCreated(render_view_host);
+}
+
+void InspectUI::RenderViewReused(content::RenderViewHost* render_view_host) {
+ serviceworker_webui_->GetController()->RenderViewReused(render_view_host);
+}
+
+bool InspectUI::OverrideHandleWebUIMessage(const GURL& source_url,
+ const std::string& message,
+ const base::ListValue& args) {
+ if (source_url.SchemeIs(content::kChromeUIScheme) &&
+ source_url.host() == content::kChromeUIServiceWorkerInternalsHost) {
+ serviceworker_webui_->ProcessWebUIMessage(source_url, message, args);
+ return true;
+ }
+ return false;
+}
+
void InspectUI::UpdateDiscoverUsbDevicesEnabled() {
web_ui()->CallJavascriptFunction(
"updateDiscoverUsbDevicesEnabled",

Powered by Google App Engine
This is Rietveld 408576698