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

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

Issue 1083193006: Rename hasPermission to permissionState. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: re-add hasPermission to the expectations file Created 5 years, 8 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 "config.h" 5 #include "config.h"
6 #include "modules/push_messaging/PushManager.h" 6 #include "modules/push_messaging/PushManager.h"
7 7
8 #include "bindings/core/v8/CallbackPromiseAdapter.h" 8 #include "bindings/core/v8/CallbackPromiseAdapter.h"
9 #include "bindings/core/v8/ScriptPromise.h" 9 #include "bindings/core/v8/ScriptPromise.h"
10 #include "bindings/core/v8/ScriptPromiseResolver.h" 10 #include "bindings/core/v8/ScriptPromiseResolver.h"
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
68 68
69 ScriptPromise PushManager::getSubscription(ScriptState* scriptState) 69 ScriptPromise PushManager::getSubscription(ScriptState* scriptState)
70 { 70 {
71 RefPtrWillBeRawPtr<ScriptPromiseResolver> resolver = ScriptPromiseResolver:: create(scriptState); 71 RefPtrWillBeRawPtr<ScriptPromiseResolver> resolver = ScriptPromiseResolver:: create(scriptState);
72 ScriptPromise promise = resolver->promise(); 72 ScriptPromise promise = resolver->promise();
73 73
74 pushProvider()->getRegistration(m_registration->webRegistration(), new PushS ubscriptionCallbacks(resolver, m_registration)); 74 pushProvider()->getRegistration(m_registration->webRegistration(), new PushS ubscriptionCallbacks(resolver, m_registration));
75 return promise; 75 return promise;
76 } 76 }
77 77
78 ScriptPromise PushManager::hasPermission(ScriptState* scriptState) 78 ScriptPromise PushManager::permissionState(ScriptState* scriptState)
79 { 79 {
80 if (scriptState->executionContext()->isDocument()) { 80 if (scriptState->executionContext()->isDocument()) {
81 Document* document = toDocument(scriptState->executionContext()); 81 Document* document = toDocument(scriptState->executionContext());
82 // FIXME: add test coverage for this condition - https://crbug.com/44043 1 82 // FIXME: add test coverage for this condition - https://crbug.com/44043 1
83 if (!document->domWindow() || !document->frame()) 83 if (!document->domWindow() || !document->frame())
84 return ScriptPromise::rejectWithDOMException(scriptState, DOMExcepti on::create(InvalidStateError, "Document is detached from window.")); 84 return ScriptPromise::rejectWithDOMException(scriptState, DOMExcepti on::create(InvalidStateError, "Document is detached from window."));
85 } 85 }
86 86
87 RefPtrWillBeRawPtr<ScriptPromiseResolver> resolver = ScriptPromiseResolver:: create(scriptState); 87 RefPtrWillBeRawPtr<ScriptPromiseResolver> resolver = ScriptPromiseResolver:: create(scriptState);
88 ScriptPromise promise = resolver->promise(); 88 ScriptPromise promise = resolver->promise();
89 pushProvider()->getPermissionStatus(m_registration->webRegistration(), new P ushPermissionStatusCallbacks(resolver)); 89 pushProvider()->getPermissionStatus(m_registration->webRegistration(), new P ushPermissionStatusCallbacks(resolver));
90 return promise; 90 return promise;
91 } 91 }
92 92
93 ScriptPromise PushManager::hasPermission(ScriptState* scriptState)
94 {
95 return permissionState(scriptState);
96 }
97
93 DEFINE_TRACE(PushManager) 98 DEFINE_TRACE(PushManager)
94 { 99 {
95 visitor->trace(m_registration); 100 visitor->trace(m_registration);
96 } 101 }
97 102
98 } // namespace blink 103 } // namespace blink
OLDNEW
« no previous file with comments | « Source/modules/push_messaging/PushManager.h ('k') | Source/modules/push_messaging/PushManager.idl » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698