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

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

Issue 1549233002: Convert Pass()→std::move() in //chrome/browser/extensions (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase Created 4 years, 12 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 (c) 2013 The Chromium Authors. All rights reserved. 1 // Copyright (c) 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_api. h" 5 #include "chrome/browser/extensions/api/signed_in_devices/signed_in_devices_api. h"
6 6
7 #include "base/memory/scoped_ptr.h" 7 #include "base/memory/scoped_ptr.h"
8 #include "base/memory/scoped_vector.h" 8 #include "base/memory/scoped_vector.h"
9 #include "base/values.h" 9 #include "base/values.h"
10 #include "chrome/browser/extensions/api/signed_in_devices/id_mapping_helper.h" 10 #include "chrome/browser/extensions/api/signed_in_devices/id_mapping_helper.h"
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
67 scoped_ptr<base::DictionaryValue> editable_mapping_dictionary( 67 scoped_ptr<base::DictionaryValue> editable_mapping_dictionary(
68 mapping_dictionary->DeepCopy()); 68 mapping_dictionary->DeepCopy());
69 69
70 CreateMappingForUnmappedDevices(&(devices.get()), 70 CreateMappingForUnmappedDevices(&(devices.get()),
71 editable_mapping_dictionary.get()); 71 editable_mapping_dictionary.get());
72 72
73 // Write into |ExtensionPrefs| which will get persisted in disk. 73 // Write into |ExtensionPrefs| which will get persisted in disk.
74 extension_prefs->UpdateExtensionPref(extension_id, 74 extension_prefs->UpdateExtensionPref(extension_id,
75 kPrefStringForIdMapping, 75 kPrefStringForIdMapping,
76 editable_mapping_dictionary.release()); 76 editable_mapping_dictionary.release());
77 return devices.Pass(); 77 return devices;
78 } 78 }
79 79
80 ScopedVector<DeviceInfo> GetAllSignedInDevices( 80 ScopedVector<DeviceInfo> GetAllSignedInDevices(
81 const std::string& extension_id, 81 const std::string& extension_id,
82 Profile* profile) { 82 Profile* profile) {
83 // Get the device tracker and extension prefs pointers 83 // Get the device tracker and extension prefs pointers
84 // and call the helper. 84 // and call the helper.
85 DeviceInfoTracker* device_tracker = 85 DeviceInfoTracker* device_tracker =
86 ProfileSyncServiceFactory::GetForProfile(profile)->GetDeviceInfoTracker(); 86 ProfileSyncServiceFactory::GetForProfile(profile)->GetDeviceInfoTracker();
87 DCHECK(device_tracker); 87 DCHECK(device_tracker);
88 if (!device_tracker->IsSyncing()) { 88 if (!device_tracker->IsSyncing()) {
89 // Devices are not sync'ing. 89 // Devices are not sync'ing.
90 return ScopedVector<DeviceInfo>().Pass(); 90 return ScopedVector<DeviceInfo>();
91 } 91 }
92 92
93 ExtensionPrefs* extension_prefs = ExtensionPrefs::Get(profile); 93 ExtensionPrefs* extension_prefs = ExtensionPrefs::Get(profile);
94 94
95 return GetAllSignedInDevices(extension_id, device_tracker, extension_prefs); 95 return GetAllSignedInDevices(extension_id, device_tracker, extension_prefs);
96 } 96 }
97 97
98 scoped_ptr<DeviceInfo> GetLocalDeviceInfo(const std::string& extension_id, 98 scoped_ptr<DeviceInfo> GetLocalDeviceInfo(const std::string& extension_id,
99 Profile* profile) { 99 Profile* profile) {
100 ProfileSyncService* pss = ProfileSyncServiceFactory::GetForProfile(profile); 100 ProfileSyncService* pss = ProfileSyncServiceFactory::GetForProfile(profile);
101 if (!pss) { 101 if (!pss) {
102 return scoped_ptr<DeviceInfo>(); 102 return scoped_ptr<DeviceInfo>();
103 } 103 }
104 104
105 LocalDeviceInfoProvider* local_device = pss->GetLocalDeviceInfoProvider(); 105 LocalDeviceInfoProvider* local_device = pss->GetLocalDeviceInfoProvider();
106 DCHECK(local_device); 106 DCHECK(local_device);
107 std::string guid = local_device->GetLocalSyncCacheGUID(); 107 std::string guid = local_device->GetLocalSyncCacheGUID();
108 scoped_ptr<DeviceInfo> device = GetDeviceInfoForClientId(guid, 108 scoped_ptr<DeviceInfo> device = GetDeviceInfoForClientId(guid,
109 extension_id, 109 extension_id,
110 profile); 110 profile);
111 return device.Pass(); 111 return device;
112 } 112 }
113 113
114 bool SignedInDevicesGetFunction::RunSync() { 114 bool SignedInDevicesGetFunction::RunSync() {
115 scoped_ptr<api::signed_in_devices::Get::Params> params( 115 scoped_ptr<api::signed_in_devices::Get::Params> params(
116 api::signed_in_devices::Get::Params::Create(*args_)); 116 api::signed_in_devices::Get::Params::Create(*args_));
117 EXTENSION_FUNCTION_VALIDATE(params.get()); 117 EXTENSION_FUNCTION_VALIDATE(params.get());
118 118
119 bool is_local = params->is_local.get() ? *params->is_local : false; 119 bool is_local = params->is_local.get() ? *params->is_local : false;
120 120
121 if (is_local) { 121 if (is_local) {
(...skipping 17 matching lines...) Expand all
139 ++it) { 139 ++it) {
140 result->Append((*it)->ToValue()); 140 result->Append((*it)->ToValue());
141 } 141 }
142 142
143 SetResult(result.release()); 143 SetResult(result.release());
144 return true; 144 return true;
145 } 145 }
146 146
147 } // namespace extensions 147 } // namespace extensions
148 148
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698