Add API to notify extensions on theme change

We recently changed the behavior of DevTools such that it doesn't reload
when the theme changes. However, during instantiation an extension
receives the current theme name under chrome.devtools.panels.themeName.
Given the above, when the theme changes, the themeName value is stale,
and the extension has no way of knowing that the theme has changed.

This CL introduces a new hook for extensions, setThemeChangeHandler,
which follows the same pattern as setOpenResourceHandler. This allows an
extension developer to register a callback for when the theme changes.
The chrome.devtools.panels.themeName is automatically updated, and the
callback also receives the theme name as its parameter.

Bug: 1285420
Change-Id: I52aa813d7d7b327ad6bfe8ca99fa9d578662b417
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/3380591
Reviewed-by: Tim Van der Lippe <tvanderlippe@chromium.org>
Commit-Queue: Paul Lewis <aerotwist@chromium.org>
diff --git a/extension-api/ExtensionAPI.d.ts b/extension-api/ExtensionAPI.d.ts
index c25e5e9..1c4b50b 100644
--- a/extension-api/ExtensionAPI.d.ts
+++ b/extension-api/ExtensionAPI.d.ts
@@ -69,6 +69,13 @@
 
       create(title: string, iconPath: string, pagePath: string, callback?: (panel: ExtensionPanel) => unknown): void;
       openResource(url: string, lineNumber: number, columnNumber?: number, callback?: () => unknown): void;
+
+      /**
+       * Fired when the theme changes in DevTools.
+       *
+       * @param callback The handler callback to register and be invoked on theme changes.
+       */
+      setThemeChangeHandler(callback?: (themeName: string) => unknown): void;
     }
 
     export interface Request {