diff --git a/background.js b/background.js index 8f4573e..f8746a9 100644 --- a/background.js +++ b/background.js @@ -5,7 +5,7 @@ const { LicenseType, SignedMessage, LicenseRequest, License } = protobuf.roots.d import "./lib/forge.min.js"; import { Session } from "./lib/cdm.js"; -import { DeviceManager, SettingsManager, AsyncLocalStorage, RemoteCDMManager, Util } from "./lib/util.js"; +import { DeviceManager, SettingsManager, AsyncLocalStorage, RemoteCDMManager, IconManager, Util } from "./lib/util.js"; import { WidevineDevice } from "./lib/device.js"; import { RemoteCdm } from "./lib/remote_cdm.js"; @@ -142,6 +142,7 @@ async function parseLicense(body, sendResponse, tab_url) { } logs.push(log); await AsyncLocalStorage.setStorage({[pssh]: log}); + IconManager.setNotificationIcon(); sessions.delete(loaded_request_id); sendResponse(); @@ -328,6 +329,7 @@ chrome.runtime.onMessage.addListener((message, sender, sendResponse) => { case "CLEAR": logs = []; manifests.clear(); + IconManager.setDefaultIcon(); break; case "MANIFEST": const parsed = JSON.parse(message.body); @@ -351,3 +353,7 @@ chrome.runtime.onMessage.addListener((message, sender, sendResponse) => { })(); return true; }); + +chrome.runtime.onSuspend.addListener(() => { + IconManager.setDefaultIcon(); +}); diff --git a/images/icon-128-notification.png b/images/icon-128-notification.png new file mode 100644 index 0000000..8e3ef0e Binary files /dev/null and b/images/icon-128-notification.png differ diff --git a/lib/util.js b/lib/util.js index f18f291..e3f824e 100644 --- a/lib/util.js +++ b/lib/util.js @@ -315,6 +315,24 @@ export class SettingsManager { } } +export class IconManager { + static setDefaultIcon() { + chrome.action.setIcon({ + path: { + 128: "images/icon-128.png" + } + }); + } + + static setNotificationIcon() { + chrome.action.setIcon({ + path: { + 128: "images/icon-128-notification.png" + } + }); + } +} + export class Util { static utf8 = { /* Uint8Array -> String */ diff --git a/manifest.json b/manifest.json index 77b98d3..6e52f33 100644 --- a/manifest.json +++ b/manifest.json @@ -1,7 +1,7 @@ { "manifest_version": 3, "name": "WidevineProxy2", - "version": "0.9.0", + "version": "0.9.1", "permissions": [ "activeTab", "tabs",