OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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/child/background_sync/background_sync_provider.h" | 5 #include "content/child/background_sync/background_sync_provider.h" |
6 | 6 |
7 #include <stddef.h> | 7 #include <stddef.h> |
8 #include <utility> | 8 #include <utility> |
9 | 9 |
10 #include "base/bind.h" | 10 #include "base/bind.h" |
(...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
131 scoped_ptr<blink::WebSyncRegistrationCallbacks> callbacks, | 131 scoped_ptr<blink::WebSyncRegistrationCallbacks> callbacks, |
132 mojom::BackgroundSyncError error, | 132 mojom::BackgroundSyncError error, |
133 const mojom::SyncRegistrationPtr& options) { | 133 const mojom::SyncRegistrationPtr& options) { |
134 // TODO(iclelland): Determine the correct error message to return in each case | 134 // TODO(iclelland): Determine the correct error message to return in each case |
135 scoped_ptr<blink::WebSyncRegistration> result; | 135 scoped_ptr<blink::WebSyncRegistration> result; |
136 switch (error) { | 136 switch (error) { |
137 case mojom::BackgroundSyncError::NONE: | 137 case mojom::BackgroundSyncError::NONE: |
138 if (!options.is_null()) | 138 if (!options.is_null()) |
139 result = | 139 result = |
140 mojo::ConvertTo<scoped_ptr<blink::WebSyncRegistration>>(options); | 140 mojo::ConvertTo<scoped_ptr<blink::WebSyncRegistration>>(options); |
141 callbacks->onSuccess(blink::adoptWebPtr(result.release())); | 141 callbacks->onSuccess(std::move(result)); |
142 break; | 142 break; |
143 case mojom::BackgroundSyncError::NOT_FOUND: | 143 case mojom::BackgroundSyncError::NOT_FOUND: |
144 NOTREACHED(); | 144 NOTREACHED(); |
145 break; | 145 break; |
146 case mojom::BackgroundSyncError::STORAGE: | 146 case mojom::BackgroundSyncError::STORAGE: |
147 callbacks->onError( | 147 callbacks->onError( |
148 blink::WebSyncError(blink::WebSyncError::ErrorTypeUnknown, | 148 blink::WebSyncError(blink::WebSyncError::ErrorTypeUnknown, |
149 "Background Sync is disabled.")); | 149 "Background Sync is disabled.")); |
150 break; | 150 break; |
151 case mojom::BackgroundSyncError::NOT_ALLOWED: | 151 case mojom::BackgroundSyncError::NOT_ALLOWED: |
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
210 mojo::InterfaceRequest<mojom::BackgroundSyncService> request = | 210 mojo::InterfaceRequest<mojom::BackgroundSyncService> request = |
211 mojo::GetProxy(&background_sync_service_); | 211 mojo::GetProxy(&background_sync_service_); |
212 main_thread_task_runner_->PostTask( | 212 main_thread_task_runner_->PostTask( |
213 FROM_HERE, | 213 FROM_HERE, |
214 base::Bind(&ConnectToServiceOnMainThread, base::Passed(&request))); | 214 base::Bind(&ConnectToServiceOnMainThread, base::Passed(&request))); |
215 } | 215 } |
216 return background_sync_service_; | 216 return background_sync_service_; |
217 } | 217 } |
218 | 218 |
219 } // namespace content | 219 } // namespace content |
OLD | NEW |