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

Side by Side Diff: third_party/WebKit/Source/modules/serviceworkers/NavigationPreloadManager.cpp

Issue 2413063003: service worker: Add promise boilerplate for NavigationPreload enable/disable (Closed)
Patch Set: more boilerplate Created 4 years, 2 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 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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/serviceworkers/NavigationPreloadManager.h" 5 #include "modules/serviceworkers/NavigationPreloadManager.h"
6 6
7 #include "modules/serviceworkers/NavigationPreloadCallbacks.h"
8 #include "modules/serviceworkers/ServiceWorkerRegistration.h"
9
7 namespace blink { 10 namespace blink {
8 11
9 ScriptPromise NavigationPreloadManager::enable(ScriptState*) { 12 ScriptPromise NavigationPreloadManager::enable(ScriptState* scriptState) {
10 NOTIMPLEMENTED(); 13 ScriptPromiseResolver* resolver = ScriptPromiseResolver::create(scriptState);
11 return ScriptPromise(); 14 ScriptPromise promise = resolver->promise();
15 m_registration->webRegistration()->enableNavigationPreload(
16 new EnableNavigationPreloadCallbacks(resolver));
17 return promise;
12 } 18 }
13 19
14 ScriptPromise NavigationPreloadManager::disable(ScriptState*) { 20 ScriptPromise NavigationPreloadManager::disable(ScriptState* scriptState) {
15 NOTIMPLEMENTED(); 21 ScriptPromiseResolver* resolver = ScriptPromiseResolver::create(scriptState);
16 return ScriptPromise(); 22 ScriptPromise promise = resolver->promise();
23 m_registration->webRegistration()->disableNavigationPreload(
24 new DisableNavigationPreloadCallbacks(resolver));
25 return promise;
17 } 26 }
18 27
19 ScriptPromise NavigationPreloadManager::setHeaderValue(ScriptState*, 28 ScriptPromise NavigationPreloadManager::setHeaderValue(ScriptState*,
20 const String& value) { 29 const String& value) {
21 NOTIMPLEMENTED(); 30 NOTIMPLEMENTED();
22 return ScriptPromise(); 31 return ScriptPromise();
23 } 32 }
24 33
25 ScriptPromise NavigationPreloadManager::getState(ScriptState*) { 34 ScriptPromise NavigationPreloadManager::getState(ScriptState*) {
26 NOTIMPLEMENTED(); 35 NOTIMPLEMENTED();
27 return ScriptPromise(); 36 return ScriptPromise();
28 } 37 }
29 38
30 NavigationPreloadManager::NavigationPreloadManager() {} 39 NavigationPreloadManager::NavigationPreloadManager(
40 ServiceWorkerRegistration* registration)
41 : m_registration(registration) {}
42
43 DEFINE_TRACE(NavigationPreloadManager) {
44 visitor->trace(m_registration);
45 }
31 46
32 } // namespace blink 47 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698