fix: properly fire serial-port-added and serial-port-removed events (#34958)
Based on 2309652: [webhid] Notify chooser context observers on shutdown | 2309652
This commit is contained in:
parent
aeba6ca973
commit
648c9934c0
6 changed files with 71 additions and 21 deletions
|
@ -46,7 +46,12 @@ extern const char kUsbDriverKey[];
|
|||
class SerialChooserContext : public KeyedService,
|
||||
public device::mojom::SerialPortManagerClient {
|
||||
public:
|
||||
using PortObserver = content::SerialDelegate::Observer;
|
||||
class PortObserver : public content::SerialDelegate::Observer {
|
||||
public:
|
||||
// Called when the SerialChooserContext is shutting down. Observers must
|
||||
// remove themselves before returning.
|
||||
virtual void OnSerialChooserContextShutdown() = 0;
|
||||
};
|
||||
|
||||
explicit SerialChooserContext(ElectronBrowserContext* context);
|
||||
~SerialChooserContext() override;
|
||||
|
@ -55,9 +60,6 @@ class SerialChooserContext : public KeyedService,
|
|||
SerialChooserContext(const SerialChooserContext&) = delete;
|
||||
SerialChooserContext& operator=(const SerialChooserContext&) = delete;
|
||||
|
||||
// ObjectPermissionContextBase::PermissionObserver:
|
||||
void OnPermissionRevoked(const url::Origin& origin);
|
||||
|
||||
// Serial-specific interface for granting and checking permissions.
|
||||
void GrantPortPermission(const url::Origin& origin,
|
||||
const device::mojom::SerialPortInfo& port,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue