Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(140)

Side by Side Diff: chrome/browser/extensions/api/signed_in_devices/signed_in_devices_manager.cc

Issue 1827083005: [Extensions] Convert APIs to use movable types [9] (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 <utility>
9 #include <vector> 9 #include <vector>
10 10
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
58 pss->GetDeviceInfoTracker()->RemoveObserver(this); 58 pss->GetDeviceInfoTracker()->RemoveObserver(this);
59 } 59 }
60 } 60 }
61 61
62 void SignedInDevicesChangeObserver::OnDeviceInfoChange() { 62 void SignedInDevicesChangeObserver::OnDeviceInfoChange() {
63 // There is a change in the list of devices. Get all devices and send them to 63 // There is a change in the list of devices. Get all devices and send them to
64 // the listener. 64 // the listener.
65 ScopedVector<DeviceInfo> devices = GetAllSignedInDevices(extension_id_, 65 ScopedVector<DeviceInfo> devices = GetAllSignedInDevices(extension_id_,
66 profile_); 66 profile_);
67 67
68 std::vector<linked_ptr<api::signed_in_devices::DeviceInfo> > args; 68 std::vector<api::signed_in_devices::DeviceInfo> args;
69 69 for (const DeviceInfo* info : devices) {
70 for (ScopedVector<DeviceInfo>::const_iterator it = devices.begin(); 70 api::signed_in_devices::DeviceInfo api_device;
71 it != devices.end(); 71 FillDeviceInfo(*info, &api_device);
72 ++it) { 72 args.push_back(std::move(api_device));
73 linked_ptr<api::signed_in_devices::DeviceInfo> api_device =
74 make_linked_ptr(new api::signed_in_devices::DeviceInfo);
75 FillDeviceInfo(*(*it), api_device.get());
76 args.push_back(api_device);
77 } 73 }
78 74
79 scoped_ptr<base::ListValue> result = 75 scoped_ptr<base::ListValue> result =
80 api::signed_in_devices::OnDeviceInfoChange::Create(args); 76 api::signed_in_devices::OnDeviceInfoChange::Create(args);
81 scoped_ptr<Event> event( 77 scoped_ptr<Event> event(
82 new Event(events::SIGNED_IN_DEVICES_ON_DEVICE_INFO_CHANGE, 78 new Event(events::SIGNED_IN_DEVICES_ON_DEVICE_INFO_CHANGE,
83 api::signed_in_devices::OnDeviceInfoChange::kEventName, 79 api::signed_in_devices::OnDeviceInfoChange::kEventName,
84 std::move(result))); 80 std::move(result)));
85 81
86 event->restrict_to_browser_context = profile_; 82 event->restrict_to_browser_context = profile_;
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after
161 } 157 }
162 158
163 void SignedInDevicesManager::OnExtensionUnloaded( 159 void SignedInDevicesManager::OnExtensionUnloaded(
164 content::BrowserContext* browser_context, 160 content::BrowserContext* browser_context,
165 const Extension* extension, 161 const Extension* extension,
166 UnloadedExtensionInfo::Reason reason) { 162 UnloadedExtensionInfo::Reason reason) {
167 RemoveChangeObserverForExtension(extension->id()); 163 RemoveChangeObserverForExtension(extension->id());
168 } 164 }
169 165
170 } // namespace extensions 166 } // namespace extensions
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698