void BluetoothSupplement::provideTo(LocalFrame& frame, WebBluetooth* bluetooth)
{
    RawPtr<BluetoothSupplement> bluetoothSupplement = new BluetoothSupplement(bluetooth);
    Supplement<LocalFrame>::provideTo(frame, supplementName(), bluetoothSupplement.release());
};
WebBluetooth* BluetoothSupplement::from(LocalFrame* frame)
{
    BluetoothSupplement* supplement = static_cast<BluetoothSupplement*>(Supplement<LocalFrame>::from(frame, supplementName()));

    ASSERT(supplement);
    ASSERT(supplement->m_bluetooth);

    return supplement->m_bluetooth;
}
Beispiel #3
0
void DOMWindowPagePopup::uninstall(DOMWindow* window)
{
    ASSERT(window);
    window->removeSupplement(supplementName());
}
void StorageNamespaceController::provideStorageNamespaceTo(
    Page& page,
    StorageClient* client) {
  StorageNamespaceController::provideTo(page, supplementName(),
                                        new StorageNamespaceController(client));
}
InternalSettings* InternalSettings::from(Page& page)
{
    if (!HeapSupplement<Page>::from(page, supplementName()))
        HeapSupplement<Page>::provideTo(page, supplementName(), new InternalSettings(page));
    return static_cast<InternalSettings*>(HeapSupplement<Page>::from(page, supplementName()));
}
void VRController::provideTo(LocalFrame& frame, ServiceRegistry* registry)
{
    ASSERT(RuntimeEnabledFeatures::webVREnabled());
    Supplement<LocalFrame>::provideTo(frame, supplementName(), registry ? new VRController(frame, registry) : nullptr);
}
void HTMLImportsController::provideTo(Document& master)
{
    OwnPtrWillBeRawPtr<HTMLImportsController> controller = adoptPtrWillBeNoop(new HTMLImportsController(master));
    master.setImportsController(controller.get());
    DocumentSupplement::provideTo(master, supplementName(), controller.release());
}
ScreenOrientationController* ScreenOrientationController::from(LocalFrame& frame)
{
    return static_cast<ScreenOrientationController*>(WillBeHeapSupplement<LocalFrame>::from(frame, supplementName()));
}
WorkerNavigatorNetworkInformation* WorkerNavigatorNetworkInformation::toWorkerNavigatorNetworkInformation(WorkerNavigator& navigator, ExecutionContext* context)
{
    return static_cast<WorkerNavigatorNetworkInformation*>(HeapSupplement<WorkerNavigator>::from(navigator, supplementName()));
}
void MediaKeysController::provideMediaKeysTo(Page& page, MediaKeysClient* client)
{
    MediaKeysController::provideTo(page, supplementName(), adoptPtrWillBeNoop(new MediaKeysController(client)));
}
Beispiel #11
0
USBController& USBController::from(LocalFrame& frame)
{
    USBController* controller = static_cast<USBController*>(WillBeHeapSupplement<LocalFrame>::from(frame, supplementName()));
    ASSERT(controller);
    return *controller;
}
Beispiel #12
0
void USBController::provideTo(LocalFrame& frame, WebUSBClient* client)
{
    ASSERT(RuntimeEnabledFeatures::webUSBEnabled());
    USBController* controller = new USBController(frame, client);
    WillBeHeapSupplement<LocalFrame>::provideTo(frame, supplementName(), adoptPtrWillBeNoop(controller));
}
VRController* VRController::from(LocalFrame& frame)
{
    return static_cast<VRController*>(Supplement<LocalFrame>::from(frame, supplementName()));
}
Beispiel #14
0
void FontFaceSet::didLayout(Document& document) {
  if (FontFaceSet* fonts = static_cast<FontFaceSet*>(
          Supplement<Document>::from(document, supplementName())))
    fonts->didLayout();
}
void HTMLImportsController::removeFrom(Document& master)
{
    static_cast<DocumentSupplementable&>(master).removeSupplement(supplementName());
    master.setImportsController(nullptr);
}
Beispiel #16
0
size_t FontFaceSet::approximateBlankCharacterCount(Document& document) {
  if (FontFaceSet* fonts = static_cast<FontFaceSet*>(
          Supplement<Document>::from(document, supplementName())))
    return fonts->approximateBlankCharacterCount();
  return 0;
}
WorkerContentSettingsClient* WorkerContentSettingsClient::from(ExecutionContext& context)
{
    WorkerClients* clients = toWorkerGlobalScope(context).clients();
    DCHECK(clients);
    return static_cast<WorkerContentSettingsClient*>(Supplement<WorkerClients>::from(*clients, supplementName()));
}
Beispiel #18
0
InternalSettings* InternalSettings::from(Page* page)
{
    if (!Supplement<Page>::from(page, supplementName()))
        Supplement<Page>::provideTo(page, supplementName(), adoptPtr(new InternalSettingsWrapper(page)));
    return static_cast<InternalSettingsWrapper*>(Supplement<Page>::from(page, supplementName()))->internalSettings();
}
Beispiel #19
0
void DOMWindowPagePopup::install(DOMWindow* window, PagePopupClient* popupClient)
{
    ASSERT(window);
    ASSERT(popupClient);
    provideTo(window, supplementName(), adoptPtr(new DOMWindowPagePopup(popupClient)));
}
DedicatedWorkerMessagingProxyProvider*
DedicatedWorkerMessagingProxyProvider::from(Page& page) {
    return static_cast<DedicatedWorkerMessagingProxyProvider*>(
               Supplement<Page>::from(page, supplementName()));
}
NotificationPermissionClient* NotificationPermissionClient::from(ExecutionContext* context)
{
    if (!context->isDocument())
        return nullptr;

    const Document* document = toDocument(context);
    if (!document->frame() || !document->frame()->isLocalFrame())
        return nullptr;

    return static_cast<NotificationPermissionClient*>(WillBeHeapSupplement<LocalFrame>::from(document->frame(), supplementName()));
}