| Index: chrome/browser/extensions/api/signed_in_devices/signed_in_devices_api.cc
|
| diff --git a/chrome/browser/extensions/api/signed_in_devices/signed_in_devices_api.cc b/chrome/browser/extensions/api/signed_in_devices/signed_in_devices_api.cc
|
| index d48cc0c4f5281811f4969f0cb9c003c6218ae7ad..02727a37e8ae1d697e3be30e0a8b2f26b6b4317f 100644
|
| --- a/chrome/browser/extensions/api/signed_in_devices/signed_in_devices_api.cc
|
| +++ b/chrome/browser/extensions/api/signed_in_devices/signed_in_devices_api.cc
|
| @@ -9,7 +9,7 @@
|
| #include "base/values.h"
|
| #include "chrome/browser/extensions/api/signed_in_devices/id_mapping_helper.h"
|
| #include "chrome/browser/profiles/profile.h"
|
| -#include "chrome/browser/sync/glue/device_info.h"
|
| +#include "chrome/browser/sync/glue/device_info_tracker.h"
|
| #include "chrome/browser/sync/glue/local_device_info_provider.h"
|
| #include "chrome/browser/sync/profile_sync_service.h"
|
| #include "chrome/browser/sync/profile_sync_service_factory.h"
|
| @@ -18,6 +18,7 @@
|
|
|
| using base::DictionaryValue;
|
| using browser_sync::DeviceInfo;
|
| +using browser_sync::DeviceInfoTracker;
|
| using browser_sync::LocalDeviceInfoProvider;
|
|
|
| namespace extensions {
|
| @@ -48,13 +49,14 @@ const base::DictionaryValue* GetIdMappingDictionary(
|
| }
|
|
|
| // Helper routine to get all signed in devices. The helper takes in
|
| -// the pointers for |ProfileSyncService| and |Extensionprefs|. This
|
| +// the pointers for |DeviceInfoTracker| and |Extensionprefs|. This
|
| // makes it easier to test by passing mock values for these pointers.
|
| ScopedVector<DeviceInfo> GetAllSignedInDevices(
|
| const std::string& extension_id,
|
| - ProfileSyncService* pss,
|
| + DeviceInfoTracker* device_tracker,
|
| ExtensionPrefs* extension_prefs) {
|
| - ScopedVector<DeviceInfo> devices = pss->GetAllSignedInDevices();
|
| + DCHECK(device_tracker);
|
| + ScopedVector<DeviceInfo> devices = device_tracker->GetAllDeviceInfo();
|
| const base::DictionaryValue* mapping_dictionary = GetIdMappingDictionary(
|
| extension_prefs,
|
| extension_id);
|
| @@ -78,14 +80,18 @@ ScopedVector<DeviceInfo> GetAllSignedInDevices(
|
| ScopedVector<DeviceInfo> GetAllSignedInDevices(
|
| const std::string& extension_id,
|
| Profile* profile) {
|
| - // Get the profile sync service and extension prefs pointers
|
| + // Get the device tracker and extension prefs pointers
|
| // and call the helper.
|
| - ProfileSyncService* pss = ProfileSyncServiceFactory::GetForProfile(profile);
|
| + DeviceInfoTracker* device_tracker =
|
| + ProfileSyncServiceFactory::GetForProfile(profile)->GetDeviceInfoTracker();
|
| + if (device_tracker == NULL) {
|
| + // Devices are not sync'ing.
|
| + return ScopedVector<DeviceInfo>().Pass();
|
| + }
|
| +
|
| ExtensionPrefs* extension_prefs = ExtensionPrefs::Get(profile);
|
|
|
| - return GetAllSignedInDevices(extension_id,
|
| - pss,
|
| - extension_prefs);
|
| + return GetAllSignedInDevices(extension_id, device_tracker, extension_prefs);
|
| }
|
|
|
| scoped_ptr<DeviceInfo> GetLocalDeviceInfo(const std::string& extension_id,
|
|
|