OLD | NEW |
(Empty) | |
| 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 |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #include "modules/notifications/NotificationPermissionClient.h" |
| 6 |
| 7 #include "core/dom/Document.h" |
| 8 #include "core/dom/ExecutionContext.h" |
| 9 #include "core/frame/LocalFrame.h" |
| 10 |
| 11 namespace blink { |
| 12 |
| 13 const char* NotificationPermissionClient::supplementName() |
| 14 { |
| 15 return "NotificationPermissionClient"; |
| 16 } |
| 17 |
| 18 NotificationPermissionClient* NotificationPermissionClient::from(ExecutionContex
t* context) |
| 19 { |
| 20 if (!context->isDocument()) |
| 21 return nullptr; |
| 22 |
| 23 const Document* document = toDocument(context); |
| 24 if (!document->frame()) |
| 25 return nullptr; |
| 26 |
| 27 return static_cast<NotificationPermissionClient*>(Supplement<LocalFrame>::fr
om(document->frame(), supplementName())); |
| 28 } |
| 29 |
| 30 void provideNotificationPermissionClientTo(LocalFrame& frame, NotificationPermis
sionClient* client) |
| 31 { |
| 32 frame.provideSupplement(NotificationPermissionClient::supplementName(), clie
nt); |
| 33 } |
| 34 |
| 35 } // namespace blink |
OLD | NEW |