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
|
@ -48,6 +48,7 @@ class SerialChooserController final : public SerialChooserContext::PortObserver,
|
|||
void OnPortRemoved(const device::mojom::SerialPortInfo& port) override;
|
||||
void OnPortManagerConnectionError() override;
|
||||
void OnPermissionRevoked(const url::Origin& origin) override {}
|
||||
void OnSerialChooserContextShutdown() override;
|
||||
|
||||
private:
|
||||
api::Session* GetSession();
|
||||
|
@ -62,6 +63,12 @@ class SerialChooserController final : public SerialChooserContext::PortObserver,
|
|||
|
||||
base::WeakPtr<SerialChooserContext> chooser_context_;
|
||||
|
||||
base::ScopedObservation<SerialChooserContext,
|
||||
SerialChooserContext::PortObserver,
|
||||
&SerialChooserContext::AddPortObserver,
|
||||
&SerialChooserContext::RemovePortObserver>
|
||||
observation_{this};
|
||||
|
||||
std::vector<device::mojom::SerialPortInfoPtr> ports_;
|
||||
|
||||
base::WeakPtr<ElectronSerialDelegate> serial_delegate_;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue