OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 "content/browser/service_worker/service_worker_internals_ui.h" | 5 #include "content/browser/service_worker/service_worker_internals_ui.h" |
6 | 6 |
7 #include <stdint.h> | 7 #include <stdint.h> |
8 | 8 |
9 #include <memory> | 9 #include <memory> |
10 #include <string> | 10 #include <string> |
(...skipping 176 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
187 it != registrations.end(); | 187 it != registrations.end(); |
188 ++it) { | 188 ++it) { |
189 const ServiceWorkerRegistrationInfo& registration = *it; | 189 const ServiceWorkerRegistrationInfo& registration = *it; |
190 auto registration_info = base::MakeUnique<DictionaryValue>(); | 190 auto registration_info = base::MakeUnique<DictionaryValue>(); |
191 registration_info->SetString("scope", registration.pattern.spec()); | 191 registration_info->SetString("scope", registration.pattern.spec()); |
192 registration_info->SetString( | 192 registration_info->SetString( |
193 "registration_id", base::Int64ToString(registration.registration_id)); | 193 "registration_id", base::Int64ToString(registration.registration_id)); |
194 | 194 |
195 if (registration.active_version.version_id != | 195 if (registration.active_version.version_id != |
196 kInvalidServiceWorkerVersionId) { | 196 kInvalidServiceWorkerVersionId) { |
197 DictionaryValue* active_info = new DictionaryValue(); | 197 auto active_info = base::MakeUnique<DictionaryValue>(); |
198 UpdateVersionInfo(registration.active_version, active_info); | 198 UpdateVersionInfo(registration.active_version, active_info.get()); |
199 registration_info->Set("active", active_info); | 199 registration_info->Set("active", std::move(active_info)); |
200 } | 200 } |
201 | 201 |
202 if (registration.waiting_version.version_id != | 202 if (registration.waiting_version.version_id != |
203 kInvalidServiceWorkerVersionId) { | 203 kInvalidServiceWorkerVersionId) { |
204 DictionaryValue* waiting_info = new DictionaryValue(); | 204 auto waiting_info = base::MakeUnique<DictionaryValue>(); |
205 UpdateVersionInfo(registration.waiting_version, waiting_info); | 205 UpdateVersionInfo(registration.waiting_version, waiting_info.get()); |
206 registration_info->Set("waiting", waiting_info); | 206 registration_info->Set("waiting", std::move(waiting_info)); |
207 } | 207 } |
208 | 208 |
209 result->Append(std::move(registration_info)); | 209 result->Append(std::move(registration_info)); |
210 } | 210 } |
211 return result; | 211 return result; |
212 } | 212 } |
213 | 213 |
214 std::unique_ptr<ListValue> GetVersionListValue( | 214 std::unique_ptr<ListValue> GetVersionListValue( |
215 const std::vector<ServiceWorkerVersionInfo>& versions) { | 215 const std::vector<ServiceWorkerVersionInfo>& versions) { |
216 auto result = base::MakeUnique<ListValue>(); | 216 auto result = base::MakeUnique<ListValue>(); |
(...skipping 393 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
610 callback.Run(SERVICE_WORKER_ERROR_ABORT); | 610 callback.Run(SERVICE_WORKER_ERROR_ABORT); |
611 return; | 611 return; |
612 } | 612 } |
613 | 613 |
614 // ServiceWorkerContextWrapper::UnregisterServiceWorker doesn't work here | 614 // ServiceWorkerContextWrapper::UnregisterServiceWorker doesn't work here |
615 // because that reduces a status code to boolean. | 615 // because that reduces a status code to boolean. |
616 context->context()->UnregisterServiceWorker(scope, callback); | 616 context->context()->UnregisterServiceWorker(scope, callback); |
617 } | 617 } |
618 | 618 |
619 } // namespace content | 619 } // namespace content |
OLD | NEW |