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