// FIXME: Remove this code once we have input routing in the browser // process. See http://crbug.com/339659. void ChromeClientImpl::forwardInputEvent( WebCore::Frame* frame, WebCore::Event* event) { WebFrameImpl* webFrame = WebFrameImpl::fromFrame(toLocalFrameTemporary(frame)); // This is only called when we have out-of-process iframes, which // need to forward input events across processes. // FIXME: Add a check for out-of-process iframes enabled. if (event->isKeyboardEvent()) { WebKeyboardEventBuilder webEvent(*static_cast<WebCore::KeyboardEvent*>(event)); webFrame->client()->forwardInputEvent(&webEvent); } else if (event->isMouseEvent()) { WebMouseEventBuilder webEvent(webFrame->frameView(), frame->ownerRenderer(), *static_cast<WebCore::MouseEvent*>(event)); // Internal Blink events should not be forwarded. if (webEvent.type == WebInputEvent::Undefined) return; webFrame->client()->forwardInputEvent(&webEvent); } else if (event->isWheelEvent()) { WebMouseWheelEventBuilder webEvent(webFrame->frameView(), frame->ownerRenderer(), *static_cast<WebCore::WheelEvent*>(event)); if (webEvent.type == WebInputEvent::Undefined) return; webFrame->client()->forwardInputEvent(&webEvent); } }
static PassOwnPtr<WebMediaPlayer> createWebMediaPlayer(WebMediaPlayerClient* client, const WebURL& url, Frame* frame) { WebFrameImpl* webFrame = WebFrameImpl::fromFrame(frame); if (!webFrame->client()) return nullptr; return adoptPtr(webFrame->client()->createMediaPlayer(webFrame, url, client)); }
void ChromeClientImpl::formStateDidChange(const Node* node) { // The current history item is not updated yet. That happens lazily when // WebFrame::currentHistoryItem is requested. WebFrameImpl* webframe = WebFrameImpl::fromFrame(node->document()->frame()); if (webframe->client()) webframe->client()->didUpdateCurrentHistoryItem(webframe); }
void ChromeClientImpl::contentsSizeChanged(Frame* frame, const IntSize& size) const { m_webView->didChangeContentsSize(); WebFrameImpl* webframe = WebFrameImpl::fromFrame(frame); if (webframe->client()) webframe->client()->didChangeContentsSize(webframe, size); }
// Although a LocalFrame is passed in, we don't actually use it, since we // already know our own m_webView. void ChromeClientImpl::runJavaScriptAlert(LocalFrame* frame, const String& message) { WebFrameImpl* webframe = WebFrameImpl::fromFrame(frame); if (webframe->client()) { if (WebUserGestureIndicator::isProcessingUserGesture()) WebUserGestureIndicator::currentUserGestureToken().setJavascriptPrompt(); webframe->client()->runModalAlertDialog(message); } }
static WebMediaPlayer* createWebMediaPlayer( WebMediaPlayerClient* client, Frame* frame) { WebFrameImpl* webFrame = WebFrameImpl::fromFrame(frame); if (!webFrame->client()) return 0; return webFrame->client()->createMediaPlayer(webFrame, client); }
// See comments for runJavaScriptAlert(). bool ChromeClientImpl::runJavaScriptConfirm(LocalFrame* frame, const String& message) { WebFrameImpl* webframe = WebFrameImpl::fromFrame(frame); if (webframe->client()) { if (WebUserGestureIndicator::isProcessingUserGesture()) WebUserGestureIndicator::currentUserGestureToken().setJavascriptPrompt(); return webframe->client()->runModalConfirmDialog(message); } return false; }
void ChromiumBridge::notifyJSOutOfMemory(Frame* frame) { if (!frame) return; WebFrameImpl* webFrame = WebFrameImpl::fromFrame(frame); if (!webFrame->client()) return; webFrame->client()->didExhaustMemoryAvailableForScript(webFrame); }
static WebCookieJar* getCookieJar(const Document* document) { WebFrameImpl* frameImpl = WebFrameImpl::fromFrame(document->frame()); if (!frameImpl || !frameImpl->client()) return 0; WebCookieJar* cookieJar = frameImpl->client()->cookieJar(); if (!cookieJar) cookieJar = webKitClient()->cookieJar(); return cookieJar; }
void ChromeClientImpl::contentsSizeChanged(LocalFrame* frame, const IntSize& size) const { m_webView->didChangeContentsSize(); WebFrameImpl* webframe = WebFrameImpl::fromFrame(frame); webframe->didChangeContentsSize(size); if (webframe->client()) webframe->client()->didChangeContentsSize(webframe, size); frame->loader().restoreScrollPositionAndViewState(); }
void ChromeClientImpl::addMessageToConsole(LocalFrame* localFrame, MessageSource source, MessageLevel level, const String& message, unsigned lineNumber, const String& sourceID, const String& stackTrace) { WebFrameImpl* frame = WebFrameImpl::fromFrame(localFrame); if (frame && frame->client()) { frame->client()->didAddMessageToConsole( WebConsoleMessage(static_cast<WebConsoleMessage::Level>(level), message), sourceID, lineNumber, stackTrace); } }
bool ChromeClientImpl::runBeforeUnloadConfirmPanel(const String& message, LocalFrame* frame) { WebFrameImpl* webframe = WebFrameImpl::fromFrame(frame); bool isReload = false; WebDataSource* ds = webframe->provisionalDataSource(); if (ds) isReload = (ds->navigationType() == blink::WebNavigationTypeReload); if (webframe->client()) return webframe->client()->runModalBeforeUnloadDialog(isReload, message); return false; }
void SharedWorkerRepository::connect(PassRefPtr<SharedWorker> worker, PassOwnPtr<MessagePortChannel> port, const KURL& url, const String& name, ExceptionCode& ec) { WebKit::WebSharedWorkerRepository* repository = WebKit::sharedWorkerRepository(); // This should not be callable unless there's a SharedWorkerRepository for // this context (since isAvailable() should have returned null). ASSERT(repository); // No nested workers (for now) - connect() should only be called from document context. ASSERT(worker->scriptExecutionContext()->isDocument()); Document* document = static_cast<Document*>(worker->scriptExecutionContext()); WebFrameImpl* webFrame = WebFrameImpl::fromFrame(document->frame()); OwnPtr<WebSharedWorker> webWorker; webWorker = adoptPtr(webFrame->client()->createSharedWorker(webFrame, url, name, getId(document))); if (!webWorker) { // Existing worker does not match this url, so return an error back to the caller. ec = URL_MISMATCH_ERR; return; } repository->addSharedWorker(webWorker.get(), getId(document)); // The loader object manages its own lifecycle (and the lifecycles of the two worker objects). // It will free itself once loading is completed. SharedWorkerScriptLoader* loader = new SharedWorkerScriptLoader(worker, url, name, port, webWorker.release()); loader->load(); }
// static WorkerContextProxy* WebWorkerClientImpl::createWorkerContextProxy(Worker* worker) { // Special behavior for multiple workers per process. // FIXME: v8 doesn't support more than one workers per process. // if (!worker->scriptExecutionContext()->isDocument()) // return new WorkerMessagingProxy(worker); WebWorker* webWorker = 0; WebWorkerClientImpl* proxy = new WebWorkerClientImpl(worker); if (worker->scriptExecutionContext()->isDocument()) { Document* document = static_cast<Document*>( worker->scriptExecutionContext()); WebFrameImpl* webFrame = WebFrameImpl::fromFrame(document->frame()); webWorker = webFrame->client()->createWorker(webFrame, proxy); } else { WorkerScriptController* controller = WorkerScriptController::controllerForContext(); if (!controller) { ASSERT_NOT_REACHED(); return 0; } DedicatedWorkerThread* thread = static_cast<DedicatedWorkerThread*>(controller->workerContext()->thread()); WorkerObjectProxy* workerObjectProxy = &thread->workerObjectProxy(); WebWorkerImpl* impl = reinterpret_cast<WebWorkerImpl*>(workerObjectProxy); webWorker = impl->client()->createWorker(proxy); } proxy->setWebWorker(webWorker); return proxy; }
// See comments for runJavaScriptAlert(). bool ChromeClientImpl::runJavaScriptPrompt(LocalFrame* frame, const String& message, const String& defaultValue, String& result) { WebFrameImpl* webframe = WebFrameImpl::fromFrame(frame); if (webframe->client()) { if (WebUserGestureIndicator::isProcessingUserGesture()) WebUserGestureIndicator::currentUserGestureToken().setJavascriptPrompt(); WebString actualValue; bool ok = webframe->client()->runModalPromptDialog( message, defaultValue, &actualValue); if (ok) result = actualValue; return ok; } return false; }
void EditorClientImpl::toggleContinuousSpellChecking() { if (isContinuousSpellCheckingEnabled()) m_spellCheckThisFieldStatus = SpellCheckForcedOff; else m_spellCheckThisFieldStatus = SpellCheckForcedOn; WebFrameImpl* webframe = WebFrameImpl::fromFrame( m_webView->focusedWebCoreFrame()); if (webframe) webframe->client()->didToggleContinuousSpellChecking(webframe); }
void StorageQuotaClientImpl::requestQuota(ExecutionContext* executionContext, WebStorageQuotaType storageType, unsigned long long newQuotaInBytes, PassOwnPtr<StorageQuotaCallback> successCallback, PassOwnPtr<StorageErrorCallback> errorCallback) { ASSERT(executionContext); if (executionContext->isDocument()) { Document* document = toDocument(executionContext); WebFrameImpl* webFrame = WebFrameImpl::fromFrame(document->frame()); OwnPtr<StorageQuotaCallbacks> callbacks = DeprecatedStorageQuotaCallbacksImpl::create(successCallback, errorCallback); webFrame->client()->requestStorageQuota(webFrame, storageType, newQuotaInBytes, callbacks.release()); } else { // Requesting quota in Worker is not supported. executionContext->postTask(StorageErrorCallback::CallbackTask::create(errorCallback, NotSupportedError)); } }
void StorageInfo::requestQuota(ScriptExecutionContext* context, int storageType, unsigned long long newQuotaInBytes, PassRefPtr<StorageInfoQuotaCallback> successCallback, PassRefPtr<StorageInfoErrorCallback> errorCallback) { ASSERT(context); if (storageType != WebStorageQuotaTypeTemporary && storageType != WebStorageQuotaTypePersistent) { // Unknown storage type is requested. fireStorageInfoErrorCallback(errorCallback, NOT_SUPPORTED_ERR); return; } if (context->isDocument()) { Document* document = static_cast<Document*>(context); WebFrameImpl* webFrame = WebFrameImpl::fromFrame(document->frame()); webFrame->client()->requestStorageQuota(webFrame, static_cast<WebStorageQuotaType>(storageType), newQuotaInBytes, new WebStorageQuotaCallbacksImpl(successCallback, errorCallback)); } else { // FIXME: calling this on worker is not yet supported. fireStorageInfoErrorCallback(errorCallback, NOT_SUPPORTED_ERR); } }
ScriptPromise StorageQuotaClientImpl::requestPersistentQuota(ExecutionContext* executionContext, unsigned long long newQuotaInBytes) { ASSERT(executionContext); RefPtr<ScriptPromiseResolver> resolver = ScriptPromiseResolver::create(executionContext); ScriptPromise promise = resolver->promise(); if (executionContext->isDocument()) { Document* document = toDocument(executionContext); WebFrameImpl* webFrame = WebFrameImpl::fromFrame(document->frame()); OwnPtr<StorageQuotaCallbacks> callbacks = StorageQuotaCallbacksImpl::create(resolver, executionContext); webFrame->client()->requestStorageQuota(webFrame, WebStorageQuotaTypePersistent, newQuotaInBytes, callbacks.release()); } else { // Requesting quota in Worker is not supported. resolver->reject(DOMError::create(NotSupportedError)); } return promise; }
void ChromeClientImpl::layoutUpdated(Frame* frame) const { WebFrameImpl* webframe = WebFrameImpl::fromFrame(frame); if (webframe->client()) webframe->client()->didUpdateLayout(webframe); }
void ChromeClientImpl::focusedFrameChanged(WebCore::LocalFrame* frame) { WebFrameImpl* webframe = WebFrameImpl::fromFrame(frame); if (webframe && webframe->client()) webframe->client()->frameFocused(); }
bool ChromeClientImpl::shouldReportDetailedMessageForSource(const String& url) { WebFrameImpl* webframe = m_webView->mainFrameImpl(); return webframe->client() && webframe->client()->shouldReportDetailedMessageForSource(url); }