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" |
11 #include "base/memory/linked_ptr.h" | 11 #include "base/memory/linked_ptr.h" |
12 #include "base/memory/scoped_ptr.h" | 12 #include "base/memory/scoped_ptr.h" |
13 #include "base/memory/scoped_vector.h" | 13 #include "base/memory/scoped_vector.h" |
14 #include "base/profiler/scoped_profile.h" | |
15 #include "base/values.h" | 14 #include "base/values.h" |
16 #include "chrome/browser/extensions/api/signed_in_devices/signed_in_devices_api.
h" | 15 #include "chrome/browser/extensions/api/signed_in_devices/signed_in_devices_api.
h" |
17 #include "chrome/browser/extensions/extension_service.h" | 16 #include "chrome/browser/extensions/extension_service.h" |
18 #include "chrome/browser/profiles/profile.h" | 17 #include "chrome/browser/profiles/profile.h" |
19 #include "chrome/browser/sync/profile_sync_service.h" | 18 #include "chrome/browser/sync/profile_sync_service.h" |
20 #include "chrome/browser/sync/profile_sync_service_factory.h" | 19 #include "chrome/browser/sync/profile_sync_service_factory.h" |
21 #include "chrome/common/extensions/api/signed_in_devices.h" | 20 #include "chrome/common/extensions/api/signed_in_devices.h" |
22 #include "components/sync_driver/device_info.h" | 21 #include "components/sync_driver/device_info.h" |
23 #include "extensions/browser/event_router.h" | 22 #include "extensions/browser/event_router.h" |
24 #include "extensions/browser/extension_registry.h" | 23 #include "extensions/browser/extension_registry.h" |
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
111 | 110 |
112 // Register for unload event so we could clear all our listeners when | 111 // Register for unload event so we could clear all our listeners when |
113 // extensions have unloaded. | 112 // extensions have unloaded. |
114 extension_registry_observer_.Add(ExtensionRegistry::Get(profile_)); | 113 extension_registry_observer_.Add(ExtensionRegistry::Get(profile_)); |
115 } | 114 } |
116 | 115 |
117 SignedInDevicesManager::~SignedInDevicesManager() {} | 116 SignedInDevicesManager::~SignedInDevicesManager() {} |
118 | 117 |
119 void SignedInDevicesManager::OnListenerAdded( | 118 void SignedInDevicesManager::OnListenerAdded( |
120 const EventListenerInfo& details) { | 119 const EventListenerInfo& details) { |
121 // TODO(vadimt): Remove ScopedProfile below once crbug.com/417106 is fixed. | |
122 tracked_objects::ScopedProfile tracking_profile( | |
123 FROM_HERE_WITH_EXPLICIT_FUNCTION( | |
124 "SignedInDevicesManager::OnListenerAdded")); | |
125 | |
126 for (ScopedVector<SignedInDevicesChangeObserver>::const_iterator it = | 120 for (ScopedVector<SignedInDevicesChangeObserver>::const_iterator it = |
127 change_observers_.begin(); | 121 change_observers_.begin(); |
128 it != change_observers_.end(); | 122 it != change_observers_.end(); |
129 ++it) { | 123 ++it) { |
130 if ((*it)->extension_id() == details.extension_id) { | 124 if ((*it)->extension_id() == details.extension_id) { |
131 DCHECK(false) <<"OnListenerAded fired twice for same extension"; | 125 DCHECK(false) <<"OnListenerAded fired twice for same extension"; |
132 return; | 126 return; |
133 } | 127 } |
134 } | 128 } |
135 | 129 |
(...skipping 21 matching lines...) Expand all Loading... |
157 } | 151 } |
158 | 152 |
159 void SignedInDevicesManager::OnExtensionUnloaded( | 153 void SignedInDevicesManager::OnExtensionUnloaded( |
160 content::BrowserContext* browser_context, | 154 content::BrowserContext* browser_context, |
161 const Extension* extension, | 155 const Extension* extension, |
162 UnloadedExtensionInfo::Reason reason) { | 156 UnloadedExtensionInfo::Reason reason) { |
163 RemoveChangeObserverForExtension(extension->id()); | 157 RemoveChangeObserverForExtension(extension->id()); |
164 } | 158 } |
165 | 159 |
166 } // namespace extensions | 160 } // namespace extensions |
OLD | NEW |