コード例 #1
0
void WebBatteryManager::updateBatteryStatus(const WebBatteryStatus::Data& data)
{
    RefPtr<BatteryStatus> status = BatteryStatus::create(data.isCharging, data.chargingTime, data.dischargingTime, data.level);

    HashSet<WebPage*>::const_iterator it = m_pageSet.begin();
    HashSet<WebPage*>::const_iterator end = m_pageSet.end();
    for (; it != end; ++it) {
        WebPage* page = *it;
        if (page->corePage())
            BatteryController::from(page->corePage())->updateBatteryStatus(status.get());
    }
}
コード例 #2
0
void WebGeolocationManager::didChangePosition(const WebGeolocationPosition::Data& data)
{
#if ENABLE(GEOLOCATION)
    RefPtr<GeolocationPosition> position = GeolocationPosition::create(data.timestamp, data.latitude, data.longitude, data.accuracy);

    HashSet<WebPage*>::const_iterator it = m_pageSet.begin();
    HashSet<WebPage*>::const_iterator end = m_pageSet.end();
    for (; it != end; ++it) {
        WebPage* page = *it;
        if (page->corePage())
            GeolocationController::from(page->corePage())->positionChanged(position.get());
    }
#endif // ENABLE(GEOLOCATION)
}
コード例 #3
0
void WebGeolocationManager::didChangePosition(const WebGeolocationPosition::Data& data)
{
#if ENABLE(GEOLOCATION)
    RefPtr<GeolocationPosition> position = GeolocationPosition::create(data.timestamp, data.latitude, data.longitude, data.accuracy);

    Vector<RefPtr<WebPage> > webPageCopy;
    copyToVector(m_pageSet, webPageCopy);
    for (size_t i = 0; i < webPageCopy.size(); ++i) {
        WebPage* page = webPageCopy[i].get();
        if (page->corePage())
            GeolocationController::from(page->corePage())->positionChanged(position.get());
    }
#endif // ENABLE(GEOLOCATION)
}
コード例 #4
0
void WebGeolocationManager::didFailToDeterminePosition()
{
#if ENABLE(GEOLOCATION)
    // FIXME: Add localized error string.
    RefPtr<GeolocationError> error = GeolocationError::create(GeolocationError::PositionUnavailable, /* Localized error string */ String(""));

    HashSet<WebPage*>::const_iterator it = m_pageSet.begin();
    HashSet<WebPage*>::const_iterator end = m_pageSet.end();
    for (; it != end; ++it) {
        WebPage* page = *it;
        if (page->corePage())
            GeolocationController::from(page->corePage())->errorOccurred(error.get());
    }
#endif // ENABLE(GEOLOCATION)
}
コード例 #5
0
void WebGeolocationManager::didFailToDeterminePosition()
{
#if ENABLE(GEOLOCATION)
    // FIXME: Add localized error string.
    RefPtr<GeolocationError> error = GeolocationError::create(GeolocationError::PositionUnavailable, /* Localized error string */ String(""));

    Vector<RefPtr<WebPage> > webPageCopy;
    copyToVector(m_pageSet, webPageCopy);
    for (size_t i = 0; i < webPageCopy.size(); ++i) {
        WebPage* page = webPageCopy[i].get();
        if (page->corePage())
            GeolocationController::from(page->corePage())->errorOccurred(error.get());
    }
#endif // ENABLE(GEOLOCATION)
}
コード例 #6
0
ファイル: StorageAreaMap.cpp プロジェクト: edcwconan/webkit
void StorageAreaMap::dispatchSessionStorageEvent(uint64_t sourceStorageAreaID, const String& key, const String& oldValue, const String& newValue, const String& urlString)
{
    ASSERT(storageType() == SessionStorage);

    // Namespace IDs for session storage namespaces are equivalent to web page IDs
    // so we can get the right page here.
    WebPage* webPage = WebProcess::singleton().webPage(m_storageNamespaceID);
    if (!webPage)
        return;

    Vector<RefPtr<Frame>> frames;

    Page* page = webPage->corePage();
    for (Frame* frame = &page->mainFrame(); frame; frame = frame->tree().traverseNext()) {
        Document* document = frame->document();
        if (!document->securityOrigin()->equal(m_securityOrigin.ptr()))
            continue;

        Storage* storage = document->domWindow()->optionalSessionStorage();
        if (!storage)
            continue;

        StorageAreaImpl& storageArea = static_cast<StorageAreaImpl&>(storage->area());
        if (storageArea.storageAreaID() == sourceStorageAreaID) {
            // This is the storage area that caused the event to be dispatched.
            continue;
        }

        frames.append(frame);
    }

    StorageEventDispatcher::dispatchLocalStorageEventsToFrames(page->group(), frames, key, oldValue, newValue, urlString, m_securityOrigin.ptr());
}
コード例 #7
0
void WebLoaderStrategy::loadResourceSynchronously(NetworkingContext* context, unsigned long resourceLoadIdentifier, const ResourceRequest& request, StoredCredentials storedCredentials, ClientCredentialPolicy clientCredentialPolicy, ResourceError& error, ResourceResponse& response, Vector<char>& data)
{
    WebFrameNetworkingContext* webContext = static_cast<WebFrameNetworkingContext*>(context);
    // FIXME: Some entities in WebCore use WebCore's "EmptyFrameLoaderClient" instead of having a proper WebFrameLoaderClient.
    // EmptyFrameLoaderClient shouldn't exist and everything should be using a WebFrameLoaderClient,
    // but in the meantime we have to make sure not to mis-cast.
    WebFrameLoaderClient* webFrameLoaderClient = webContext->webFrameLoaderClient();
    WebFrame* webFrame = webFrameLoaderClient ? webFrameLoaderClient->webFrame() : 0;
    WebPage* webPage = webFrame ? webFrame->page() : 0;

    NetworkResourceLoadParameters loadParameters;
    loadParameters.identifier = resourceLoadIdentifier;
    loadParameters.webPageID = webPage ? webPage->pageID() : 0;
    loadParameters.webFrameID = webFrame ? webFrame->frameID() : 0;
    loadParameters.sessionID = webPage ? webPage->sessionID() : SessionID::defaultSessionID();
    loadParameters.request = request;
    loadParameters.contentSniffingPolicy = SniffContent;
    loadParameters.allowStoredCredentials = storedCredentials;
    loadParameters.clientCredentialPolicy = clientCredentialPolicy;
    loadParameters.shouldClearReferrerOnHTTPSToHTTPRedirect = context->shouldClearReferrerOnHTTPSToHTTPRedirect();

    data.resize(0);

    HangDetectionDisabler hangDetectionDisabler;

    if (!WebProcess::singleton().networkConnection().connection().sendSync(Messages::NetworkConnectionToWebProcess::PerformSynchronousLoad(loadParameters), Messages::NetworkConnectionToWebProcess::PerformSynchronousLoad::Reply(error, response, data), 0)) {
        RELEASE_LOG_ERROR_IF_ALLOWED(loadParameters.sessionID, "loadResourceSynchronously: failed sending synchronous network process message (pageID = %" PRIu64 ", frameID = %" PRIu64 ", resourceID = %" PRIu64 ")", loadParameters.webPageID, loadParameters.webFrameID, loadParameters.identifier);
        if (auto* page = webPage->corePage())
            page->diagnosticLoggingClient().logDiagnosticMessage(WebCore::DiagnosticLoggingKeys::internalErrorKey(), WebCore::DiagnosticLoggingKeys::synchronousMessageFailedKey(), WebCore::ShouldSample::No);
        response = ResourceResponse();
        error = internalError(request.url());
    }
}
コード例 #8
0
void WebInspectorClient::openInspectorFrontend(InspectorController*)
{
    WebPage* inspectorPage = m_page->inspector()->createInspectorPage();
    ASSERT(inspectorPage);
    if (!inspectorPage)
        return;

    inspectorPage->corePage()->inspectorController()->setInspectorFrontendClient(adoptPtr(new WebInspectorFrontendClient(m_page, inspectorPage)));
}
コード例 #9
0
bool WebInspectorClient::sendMessageToFrontend(const String& message)
{
    WebInspector* inspector = m_page->inspector();
    if (!inspector)
        return false;
    WebPage* inspectorPage = inspector->inspectorPage();
    if (!inspectorPage)
        return false;
    return doDispatchMessageOnFrontendPage(inspectorPage->corePage(), message);
}
コード例 #10
0
ファイル: EventDispatcher.cpp プロジェクト: JoKaWare/webkit
static void updateWheelEventTestTriggersIfNeeded(uint64_t pageID)
{
    WebPage* webPage = WebProcess::singleton().webPage(pageID);
    Page* page = webPage ? webPage->corePage() : nullptr;

    if (!page || !page->expectsWheelEventTriggers())
        return;

    page->testTrigger()->deferTestsForReason(reinterpret_cast<WheelEventTestTrigger::ScrollableAreaIdentifier>(page), WheelEventTestTrigger::ScrollingThreadSyncNeeded);
}
コード例 #11
0
Frame* WebFrameLoaderClient::dispatchCreatePage()
{
    WebPage* webPage = m_frame->page();
    if (!webPage)
        return 0;

    // Just call through to the chrome client.
    Page* newPage = webPage->corePage()->chrome()->createWindow(m_frame->coreFrame(), FrameLoadRequest(), WindowFeatures());
    if (!newPage)
        return 0;
    
    return newPage->mainFrame();
}
コード例 #12
0
Frame* WebFrameLoaderClient::dispatchCreatePage(const NavigationAction& navigationAction)
{
    WebPage* webPage = m_frame->page();
    if (!webPage)
        return 0;

    // Just call through to the chrome client.
    Page* newPage = webPage->corePage()->chrome()->createWindow(m_frame->coreFrame(), FrameLoadRequest(m_frame->coreFrame()->document()->securityOrigin()), WindowFeatures(), navigationAction);
    if (!newPage)
        return 0;
    
    return newPage->mainFrame();
}
コード例 #13
0
ファイル: WebInspectorClient.cpp プロジェクト: aosm/WebKit2
bool WebInspectorClient::sendMessageToFrontend(const String& message)
{
    WebInspector* inspector = m_page->inspector();
    if (!inspector)
        return false;

#if ENABLE(INSPECTOR_SERVER)
    if (inspector->hasRemoteFrontendConnected()) {
        inspector->sendMessageToRemoteFrontend(message);
        return true;
    }
#endif

    WebPage* inspectorPage = inspector->inspectorPage();
    if (inspectorPage)
        return doDispatchMessageOnFrontendPage(inspectorPage->corePage(), message);

    return false;
}
コード例 #14
0
ファイル: WebChromeClient.cpp プロジェクト: UIKit0/WebkitAIR
Page* WebChromeClient::createWindow(Frame*, const FrameLoadRequest&, const WindowFeatures&)
{
    uint64_t newPageID = 0;
    IntSize viewSize;
    WebPreferencesStore store;
    uint32_t drawingAreaType;
    if (!WebProcess::shared().connection()->sendSync(WebPageProxyMessage::CreateNewPage,
                                                     m_page->pageID(), CoreIPC::In(),
                                                     CoreIPC::Out(newPageID, viewSize, store, drawingAreaType),
                                                     CoreIPC::Connection::NoTimeout)) {
        return 0;
    }

    if (!newPageID)
        return 0;

    WebPage* newWebPage = WebProcess::shared().createWebPage(newPageID, viewSize, store, static_cast<DrawingArea::Type>(drawingAreaType));
    return newWebPage->corePage();
}
コード例 #15
0
DrawingAreaWPE::DrawingAreaWPE(WebPage& webPage, const WebPageCreationParameters&)
    : DrawingArea(DrawingAreaTypeWPE, webPage)
{
    webPage.corePage()->settings().setForceCompositingMode(true);
    enterAcceleratedCompositingMode(0);
}