OLD | NEW |
1 // Copyright 2017 The Chromium Authors. All rights reserved. | 1 // Copyright 2017 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 "modules/background_fetch/BackgroundFetchBridge.h" | 5 #include "modules/background_fetch/BackgroundFetchBridge.h" |
6 | 6 |
7 #include <utility> | 7 #include <utility> |
8 #include "modules/background_fetch/BackgroundFetchOptions.h" | 8 #include "modules/background_fetch/BackgroundFetchOptions.h" |
9 #include "modules/background_fetch/BackgroundFetchRegistration.h" | 9 #include "modules/background_fetch/BackgroundFetchRegistration.h" |
10 #include "modules/background_fetch/BackgroundFetchTypeConverters.h" | 10 #include "modules/background_fetch/BackgroundFetchTypeConverters.h" |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
43 ServiceWorkerRegistration& registration) | 43 ServiceWorkerRegistration& registration) |
44 : Supplement<ServiceWorkerRegistration>(registration) {} | 44 : Supplement<ServiceWorkerRegistration>(registration) {} |
45 | 45 |
46 BackgroundFetchBridge::~BackgroundFetchBridge() = default; | 46 BackgroundFetchBridge::~BackgroundFetchBridge() = default; |
47 | 47 |
48 void BackgroundFetchBridge::fetch( | 48 void BackgroundFetchBridge::fetch( |
49 const String& tag, | 49 const String& tag, |
50 Vector<WebServiceWorkerRequest> requests, | 50 Vector<WebServiceWorkerRequest> requests, |
51 const BackgroundFetchOptions& options, | 51 const BackgroundFetchOptions& options, |
52 std::unique_ptr<RegistrationCallback> callback) { | 52 std::unique_ptr<RegistrationCallback> callback) { |
53 // TODO(peter): Include |requests| in the Mojo call. | |
54 getService()->Fetch( | 53 getService()->Fetch( |
55 supplementable()->webRegistration()->registrationId(), | 54 supplementable()->webRegistration()->registrationId(), |
56 getSecurityOrigin(), tag, | 55 getSecurityOrigin(), tag, std::move(requests), |
57 mojom::blink::BackgroundFetchOptions::From(options), | 56 mojom::blink::BackgroundFetchOptions::From(options), |
58 convertToBaseCallback( | 57 convertToBaseCallback( |
59 WTF::bind(&BackgroundFetchBridge::didGetRegistration, | 58 WTF::bind(&BackgroundFetchBridge::didGetRegistration, |
60 wrapPersistent(this), WTF::passed(std::move(callback))))); | 59 wrapPersistent(this), WTF::passed(std::move(callback))))); |
61 } | 60 } |
62 | 61 |
63 void BackgroundFetchBridge::abort(const String& tag, | 62 void BackgroundFetchBridge::abort(const String& tag, |
64 std::unique_ptr<AbortCallback> callback) { | 63 std::unique_ptr<AbortCallback> callback) { |
65 getService()->Abort(supplementable()->webRegistration()->registrationId(), | 64 getService()->Abort(supplementable()->webRegistration()->registrationId(), |
66 getSecurityOrigin(), tag, | 65 getSecurityOrigin(), tag, |
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
114 | 113 |
115 mojom::blink::BackgroundFetchServicePtr& BackgroundFetchBridge::getService() { | 114 mojom::blink::BackgroundFetchServicePtr& BackgroundFetchBridge::getService() { |
116 if (!m_backgroundFetchService) { | 115 if (!m_backgroundFetchService) { |
117 Platform::current()->interfaceProvider()->getInterface( | 116 Platform::current()->interfaceProvider()->getInterface( |
118 mojo::MakeRequest(&m_backgroundFetchService)); | 117 mojo::MakeRequest(&m_backgroundFetchService)); |
119 } | 118 } |
120 return m_backgroundFetchService; | 119 return m_backgroundFetchService; |
121 } | 120 } |
122 | 121 |
123 } // namespace blink | 122 } // namespace blink |
OLD | NEW |