Exemplo n.º 1
0
void ColorChooserUIController::openColorChooser() {
  DCHECK(!m_chooser);
  WebLocalFrameImpl* frame = WebLocalFrameImpl::fromFrame(m_frame);
  WebFrameClient* webFrameClient = frame->client();
  if (!webFrameClient)
    return;
  m_chooser = WTF::wrapUnique(webFrameClient->createColorChooser(
      this, static_cast<WebColor>(m_client->currentColor().rgb()),
      m_client->suggestions()));
}
Exemplo n.º 2
0
void ChromeClientImpl::installSupplements(LocalFrame& frame) {
  WebLocalFrameImpl* webFrame = WebLocalFrameImpl::fromFrame(&frame);
  WebFrameClient* client = webFrame->client();
  DCHECK(client);
  providePushControllerTo(frame, client->pushClient());
  provideUserMediaTo(frame,
                     UserMediaClientImpl::create(client->userMediaClient()));
  provideIndexedDBClientTo(frame, IndexedDBClientImpl::create());
  provideLocalFileSystemTo(frame, LocalFileSystemClient::create());
  provideNavigatorContentUtilsTo(
      frame, NavigatorContentUtilsClientImpl::create(webFrame));

  if (RuntimeEnabledFeatures::webBluetoothEnabled())
    BluetoothSupplement::provideTo(frame, client->bluetooth());

  ScreenOrientationController::provideTo(frame,
                                         client->webScreenOrientationClient());
  if (RuntimeEnabledFeatures::presentationEnabled())
    PresentationController::provideTo(frame, client->presentationClient());
  if (RuntimeEnabledFeatures::audioOutputDevicesEnabled())
    provideAudioOutputDeviceClientTo(frame,
                                     AudioOutputDeviceClientImpl::create());
  if (RuntimeEnabledFeatures::installedAppEnabled())
    InstalledAppController::provideTo(frame, client->installedAppClient());
}
Exemplo n.º 3
0
void FrameLoaderClientImpl::detached(FrameDetachType type) {
  // Alert the client that the frame is being detached. This is the last
  // chance we have to communicate with the client.
  WebFrameClient* client = m_webFrame->client();
  if (!client)
    return;

  m_webFrame->willDetachParent();

  // Signal that no further communication with WebFrameClient should take
  // place at this point since we are no longer associated with the Page.
  m_webFrame->setClient(0);

  client->frameDetached(m_webFrame,
                        static_cast<WebFrameClient::DetachType>(type));
  // Clear our reference to LocalFrame at the very end, in case the client
  // refers to it.
  m_webFrame->setCoreFrame(nullptr);
}
Exemplo n.º 4
0
void FrameLoaderClientImpl::detachedFromParent()
{
    // Alert the client that the frame is being detached. This is the last
    // chance we have to communicate with the client.
    RefPtr<WebLocalFrameImpl> protector(m_webFrame);

    WebFrameClient* client = m_webFrame->client();
    if (!client)
        return;

    m_webFrame->willDetachParent();

    // Signal that no further communication with WebFrameClient should take
    // place at this point since we are no longer associated with the Page.
    m_webFrame->setClient(0);

    client->frameDetached(m_webFrame);
    // Clear our reference to WebCore::LocalFrame at the very end, in case the client
    // refers to it.
    m_webFrame->setWebCoreFrame(nullptr);
}
Exemplo n.º 5
0
void ChromeClientImpl::openFileChooser(LocalFrame* frame,
                                       PassRefPtr<FileChooser> fileChooser) {
  notifyPopupOpeningObservers();
  WebFrameClient* client = WebLocalFrameImpl::fromFrame(frame)->client();
  if (!client)
    return;

  WebFileChooserParams params;
  params.multiSelect = fileChooser->settings().allowsMultipleFiles;
  params.directory = fileChooser->settings().allowsDirectoryUpload;
  params.acceptTypes = fileChooser->settings().acceptTypes();
  params.selectedFiles = fileChooser->settings().selectedFiles;
  params.useMediaCapture = fileChooser->settings().useMediaCapture;
  params.needLocalPath = fileChooser->settings().allowsDirectoryUpload;
  params.requestor = frame->document()->url();

  WebFileChooserCompletionImpl* chooserCompletion =
      new WebFileChooserCompletionImpl(std::move(fileChooser));
  if (client->runFileChooser(params, chooserCompletion))
    return;
  // Choosing failed, so do callback with an empty list.
  chooserCompletion->didChooseFile(WebVector<WebString>());
}