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

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

Issue 2701993002: DO NOT COMMIT: Results of running new (proposed) clang-format on Blink (Closed)
Patch Set: Created 3 years, 10 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 "bindings/core/v8/CallbackPromiseAdapter.h" 7 #include "bindings/core/v8/CallbackPromiseAdapter.h"
8 #include "core/dom/DOMException.h" 8 #include "core/dom/DOMException.h"
9 #include "modules/serviceworkers/NavigationPreloadCallbacks.h" 9 #include "modules/serviceworkers/NavigationPreloadCallbacks.h"
10 #include "modules/serviceworkers/ServiceWorkerContainerClient.h" 10 #include "modules/serviceworkers/ServiceWorkerContainerClient.h"
(...skipping 14 matching lines...) Expand all
25 const String& value) { 25 const String& value) {
26 ServiceWorkerContainerClient* client = 26 ServiceWorkerContainerClient* client =
27 ServiceWorkerContainerClient::from(m_registration->getExecutionContext()); 27 ServiceWorkerContainerClient::from(m_registration->getExecutionContext());
28 if (!client || !client->provider()) { 28 if (!client || !client->provider()) {
29 return ScriptPromise::rejectWithDOMException( 29 return ScriptPromise::rejectWithDOMException(
30 scriptState, DOMException::create(InvalidStateError, "No provider.")); 30 scriptState, DOMException::create(InvalidStateError, "No provider."));
31 } 31 }
32 32
33 if (!isValidHTTPHeaderValue(value)) { 33 if (!isValidHTTPHeaderValue(value)) {
34 return ScriptPromise::reject( 34 return ScriptPromise::reject(
35 scriptState, V8ThrowException::createTypeError( 35 scriptState,
36 scriptState->isolate(), 36 V8ThrowException::createTypeError(
37 "The string provided to setHeaderValue ('" + value + 37 scriptState->isolate(),
38 "') is not a valid HTTP header field value.")); 38 "The string provided to setHeaderValue ('" + value +
39 "') is not a valid HTTP header field value."));
39 } 40 }
40 41
41 ScriptPromiseResolver* resolver = ScriptPromiseResolver::create(scriptState); 42 ScriptPromiseResolver* resolver = ScriptPromiseResolver::create(scriptState);
42 ScriptPromise promise = resolver->promise(); 43 ScriptPromise promise = resolver->promise();
43 m_registration->webRegistration()->setNavigationPreloadHeader( 44 m_registration->webRegistration()->setNavigationPreloadHeader(
44 value, client->provider(), 45 value, client->provider(),
45 WTF::makeUnique<SetNavigationPreloadHeaderCallbacks>(resolver)); 46 WTF::makeUnique<SetNavigationPreloadHeaderCallbacks>(resolver));
46 return promise; 47 return promise;
47 } 48 }
48 49
(...skipping 30 matching lines...) Expand all
79 enable, client->provider(), 80 enable, client->provider(),
80 WTF::makeUnique<EnableNavigationPreloadCallbacks>(resolver)); 81 WTF::makeUnique<EnableNavigationPreloadCallbacks>(resolver));
81 return promise; 82 return promise;
82 } 83 }
83 84
84 DEFINE_TRACE(NavigationPreloadManager) { 85 DEFINE_TRACE(NavigationPreloadManager) {
85 visitor->trace(m_registration); 86 visitor->trace(m_registration);
86 } 87 }
87 88
88 } // namespace blink 89 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698