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

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: 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*) {
15 NOTIMPLEMENTED(); 21 NOTIMPLEMENTED();
16 return ScriptPromise(); 22 return ScriptPromise();
17 } 23 }
18 24
19 ScriptPromise NavigationPreloadManager::setHeaderValue(ScriptState*, 25 ScriptPromise NavigationPreloadManager::setHeaderValue(ScriptState*,
20 const String& value) { 26 const String& value) {
21 NOTIMPLEMENTED(); 27 NOTIMPLEMENTED();
22 return ScriptPromise(); 28 return ScriptPromise();
23 } 29 }
24 30
25 ScriptPromise NavigationPreloadManager::getState(ScriptState*) { 31 ScriptPromise NavigationPreloadManager::getState(ScriptState*) {
26 NOTIMPLEMENTED(); 32 NOTIMPLEMENTED();
27 return ScriptPromise(); 33 return ScriptPromise();
28 } 34 }
29 35
30 NavigationPreloadManager::NavigationPreloadManager() {} 36 NavigationPreloadManager::NavigationPreloadManager(
37 ServiceWorkerRegistration* registration)
38 : m_registration(registration) {}
39
40 DEFINE_TRACE(NavigationPreloadManager) {
41 visitor->trace(m_registration);
42 }
31 43
32 } // namespace blink 44 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698