void NetworkInformation::startObserving()
{
    if (!m_observing && !m_contextStopped) {
        m_type = networkStateNotifier().connectionType();
        networkStateNotifier().addObserver(this, executionContext());
        m_observing = true;
    }
}
Beispiel #2
0
 HTMLVideoElementTest()
     : m_dummyPageHolder(DummyPageHolder::create(IntSize(640, 360), nullptr, StubFrameLoaderClient::create()))
 {
     // TODO(sandersd): This should be done by a settings initializer.
     networkStateNotifier().setWebConnection(WebConnectionTypeWifi, 54.0);
     m_video = HTMLVideoElement::create(m_dummyPageHolder->document());
 }
Response InspectorApplicationCacheAgent::enable() {
  m_state->setBoolean(ApplicationCacheAgentState::applicationCacheAgentEnabled,
                      true);
  m_instrumentingAgents->addInspectorApplicationCacheAgent(this);
  frontend()->networkStateUpdated(networkStateNotifier().onLine());
  return Response::OK();
}
void NetworkInformation::stopObserving()
{
    if (m_observing) {
        networkStateNotifier().removeObserver(this, executionContext());
        m_observing = false;
    }
}
NetworkInformation::NetworkInformation(ExecutionContext* context)
    : ActiveDOMObject(context)
    , m_type(networkStateNotifier().connectionType())
    , m_observing(false)
    , m_contextStopped(false)
{
    ScriptWrappable::init(this);
}
void InspectorApplicationCacheAgent::enable(ErrorString*)
{
    m_state->setBoolean(ApplicationCacheAgentState::applicationCacheAgentEnabled, true);
    m_instrumentingAgents->setInspectorApplicationCacheAgent(this);

    // We need to pass initial navigator.onOnline.
    networkStateChanged(networkStateNotifier().onLine());
}
void FrameLoaderClientHl::dispatchDecidePolicyForMIMEType(FramePolicyFunction function, const String& mimetype, const ResourceRequest& request)
{
    if (!m_webFrame)
        return;

    PolicyAction action = networkStateNotifier().onLine()? PolicyUse : PolicyIgnore;
    (m_frame->loader()->policyChecker()->*function)(action);
}
String NetworkInformation::type() const
{
    // m_type is only updated when listening for events, so ask networkStateNotifier
    // if not listening (crbug.com/379841).
    if (!m_observing)
        return connectionTypeToString(networkStateNotifier().connectionType());

    // If observing, return m_type which changes when the event fires, per spec.
    return connectionTypeToString(m_type);
}
Beispiel #9
0
inline Worker::Worker(ScriptExecutionContext& context)
    : ActiveDOMObject(&context)
    , m_contextProxy(WorkerGlobalScopeProxy::create(this))
{
    if (!allWorkers) {
        allWorkers = new HashSet<Worker*>;
        networkStateNotifier().addNetworkStateChangeListener(networkStateChanged);
    }

    HashSet<Worker*>::AddResult addResult = allWorkers->add(this);
    ASSERT_UNUSED(addResult, addResult.isNewEntry);
}
Beispiel #10
0
Page::Page(PageClients& pageClients)
    : m_autoscrollController(AutoscrollController::create())
    , m_chrome(Chrome::create(this, pageClients.chromeClient))
    , m_dragCaretController(DragCaretController::create())
    , m_dragController(DragController::create(this, pageClients.dragClient))
    , m_focusController(FocusController::create(this))
    , m_contextMenuController(ContextMenuController::create(this, pageClients.contextMenuClient))
    , m_inspectorController(InspectorController::create(this, pageClients.inspectorClient))
    , m_pointerLockController(PointerLockController::create(this))
    , m_settings(Settings::create(this))
    , m_progress(ProgressTracker::create())
    , m_backForwardController(BackForwardController::create(this, pageClients.backForwardClient))
    , m_theme(RenderTheme::themeForPage(this))
    , m_editorClient(pageClients.editorClient)
    , m_validationMessageClient(0)
    , m_subframeCount(0)
    , m_openedByDOM(false)
    , m_tabKeyCyclesThroughElements(true)
    , m_defersLoading(false)
    , m_defersLoadingCallCount(0)
    , m_pageScaleFactor(1)
    , m_deviceScaleFactor(1)
    , m_didLoadUserStyleSheet(false)
    , m_userStyleSheetModificationTime(0)
    , m_group(0)
    , m_timerAlignmentInterval(DOMTimer::visiblePageAlignmentInterval())
    , m_isInWindow(true)
    , m_visibilityState(PageVisibilityStateVisible)
    , m_isCursorVisible(true)
    , m_layoutMilestones(0)
    , m_isCountingRelevantRepaintedObjects(false)
#ifndef NDEBUG
    , m_isPainting(false)
#endif
    , m_console(PageConsole::create(this))
{
    ASSERT(m_editorClient);

    if (!allPages) {
        allPages = new HashSet<Page*>;

        networkStateNotifier().setNetworkStateChangedFunction(networkStateChanged);
    }

    ASSERT(!allPages->contains(this));
    allPages->add(this);

#ifndef NDEBUG
    pageCounter.increment();
#endif
}
Beispiel #11
0
inline Worker::Worker(ScriptExecutionContext& context, JSC::RuntimeFlags runtimeFlags)
    : ActiveDOMObject(&context)
    , m_identifier("worker:" + Inspector::IdentifiersFactory::createIdentifier())
    , m_contextProxy(WorkerGlobalScopeProxy::create(this))
    , m_runtimeFlags(runtimeFlags)
{
    if (!allWorkers) {
        allWorkers = new HashSet<Worker*>;
        networkStateNotifier().addNetworkStateChangeListener(networkStateChanged);
    }

    HashSet<Worker*>::AddResult addResult = allWorkers->add(this);
    ASSERT_UNUSED(addResult, addResult.isNewEntry);
}
Beispiel #12
0
Page::Page(ChromeClient* chromeClient, ContextMenuClient* contextMenuClient, EditorClient* editorClient, DragClient* dragClient, InspectorClient* inspectorClient)
    : m_chrome(new Chrome(this, chromeClient))
    , m_dragCaretController(new SelectionController(0, true))
    , m_dragController(new DragController(this, dragClient))
    , m_focusController(new FocusController(this))
    , m_contextMenuController(new ContextMenuController(this, contextMenuClient))
#if ENABLE(INSPECTOR)
    , m_inspectorController(new InspectorController(this, inspectorClient))
#endif
    , m_settings(new Settings(this))
    , m_progress(new ProgressTracker)
    , m_backForwardList(BackForwardList::create(this))
    , m_editorClient(editorClient)
    , m_frameCount(0)
    , m_tabKeyCyclesThroughElements(true)
    , m_defersLoading(false)
    , m_inLowQualityInterpolationMode(false)
    , m_cookieEnabled(true)
    , m_mediaVolume(1)
#if ENABLE(INSPECTOR)
    , m_parentInspectorController(0)
#endif
    , m_didLoadUserStyleSheet(false)
    , m_userStyleSheetModificationTime(0)
    , m_group(0)
    , m_debugger(0)
    , m_pendingUnloadEventCount(0)
    , m_pendingBeforeUnloadEventCount(0)
    , m_customHTMLTokenizerTimeDelay(-1)
    , m_customHTMLTokenizerChunkSize(-1)
{
    if (!allPages) {
        allPages = new HashSet<Page*>;
        
        networkStateNotifier().setNetworkStateChangedFunction(networkStateChanged);
    }

    ASSERT(!allPages->contains(this));
    allPages->add(this);

#if ENABLE(JAVASCRIPT_DEBUGGER)
    JavaScriptDebugServer::shared().pageCreated(this);
#endif

#ifndef NDEBUG
    pageCounter.increment();
#endif
}
Beispiel #13
0
static void networkStateChanged()
{
    Vector<RefPtr<Frame> > frames;

    // Get all the frames of all the pages in all the page groups
    HashSet<Page*>::iterator end = allPages->end();
    for (HashSet<Page*>::iterator it = allPages->begin(); it != end; ++it) {
        for (Frame* frame = (*it)->mainFrame(); frame; frame = frame->tree()->traverseNext())
            frames.append(frame);
        InspectorInstrumentation::networkStateChanged(*it);
    }

    AtomicString eventName = networkStateNotifier().onLine() ? eventNames().onlineEvent : eventNames().offlineEvent;
    for (unsigned i = 0; i < frames.size(); i++)
        frames[i]->document()->dispatchWindowEvent(Event::create(eventName, false, false));
}
Beispiel #14
0
Page::Page(const PageClients& pageClients)
    : m_chrome(adoptPtr(new Chrome(this, pageClients.chromeClient)))
    , m_dragCaretController(adoptPtr(new SelectionController(0, true)))
#if ENABLE(DRAG_SUPPORT)
    , m_dragController(adoptPtr(new DragController(this, pageClients.dragClient)))
#endif
    , m_focusController(adoptPtr(new FocusController(this)))
#if ENABLE(CONTEXT_MENUS)
    , m_contextMenuController(adoptPtr(new ContextMenuController(this, pageClients.contextMenuClient)))
#endif
#if ENABLE(INSPECTOR)
    , m_inspectorController(adoptPtr(new InspectorController(this, pageClients.inspectorClient)))
#endif
#if ENABLE(CLIENT_BASED_GEOLOCATION)
    , m_geolocationController(adoptPtr(new GeolocationController(this, pageClients.geolocationClient)))
#endif
#if ENABLE(DEVICE_ORIENTATION)
    , m_deviceMotionController(RuntimeEnabledFeatures::deviceMotionEnabled() ? new DeviceMotionController(pageClients.deviceMotionClient) : 0)
    , m_deviceOrientationController(RuntimeEnabledFeatures::deviceOrientationEnabled() ? new DeviceOrientationController(this, pageClients.deviceOrientationClient) : 0)
#endif
#if ENABLE(INPUT_SPEECH)
    , m_speechInputClient(pageClients.speechInputClient)
#endif
    , m_settings(adoptPtr(new Settings(this)))
    , m_progress(adoptPtr(new ProgressTracker))
    , m_backForwardController(adoptPtr(new BackForwardController(this, pageClients.backForwardClient)))
    , m_theme(RenderTheme::themeForPage(this))
    , m_editorClient(pageClients.editorClient)
    , m_frameCount(0)
    , m_openedByDOM(false)
    , m_tabKeyCyclesThroughElements(true)
    , m_defersLoading(false)
    , m_inLowQualityInterpolationMode(false)
    , m_cookieEnabled(true)
    , m_areMemoryCacheClientCallsEnabled(true)
    , m_mediaVolume(1)
    , m_javaScriptURLsAreAllowed(true)
    , m_didLoadUserStyleSheet(false)
    , m_userStyleSheetModificationTime(0)
    , m_group(0)
    , m_debugger(0)
    , m_customHTMLTokenizerTimeDelay(-1)
    , m_customHTMLTokenizerChunkSize(-1)
    , m_canStartMedia(true)
    , m_viewMode(ViewModeWindowed)
    , m_minimumTimerInterval(Settings::defaultMinDOMTimerInterval())
    , m_isEditable(false)
#if ENABLE(PAGE_VISIBILITY_API)
    , m_visibilityState(PageVisibilityStateVisible)
#endif
{
    if (!allPages) {
        allPages = new HashSet<Page*>;
        
        networkStateNotifier().setNetworkStateChangedFunction(networkStateChanged);
#if PLATFORM(ANDROID) && ENABLE(APPLICATION_INSTALLED)
        packageNotifier().setOnResultAvailable(onPackageResultAvailable);
#endif
    }

    ASSERT(!allPages->contains(this));
    allPages->add(this);

    if (pageClients.pluginHalterClient) {
        m_pluginHalter.set(new PluginHalter(pageClients.pluginHalterClient));
        m_pluginHalter->setPluginAllowedRunTime(m_settings->pluginAllowedRunTime());
    }

#ifndef NDEBUG
    pageCounter.increment();
#endif
}
void InspectorApplicationCacheAgent::enable(ErrorString*)
{
    m_state->setBoolean(ApplicationCacheAgentState::applicationCacheAgentEnabled, true);
    m_instrumentingAgents->setInspectorApplicationCacheAgent(this);
    frontend()->networkStateUpdated(networkStateNotifier().onLine());
}
Beispiel #16
0
Page::Page(PageClients& pageClients)
    : m_chrome(Chrome::create(this, pageClients.chromeClient))
    , m_dragCaretController(DragCaretController::create())
#if ENABLE(DRAG_SUPPORT)
    , m_dragController(DragController::create(this, pageClients.dragClient))
#endif
    , m_focusController(FocusController::create(this))
#if ENABLE(CONTEXT_MENUS)
    , m_contextMenuController(ContextMenuController::create(this, pageClients.contextMenuClient))
#endif
#if ENABLE(INSPECTOR)
    , m_inspectorController(InspectorController::create(this, pageClients.inspectorClient))
#endif
#if ENABLE(POINTER_LOCK)
    , m_pointerLockController(PointerLockController::create(this))
#endif
    , m_settings(Settings::create(this))
    , m_progress(ProgressTracker::create())
    , m_backForwardController(BackForwardController::create(this, pageClients.backForwardClient))
    , m_theme(RenderTheme::themeForPage(this))
    , m_editorClient(pageClients.editorClient)
    , m_validationMessageClient(pageClients.validationMessageClient)
    , m_subframeCount(0)
    , m_openedByDOM(false)
    , m_tabKeyCyclesThroughElements(true)
    , m_defersLoading(false)
    , m_defersLoadingCallCount(0)
    , m_inLowQualityInterpolationMode(false)
    , m_cookieEnabled(true)
    , m_areMemoryCacheClientCallsEnabled(true)
    , m_mediaVolume(1)
    , m_pageScaleFactor(1)
    , m_deviceScaleFactor(1)
    , m_suppressScrollbarAnimations(false)
    , m_didLoadUserStyleSheet(false)
    , m_userStyleSheetModificationTime(0)
    , m_group(0)
    , m_debugger(0)
    , m_customHTMLTokenizerTimeDelay(-1)
    , m_customHTMLTokenizerChunkSize(-1)
    , m_canStartMedia(true)
    , m_viewMode(ViewModeWindowed)
    , m_minimumTimerInterval(Settings::defaultMinDOMTimerInterval())
    , m_timerAlignmentInterval(Settings::defaultDOMTimerAlignmentInterval())
    , m_isEditable(false)
    , m_isOnscreen(true)
#if ENABLE(PAGE_VISIBILITY_API)
    , m_visibilityState(PageVisibilityStateVisible)
#endif
    , m_displayID(0)
    , m_layoutMilestones(0)
    , m_isCountingRelevantRepaintedObjects(false)
#ifndef NDEBUG
    , m_isPainting(false)
#endif
    , m_alternativeTextClient(pageClients.alternativeTextClient)
    , m_scriptedAnimationsSuspended(false)
{
    ASSERT(m_editorClient);

    if (!allPages) {
        allPages = new HashSet<Page*>;
        
        networkStateNotifier().setNetworkStateChangedFunction(networkStateChanged);
    }

    ASSERT(!allPages->contains(this));
    allPages->add(this);

#ifndef NDEBUG
    pageCounter.increment();
#endif
}
void WebNetworkStateNotifier::setWebConnection(WebConnectionType type, double maxBandwidthMbps)
{
    networkStateNotifier().setWebConnection(type, maxBandwidthMbps);
}
Beispiel #18
0
bool NavigatorBase::onLine() const
{
    return networkStateNotifier().onLine();
}
void WebNetworkStateNotifier::setOnLine(bool onLine)
{
    networkStateNotifier().setOnLine(onLine);
}
void InspectorApplicationCacheAgent::networkStateChanged()
{
    bool isNowOnline = networkStateNotifier().onLine();
    m_frontend->updateNetworkState(isNowOnline);
}
Beispiel #21
0
void updateOnlineStatus(bool online)
{
    networkStateNotifier().networkStateChange(online);
}
Beispiel #22
0
Page::Page(ChromeClient* chromeClient, ContextMenuClient* contextMenuClient, EditorClient* editorClient, DragClient* dragClient, InspectorClient* inspectorClient, PluginHalterClient* pluginHalterClient, GeolocationControllerClient* geolocationControllerClient, DeviceOrientationClient* deviceOrientationClient)
    : m_chrome(new Chrome(this, chromeClient))
    , m_dragCaretController(new SelectionController(0, true))
#if ENABLE(DRAG_SUPPORT)
    , m_dragController(new DragController(this, dragClient))
#endif
    , m_focusController(new FocusController(this))
#if ENABLE(CONTEXT_MENUS)
    , m_contextMenuController(new ContextMenuController(this, contextMenuClient))
#endif
#if ENABLE(INSPECTOR)
    , m_inspectorController(new InspectorController(this, inspectorClient))
#endif
#if ENABLE(CLIENT_BASED_GEOLOCATION)
    , m_geolocationController(new GeolocationController(this, geolocationControllerClient))
#endif
#if ENABLE(DEVICE_ORIENTATION)
    , m_deviceOrientation(new DeviceOrientation(this, deviceOrientationClient))
#endif
    , m_settings(new Settings(this))
    , m_progress(new ProgressTracker)
    , m_backForwardList(BackForwardList::create(this))
    , m_theme(RenderTheme::themeForPage(this))
    , m_editorClient(editorClient)
    , m_frameCount(0)
    , m_openedByDOM(false)
    , m_tabKeyCyclesThroughElements(true)
    , m_defersLoading(false)
    , m_inLowQualityInterpolationMode(false)
    , m_cookieEnabled(true)
    , m_areMemoryCacheClientCallsEnabled(true)
    , m_mediaVolume(1)
    , m_javaScriptURLsAreAllowed(true)
    , m_didLoadUserStyleSheet(false)
    , m_userStyleSheetModificationTime(0)
    , m_group(0)
    , m_debugger(0)
    , m_customHTMLTokenizerTimeDelay(-1)
    , m_customHTMLTokenizerChunkSize(-1)
    , m_canStartMedia(true)
{
#if !ENABLE(CONTEXT_MENUS)
    UNUSED_PARAM(contextMenuClient);
#endif
#if !ENABLE(DRAG_SUPPORT)
    UNUSED_PARAM(dragClient);
#endif
#if !ENABLE(INSPECTOR)
    UNUSED_PARAM(inspectorClient);
#endif
#if !ENABLE(CLIENT_BASED_GEOLOCATION)
    UNUSED_PARAM(geolocationControllerClient);
#endif
#if !ENABLE(CLIENT_DEVICE_ORIENTATION)
    UNUSED_PARAM(deviceOrientationClient);
#endif

    if (!allPages) {
        allPages = new HashSet<Page*>;
        
        networkStateNotifier().setNetworkStateChangedFunction(networkStateChanged);
    }

    ASSERT(!allPages->contains(this));
    allPages->add(this);

    if (pluginHalterClient) {
        m_pluginHalter.set(new PluginHalter(pluginHalterClient));
        m_pluginHalter->setPluginAllowedRunTime(m_settings->pluginAllowedRunTime());
    }

#if ENABLE(JAVASCRIPT_DEBUGGER)
    ScriptDebugServer::shared().pageCreated(this);
#endif

#ifndef NDEBUG
    pageCounter.increment();
#endif
}
Beispiel #23
0
Page::Page(PageClients& pageClients)
    : m_chrome(Chrome::create(this, pageClients.chromeClient))
    , m_dragCaretController(DragCaretController::create())
#if ENABLE(DRAG_SUPPORT)
    , m_dragController(DragController::create(this, pageClients.dragClient))
#endif
    , m_focusController(FocusController::create(this))
#if ENABLE(CONTEXT_MENUS)
    , m_contextMenuController(ContextMenuController::create(this, pageClients.contextMenuClient))
#endif
#if ENABLE(INSPECTOR)
    , m_inspectorController(InspectorController::create(this, pageClients.inspectorClient))
#endif
#if ENABLE(CLIENT_BASED_GEOLOCATION)
    , m_geolocationController(GeolocationController::create(this, pageClients.geolocationClient))
#endif
#if ENABLE(DEVICE_ORIENTATION)
    , m_deviceMotionController(RuntimeEnabledFeatures::deviceMotionEnabled() ? DeviceMotionController::create(pageClients.deviceMotionClient) : nullptr)
    , m_deviceOrientationController(RuntimeEnabledFeatures::deviceOrientationEnabled() ? DeviceOrientationController::create(this, pageClients.deviceOrientationClient) : nullptr)
#endif
#if ENABLE(NOTIFICATIONS)
    , m_notificationController(NotificationController::create(this, pageClients.notificationClient))
#endif
#if ENABLE(POINTER_LOCK)
    , m_pointerLockController(PointerLockController::create(this))
#endif
#if ENABLE(INPUT_SPEECH)
    , m_speechInputClient(pageClients.speechInputClient)
#endif
#if ENABLE(MEDIA_STREAM)
    , m_userMediaClient(pageClients.userMediaClient)
#endif
    , m_settings(Settings::create(this))
    , m_progress(ProgressTracker::create())
    , m_backForwardController(BackForwardController::create(this, pageClients.backForwardClient))
    , m_theme(RenderTheme::themeForPage(this))
    , m_editorClient(pageClients.editorClient)
    , m_frameCount(0)
    , m_openedByDOM(false)
    , m_tabKeyCyclesThroughElements(true)
    , m_defersLoading(false)
    , m_inLowQualityInterpolationMode(false)
    , m_cookieEnabled(true)
    , m_areMemoryCacheClientCallsEnabled(true)
    , m_mediaVolume(1)
    , m_pageScaleFactor(1)
    , m_deviceScaleFactor(1)
    , m_javaScriptURLsAreAllowed(true)
    , m_didLoadUserStyleSheet(false)
    , m_userStyleSheetModificationTime(0)
    , m_group(0)
    , m_debugger(0)
    , m_customHTMLTokenizerTimeDelay(-1)
    , m_customHTMLTokenizerChunkSize(-1)
    , m_canStartMedia(true)
    , m_viewMode(ViewModeWindowed)
    , m_minimumTimerInterval(Settings::defaultMinDOMTimerInterval())
    , m_isEditable(false)
#if ENABLE(PAGE_VISIBILITY_API)
    , m_visibilityState(PageVisibilityStateVisible)
#endif
    , m_displayID(0)
{
    if (!allPages) {
        allPages = new HashSet<Page*>;
        
        networkStateNotifier().setNetworkStateChangedFunction(networkStateChanged);
    }

    ASSERT(!allPages->contains(this));
    allPages->add(this);

#ifndef NDEBUG
    pageCounter.increment();
#endif
}