| 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 <memory> | 7 #include <memory> |
| 8 #include <string> | 8 #include <string> |
| 9 #include <utility> | 9 #include <utility> |
| 10 #include <vector> | 10 #include <vector> |
| (...skipping 25 matching lines...) Expand all Loading... |
| 36 api_device_info->type = api::signed_in_devices::ParseDeviceType( | 36 api_device_info->type = api::signed_in_devices::ParseDeviceType( |
| 37 device_info.GetDeviceTypeString()); | 37 device_info.GetDeviceTypeString()); |
| 38 api_device_info->chrome_version = device_info.chrome_version(); | 38 api_device_info->chrome_version = device_info.chrome_version(); |
| 39 } | 39 } |
| 40 } // namespace | 40 } // namespace |
| 41 | 41 |
| 42 SignedInDevicesChangeObserver::SignedInDevicesChangeObserver( | 42 SignedInDevicesChangeObserver::SignedInDevicesChangeObserver( |
| 43 const std::string& extension_id, | 43 const std::string& extension_id, |
| 44 Profile* profile) : extension_id_(extension_id), | 44 Profile* profile) : extension_id_(extension_id), |
| 45 profile_(profile) { | 45 profile_(profile) { |
| 46 ProfileSyncService* pss = ProfileSyncServiceFactory::GetForProfile(profile_); | 46 browser_sync::ProfileSyncService* pss = |
| 47 ProfileSyncServiceFactory::GetForProfile(profile_); |
| 47 if (pss) { | 48 if (pss) { |
| 48 DCHECK(pss->GetDeviceInfoTracker()); | 49 DCHECK(pss->GetDeviceInfoTracker()); |
| 49 pss->GetDeviceInfoTracker()->AddObserver(this); | 50 pss->GetDeviceInfoTracker()->AddObserver(this); |
| 50 } | 51 } |
| 51 } | 52 } |
| 52 | 53 |
| 53 SignedInDevicesChangeObserver::~SignedInDevicesChangeObserver() { | 54 SignedInDevicesChangeObserver::~SignedInDevicesChangeObserver() { |
| 54 ProfileSyncService* pss = ProfileSyncServiceFactory::GetForProfile(profile_); | 55 browser_sync::ProfileSyncService* pss = |
| 56 ProfileSyncServiceFactory::GetForProfile(profile_); |
| 55 if (pss) { | 57 if (pss) { |
| 56 DCHECK(pss->GetDeviceInfoTracker()); | 58 DCHECK(pss->GetDeviceInfoTracker()); |
| 57 pss->GetDeviceInfoTracker()->RemoveObserver(this); | 59 pss->GetDeviceInfoTracker()->RemoveObserver(this); |
| 58 } | 60 } |
| 59 } | 61 } |
| 60 | 62 |
| 61 void SignedInDevicesChangeObserver::OnDeviceInfoChange() { | 63 void SignedInDevicesChangeObserver::OnDeviceInfoChange() { |
| 62 // There is a change in the list of devices. Get all devices and send them to | 64 // There is a change in the list of devices. Get all devices and send them to |
| 63 // the listener. | 65 // the listener. |
| 64 std::vector<std::unique_ptr<DeviceInfo>> devices = | 66 std::vector<std::unique_ptr<DeviceInfo>> devices = |
| (...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 152 } | 154 } |
| 153 | 155 |
| 154 void SignedInDevicesManager::OnExtensionUnloaded( | 156 void SignedInDevicesManager::OnExtensionUnloaded( |
| 155 content::BrowserContext* browser_context, | 157 content::BrowserContext* browser_context, |
| 156 const Extension* extension, | 158 const Extension* extension, |
| 157 UnloadedExtensionInfo::Reason reason) { | 159 UnloadedExtensionInfo::Reason reason) { |
| 158 RemoveChangeObserverForExtension(extension->id()); | 160 RemoveChangeObserverForExtension(extension->id()); |
| 159 } | 161 } |
| 160 | 162 |
| 161 } // namespace extensions | 163 } // namespace extensions |
| OLD | NEW |