| 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 <string> | 8 #include <string> |
| 8 #include <utility> | 9 #include <utility> |
| 9 #include <vector> | 10 #include <vector> |
| 10 | 11 |
| 11 #include "base/lazy_instance.h" | 12 #include "base/lazy_instance.h" |
| 12 #include "base/memory/linked_ptr.h" | 13 #include "base/memory/linked_ptr.h" |
| 13 #include "base/memory/scoped_ptr.h" | |
| 14 #include "base/memory/scoped_vector.h" | 14 #include "base/memory/scoped_vector.h" |
| 15 #include "base/values.h" | 15 #include "base/values.h" |
| 16 #include "chrome/browser/extensions/api/signed_in_devices/signed_in_devices_api.
h" | 16 #include "chrome/browser/extensions/api/signed_in_devices/signed_in_devices_api.
h" |
| 17 #include "chrome/browser/extensions/extension_service.h" | 17 #include "chrome/browser/extensions/extension_service.h" |
| 18 #include "chrome/browser/profiles/profile.h" | 18 #include "chrome/browser/profiles/profile.h" |
| 19 #include "chrome/browser/sync/profile_sync_service_factory.h" | 19 #include "chrome/browser/sync/profile_sync_service_factory.h" |
| 20 #include "chrome/common/extensions/api/signed_in_devices.h" | 20 #include "chrome/common/extensions/api/signed_in_devices.h" |
| 21 #include "components/browser_sync/browser/profile_sync_service.h" | 21 #include "components/browser_sync/browser/profile_sync_service.h" |
| 22 #include "components/sync_driver/device_info.h" | 22 #include "components/sync_driver/device_info.h" |
| 23 #include "extensions/browser/event_router.h" | 23 #include "extensions/browser/event_router.h" |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 65 ScopedVector<DeviceInfo> devices = GetAllSignedInDevices(extension_id_, | 65 ScopedVector<DeviceInfo> devices = GetAllSignedInDevices(extension_id_, |
| 66 profile_); | 66 profile_); |
| 67 | 67 |
| 68 std::vector<api::signed_in_devices::DeviceInfo> args; | 68 std::vector<api::signed_in_devices::DeviceInfo> args; |
| 69 for (const DeviceInfo* info : devices) { | 69 for (const DeviceInfo* info : devices) { |
| 70 api::signed_in_devices::DeviceInfo api_device; | 70 api::signed_in_devices::DeviceInfo api_device; |
| 71 FillDeviceInfo(*info, &api_device); | 71 FillDeviceInfo(*info, &api_device); |
| 72 args.push_back(std::move(api_device)); | 72 args.push_back(std::move(api_device)); |
| 73 } | 73 } |
| 74 | 74 |
| 75 scoped_ptr<base::ListValue> result = | 75 std::unique_ptr<base::ListValue> result = |
| 76 api::signed_in_devices::OnDeviceInfoChange::Create(args); | 76 api::signed_in_devices::OnDeviceInfoChange::Create(args); |
| 77 scoped_ptr<Event> event( | 77 std::unique_ptr<Event> event( |
| 78 new Event(events::SIGNED_IN_DEVICES_ON_DEVICE_INFO_CHANGE, | 78 new Event(events::SIGNED_IN_DEVICES_ON_DEVICE_INFO_CHANGE, |
| 79 api::signed_in_devices::OnDeviceInfoChange::kEventName, | 79 api::signed_in_devices::OnDeviceInfoChange::kEventName, |
| 80 std::move(result))); | 80 std::move(result))); |
| 81 | 81 |
| 82 event->restrict_to_browser_context = profile_; | 82 event->restrict_to_browser_context = profile_; |
| 83 | 83 |
| 84 EventRouter::Get(profile_) | 84 EventRouter::Get(profile_) |
| 85 ->DispatchEventToExtension(extension_id_, std::move(event)); | 85 ->DispatchEventToExtension(extension_id_, std::move(event)); |
| 86 } | 86 } |
| 87 | 87 |
| (...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 157 } | 157 } |
| 158 | 158 |
| 159 void SignedInDevicesManager::OnExtensionUnloaded( | 159 void SignedInDevicesManager::OnExtensionUnloaded( |
| 160 content::BrowserContext* browser_context, | 160 content::BrowserContext* browser_context, |
| 161 const Extension* extension, | 161 const Extension* extension, |
| 162 UnloadedExtensionInfo::Reason reason) { | 162 UnloadedExtensionInfo::Reason reason) { |
| 163 RemoveChangeObserverForExtension(extension->id()); | 163 RemoveChangeObserverForExtension(extension->id()); |
| 164 } | 164 } |
| 165 | 165 |
| 166 } // namespace extensions | 166 } // namespace extensions |
| OLD | NEW |