Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(3)

Side by Side Diff: chrome/browser/extensions/api/cast_devices_private/cast_devices_private_api.cc

Issue 2422963002: Remove FOR_EACH_OBSERVER macro usage in chrome/browser/extensions (Closed)
Patch Set: extensions Created 4 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "chrome/browser/extensions/api/cast_devices_private/cast_devices_privat e_api.h" 5 #include "chrome/browser/extensions/api/cast_devices_private/cast_devices_privat e_api.h"
6 6
7 #include "base/lazy_instance.h" 7 #include "base/lazy_instance.h"
8 #include "base/strings/utf_string_conversions.h" 8 #include "base/strings/utf_string_conversions.h"
9 #include "chrome/common/extensions/api/cast_devices_private.h" 9 #include "chrome/common/extensions/api/cast_devices_private.h"
10 10
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
70 observer_list_.AddObserver(observer); 70 observer_list_.AddObserver(observer);
71 } 71 }
72 72
73 void CastDeviceUpdateListeners::RemoveObserver( 73 void CastDeviceUpdateListeners::RemoveObserver(
74 ash::CastConfigDelegate::Observer* observer) { 74 ash::CastConfigDelegate::Observer* observer) {
75 observer_list_.RemoveObserver(observer); 75 observer_list_.RemoveObserver(observer);
76 } 76 }
77 77
78 void CastDeviceUpdateListeners::NotifyCallbacks( 78 void CastDeviceUpdateListeners::NotifyCallbacks(
79 const ReceiverAndActivityList& devices) { 79 const ReceiverAndActivityList& devices) {
80 FOR_EACH_OBSERVER(ash::CastConfigDelegate::Observer, observer_list_, 80 for (auto& observer : observer_list_)
81 OnDevicesUpdated(devices)); 81 observer.OnDevicesUpdated(devices);
82 } 82 }
83 83
84 CastDevicesPrivateUpdateDevicesFunction:: 84 CastDevicesPrivateUpdateDevicesFunction::
85 CastDevicesPrivateUpdateDevicesFunction() {} 85 CastDevicesPrivateUpdateDevicesFunction() {}
86 86
87 CastDevicesPrivateUpdateDevicesFunction:: 87 CastDevicesPrivateUpdateDevicesFunction::
88 ~CastDevicesPrivateUpdateDevicesFunction() {} 88 ~CastDevicesPrivateUpdateDevicesFunction() {}
89 89
90 ExtensionFunction::ResponseAction 90 ExtensionFunction::ResponseAction
91 CastDevicesPrivateUpdateDevicesFunction::Run() { 91 CastDevicesPrivateUpdateDevicesFunction::Run() {
92 auto params = 92 auto params =
93 api::cast_devices_private::UpdateDevices::Params::Create(*args_); 93 api::cast_devices_private::UpdateDevices::Params::Create(*args_);
94 94
95 CastDeviceUpdateListeners::ReceiverAndActivityList devices; 95 CastDeviceUpdateListeners::ReceiverAndActivityList devices;
96 for (const api::cast_devices_private::ReceiverActivity& device : 96 for (const api::cast_devices_private::ReceiverActivity& device :
97 params->devices) { 97 params->devices) {
98 devices.push_back( 98 devices.push_back(
99 ConvertReceiverAndActivityType(device.receiver, device.activity.get())); 99 ConvertReceiverAndActivityType(device.receiver, device.activity.get()));
100 } 100 }
101 101
102 auto* listeners = CastDeviceUpdateListeners::Get(browser_context()); 102 auto* listeners = CastDeviceUpdateListeners::Get(browser_context());
103 listeners->NotifyCallbacks(devices); 103 listeners->NotifyCallbacks(devices);
104 104
105 return RespondNow(NoArguments()); 105 return RespondNow(NoArguments());
106 } 106 }
107 107
108 } // namespace extensions 108 } // namespace extensions
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698