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 <utility> |
8 #include <vector> | 9 #include <vector> |
9 | 10 |
10 #include "base/lazy_instance.h" | 11 #include "base/lazy_instance.h" |
11 #include "base/memory/linked_ptr.h" | 12 #include "base/memory/linked_ptr.h" |
12 #include "base/memory/scoped_ptr.h" | 13 #include "base/memory/scoped_ptr.h" |
13 #include "base/memory/scoped_vector.h" | 14 #include "base/memory/scoped_vector.h" |
14 #include "base/values.h" | 15 #include "base/values.h" |
15 #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" |
16 #include "chrome/browser/extensions/extension_service.h" | 17 #include "chrome/browser/extensions/extension_service.h" |
17 #include "chrome/browser/profiles/profile.h" | 18 #include "chrome/browser/profiles/profile.h" |
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
70 it != devices.end(); | 71 it != devices.end(); |
71 ++it) { | 72 ++it) { |
72 linked_ptr<api::signed_in_devices::DeviceInfo> api_device = | 73 linked_ptr<api::signed_in_devices::DeviceInfo> api_device = |
73 make_linked_ptr(new api::signed_in_devices::DeviceInfo); | 74 make_linked_ptr(new api::signed_in_devices::DeviceInfo); |
74 FillDeviceInfo(*(*it), api_device.get()); | 75 FillDeviceInfo(*(*it), api_device.get()); |
75 args.push_back(api_device); | 76 args.push_back(api_device); |
76 } | 77 } |
77 | 78 |
78 scoped_ptr<base::ListValue> result = | 79 scoped_ptr<base::ListValue> result = |
79 api::signed_in_devices::OnDeviceInfoChange::Create(args); | 80 api::signed_in_devices::OnDeviceInfoChange::Create(args); |
80 scoped_ptr<Event> event(new Event( | 81 scoped_ptr<Event> event( |
81 events::SIGNED_IN_DEVICES_ON_DEVICE_INFO_CHANGE, | 82 new Event(events::SIGNED_IN_DEVICES_ON_DEVICE_INFO_CHANGE, |
82 api::signed_in_devices::OnDeviceInfoChange::kEventName, result.Pass())); | 83 api::signed_in_devices::OnDeviceInfoChange::kEventName, |
| 84 std::move(result))); |
83 | 85 |
84 event->restrict_to_browser_context = profile_; | 86 event->restrict_to_browser_context = profile_; |
85 | 87 |
86 EventRouter::Get(profile_)->DispatchEventToExtension( | 88 EventRouter::Get(profile_) |
87 extension_id_, event.Pass()); | 89 ->DispatchEventToExtension(extension_id_, std::move(event)); |
88 } | 90 } |
89 | 91 |
90 static base::LazyInstance< | 92 static base::LazyInstance< |
91 BrowserContextKeyedAPIFactory<SignedInDevicesManager> > g_factory = | 93 BrowserContextKeyedAPIFactory<SignedInDevicesManager> > g_factory = |
92 LAZY_INSTANCE_INITIALIZER; | 94 LAZY_INSTANCE_INITIALIZER; |
93 | 95 |
94 // static | 96 // static |
95 BrowserContextKeyedAPIFactory<SignedInDevicesManager>* | 97 BrowserContextKeyedAPIFactory<SignedInDevicesManager>* |
96 SignedInDevicesManager::GetFactoryInstance() { | 98 SignedInDevicesManager::GetFactoryInstance() { |
97 return g_factory.Pointer(); | 99 return g_factory.Pointer(); |
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
159 } | 161 } |
160 | 162 |
161 void SignedInDevicesManager::OnExtensionUnloaded( | 163 void SignedInDevicesManager::OnExtensionUnloaded( |
162 content::BrowserContext* browser_context, | 164 content::BrowserContext* browser_context, |
163 const Extension* extension, | 165 const Extension* extension, |
164 UnloadedExtensionInfo::Reason reason) { | 166 UnloadedExtensionInfo::Reason reason) { |
165 RemoveChangeObserverForExtension(extension->id()); | 167 RemoveChangeObserverForExtension(extension->id()); |
166 } | 168 } |
167 | 169 |
168 } // namespace extensions | 170 } // namespace extensions |
OLD | NEW |