OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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/signed_in_devices/signed_in_devices_mana
ger.h" | 5 #include "chrome/browser/extensions/api/signed_in_devices/signed_in_devices_mana
ger.h" |
6 | 6 |
7 #include <string> | 7 #include <string> |
8 #include <vector> | 8 #include <vector> |
9 | 9 |
10 #include "base/lazy_instance.h" | 10 #include "base/lazy_instance.h" |
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
110 extensions::EventRouter* router = extensions::ExtensionSystem::Get( | 110 extensions::EventRouter* router = extensions::ExtensionSystem::Get( |
111 profile_)->event_router(); | 111 profile_)->event_router(); |
112 | 112 |
113 if (router) { | 113 if (router) { |
114 router->RegisterObserver( | 114 router->RegisterObserver( |
115 this, api::signed_in_devices::OnDeviceInfoChange::kEventName); | 115 this, api::signed_in_devices::OnDeviceInfoChange::kEventName); |
116 } | 116 } |
117 | 117 |
118 // Register for unload event so we could clear all our listeners when | 118 // Register for unload event so we could clear all our listeners when |
119 // extensions have unloaded. | 119 // extensions have unloaded. |
120 registrar_.Add(this, chrome::NOTIFICATION_EXTENSION_UNLOADED, | 120 registrar_.Add(this, chrome::NOTIFICATION_EXTENSION_UNLOADED_DEPRECATED, |
121 content::Source<Profile>(profile_->GetOriginalProfile())); | 121 content::Source<Profile>(profile_->GetOriginalProfile())); |
122 } | 122 } |
123 | 123 |
124 SignedInDevicesManager::~SignedInDevicesManager() {} | 124 SignedInDevicesManager::~SignedInDevicesManager() {} |
125 | 125 |
126 void SignedInDevicesManager::OnListenerAdded( | 126 void SignedInDevicesManager::OnListenerAdded( |
127 const EventListenerInfo& details) { | 127 const EventListenerInfo& details) { |
128 for (ScopedVector<SignedInDevicesChangeObserver>::const_iterator it = | 128 for (ScopedVector<SignedInDevicesChangeObserver>::const_iterator it = |
129 change_observers_.begin(); | 129 change_observers_.begin(); |
130 it != change_observers_.end(); | 130 it != change_observers_.end(); |
(...skipping 25 matching lines...) Expand all Loading... |
156 change_observers_.erase(it); | 156 change_observers_.erase(it); |
157 return; | 157 return; |
158 } | 158 } |
159 } | 159 } |
160 } | 160 } |
161 | 161 |
162 void SignedInDevicesManager::Observe( | 162 void SignedInDevicesManager::Observe( |
163 int type, | 163 int type, |
164 const content::NotificationSource& source, | 164 const content::NotificationSource& source, |
165 const content::NotificationDetails& details) { | 165 const content::NotificationDetails& details) { |
166 DCHECK_EQ(type, chrome::NOTIFICATION_EXTENSION_UNLOADED); | 166 DCHECK_EQ(type, chrome::NOTIFICATION_EXTENSION_UNLOADED_DEPRECATED); |
167 UnloadedExtensionInfo* reason = | 167 UnloadedExtensionInfo* reason = |
168 content::Details<UnloadedExtensionInfo>(details).ptr(); | 168 content::Details<UnloadedExtensionInfo>(details).ptr(); |
169 RemoveChangeObserverForExtension(reason->extension->id()); | 169 RemoveChangeObserverForExtension(reason->extension->id()); |
170 } | 170 } |
171 | 171 |
172 } // namespace extensions | 172 } // namespace extensions |
OLD | NEW |