refactor: use base::ObserverList::Notify()
(#46897)
* refactor: use ObserverList::Notify() in shell/browser/window_list.cc Co-authored-by: Charles Kerr <charles@charleskerr.com> * refactor: use ObserverList::Notify() in shell/browser/web_contents_zoom_controller.cc Co-authored-by: Charles Kerr <charles@charleskerr.com> * refactor: use ObserverList::Notify() in shell/browser/usb/usb_chooser_context.cc Co-authored-by: Charles Kerr <charles@charleskerr.com> * refactor: use ObserverList::Notify() in shell/browser/usb/electron_usb_delegate.cc Co-authored-by: Charles Kerr <charles@charleskerr.com> * refactor: use ObserverList::Notify() in shell/browser/ui/views/menu_delegate.cc Co-authored-by: Charles Kerr <charles@charleskerr.com> * refactor: use ObserverList::Notify() in shell/browser/ui/tray_icon.cc Co-authored-by: Charles Kerr <charles@charleskerr.com> * refactor: use ObserverList::Notify() in shell/browser/ui/electron_menu_model.cc Co-authored-by: Charles Kerr <charles@charleskerr.com> * refactor: use ObserverList::Notify() in shell/browser/serial/serial_chooser_context.cc Co-authored-by: Charles Kerr <charles@charleskerr.com> * refactor: use ObserverList::Notify() in shell/browser/native_window.cc Co-authored-by: Charles Kerr <charles@charleskerr.com> * refactor: use ObserverList::Notify() in shell/browser/serial/electron_serial_delegate.cc Co-authored-by: Charles Kerr <charles@charleskerr.com> * refactor: use ObserverList::Notify() in shell/browser/browser.cc Co-authored-by: Charles Kerr <charles@charleskerr.com> * refactor: use ObserverList::Notify() in shell/browser/api/electron_api_web_contents.cc Co-authored-by: Charles Kerr <charles@charleskerr.com> * refactor: use ObserverList::Notify() in shell/browser/hid/electron_hid_delegate.cc Co-authored-by: Charles Kerr <charles@charleskerr.com> * refactor: use ObserverList::Notify() in shell/browser/hid/hid_chooser_context.cc Co-authored-by: Charles Kerr <charles@charleskerr.com> --------- Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com> Co-authored-by: Charles Kerr <charles@charleskerr.com>
This commit is contained in:
parent
1687b95849
commit
17e1ff2675
14 changed files with 134 additions and 229 deletions
|
@ -247,8 +247,7 @@ void HidChooserContext::DeviceAdded(device::mojom::HidDeviceInfoPtr device) {
|
|||
devices_.insert({device->guid, device->Clone()});
|
||||
|
||||
// Notify all observers.
|
||||
for (auto& observer : device_observer_list_)
|
||||
observer.OnDeviceAdded(*device);
|
||||
device_observer_list_.Notify(&DeviceObserver::OnDeviceAdded, *device);
|
||||
}
|
||||
|
||||
void HidChooserContext::DeviceRemoved(device::mojom::HidDeviceInfoPtr device) {
|
||||
|
@ -259,8 +258,7 @@ void HidChooserContext::DeviceRemoved(device::mojom::HidDeviceInfoPtr device) {
|
|||
DCHECK_EQ(n_erased, 1U);
|
||||
|
||||
// Notify all device observers.
|
||||
for (auto& observer : device_observer_list_)
|
||||
observer.OnDeviceRemoved(*device);
|
||||
device_observer_list_.Notify(&DeviceObserver::OnDeviceRemoved, *device);
|
||||
|
||||
// Next we'll notify observers for revoked permissions. If the device does not
|
||||
// support persistent permissions then device permissions are revoked on
|
||||
|
@ -281,8 +279,7 @@ void HidChooserContext::DeviceChanged(device::mojom::HidDeviceInfoPtr device) {
|
|||
mapped = device->Clone();
|
||||
|
||||
// Notify all observers.
|
||||
for (auto& observer : device_observer_list_)
|
||||
observer.OnDeviceChanged(*device);
|
||||
device_observer_list_.Notify(&DeviceObserver::OnDeviceChanged, *device);
|
||||
}
|
||||
|
||||
void HidChooserContext::EnsureHidManagerConnection() {
|
||||
|
@ -332,8 +329,7 @@ void HidChooserContext::OnHidManagerConnectionError() {
|
|||
ephemeral_devices_.clear();
|
||||
|
||||
// Notify all device observers.
|
||||
for (auto& observer : device_observer_list_)
|
||||
observer.OnHidManagerConnectionError();
|
||||
device_observer_list_.Notify(&DeviceObserver::OnHidManagerConnectionError);
|
||||
}
|
||||
|
||||
} // namespace electron
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue