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

Side by Side Diff: third_party/WebKit/Source/modules/push_messaging/PushManager.cpp

Issue 2392543004: Reflow comments in the Push and Notification modules. (Closed)
Patch Set: Reflow comments in the Push and Notification modules. 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 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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/push_messaging/PushManager.h" 5 #include "modules/push_messaging/PushManager.h"
6 6
7 #include "bindings/core/v8/ScriptPromise.h" 7 #include "bindings/core/v8/ScriptPromise.h"
8 #include "bindings/core/v8/ScriptPromiseResolver.h" 8 #include "bindings/core/v8/ScriptPromiseResolver.h"
9 #include "bindings/core/v8/ScriptState.h" 9 #include "bindings/core/v8/ScriptState.h"
10 #include "core/dom/DOMException.h" 10 #include "core/dom/DOMException.h"
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
52 "Subscription failed - no active Service Worker")); 52 "Subscription failed - no active Service Worker"));
53 53
54 const WebPushSubscriptionOptions& webOptions = 54 const WebPushSubscriptionOptions& webOptions =
55 PushSubscriptionOptions::toWeb(options, exceptionState); 55 PushSubscriptionOptions::toWeb(options, exceptionState);
56 if (exceptionState.hadException()) 56 if (exceptionState.hadException())
57 return ScriptPromise(); 57 return ScriptPromise();
58 58
59 ScriptPromiseResolver* resolver = ScriptPromiseResolver::create(scriptState); 59 ScriptPromiseResolver* resolver = ScriptPromiseResolver::create(scriptState);
60 ScriptPromise promise = resolver->promise(); 60 ScriptPromise promise = resolver->promise();
61 61
62 // The document context is the only reasonable context from which to ask the u ser for permission 62 // The document context is the only reasonable context from which to ask the
63 // to use the Push API. The embedder should persist the permission so that lat er calls in 63 // user for permission to use the Push API. The embedder should persist the
64 // different contexts can succeed. 64 // permission so that later calls in different contexts can succeed.
65 if (scriptState->getExecutionContext()->isDocument()) { 65 if (scriptState->getExecutionContext()->isDocument()) {
66 Document* document = toDocument(scriptState->getExecutionContext()); 66 Document* document = toDocument(scriptState->getExecutionContext());
67 if (!document->domWindow() || !document->frame()) 67 if (!document->domWindow() || !document->frame())
68 return ScriptPromise::rejectWithDOMException( 68 return ScriptPromise::rejectWithDOMException(
69 scriptState, 69 scriptState,
70 DOMException::create(InvalidStateError, 70 DOMException::create(InvalidStateError,
71 "Document is detached from window.")); 71 "Document is detached from window."));
72 PushController::clientFrom(document->frame()) 72 PushController::clientFrom(document->frame())
73 .subscribe(m_registration->webRegistration(), webOptions, 73 .subscribe(m_registration->webRegistration(), webOptions,
74 new PushSubscriptionCallbacks(resolver, m_registration)); 74 new PushSubscriptionCallbacks(resolver, m_registration));
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
112 PushSubscriptionOptions::toWeb(options, exceptionState), 112 PushSubscriptionOptions::toWeb(options, exceptionState),
113 new PushPermissionStatusCallbacks(resolver)); 113 new PushPermissionStatusCallbacks(resolver));
114 return promise; 114 return promise;
115 } 115 }
116 116
117 DEFINE_TRACE(PushManager) { 117 DEFINE_TRACE(PushManager) {
118 visitor->trace(m_registration); 118 visitor->trace(m_registration);
119 } 119 }
120 120
121 } // namespace blink 121 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698