diff options
Diffstat (limited to 'Source/WebCore/page/Navigator.cpp')
-rw-r--r-- | Source/WebCore/page/Navigator.cpp | 46 |
1 files changed, 23 insertions, 23 deletions
diff --git a/Source/WebCore/page/Navigator.cpp b/Source/WebCore/page/Navigator.cpp index b88015b79..ff60fcaaf 100644 --- a/Source/WebCore/page/Navigator.cpp +++ b/Source/WebCore/page/Navigator.cpp @@ -2,7 +2,7 @@ * Copyright (C) 2000 Harri Porten (porten@kde.org) * Copyright (c) 2000 Daniel Molkentin (molkentin@kde.org) * Copyright (c) 2000 Stefan Schimanski (schimmi@kde.org) - * Copyright (C) 2003, 2004, 2005, 2006 Apple Computer, Inc. + * Copyright (C) 2003, 2004, 2005, 2006 Apple Inc. * Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies) * * This library is free software; you can redistribute it and/or @@ -37,14 +37,14 @@ #include "ScriptController.h" #include "SecurityOrigin.h" #include "Settings.h" -#include "StorageNamespace.h" -#include <wtf/HashSet.h> #include <wtf/StdLibExtras.h> +using namespace WTF; + namespace WebCore { -Navigator::Navigator(Frame* frame) - : DOMWindowProperty(frame) +Navigator::Navigator(Frame& frame) + : DOMWindowProperty(&frame) { } @@ -56,14 +56,14 @@ Navigator::~Navigator() // appear in the appVersion string. This is to avoid problems with old versions of a // library called OpenCube QuickMenu, which as of this writing is still being used on // sites such as nwa.com -- the library thinks Safari is Netscape 4 if we don't do this! -static bool shouldHideFourDot(Frame* frame) +static bool shouldHideFourDot(Frame& frame) { - const String* sourceURL = frame->script().sourceURL(); + auto* sourceURL = frame.script().sourceURL(); if (!sourceURL) return false; if (!(sourceURL->endsWith("/dqm_script.js") || sourceURL->endsWith("/dqm_loader.js") || sourceURL->endsWith("/tdqm_loader.js"))) return false; - return frame->settings().needsSiteSpecificQuirks(); + return frame.settings().needsSiteSpecificQuirks(); } String Navigator::appVersion() const @@ -71,41 +71,36 @@ String Navigator::appVersion() const if (!m_frame) return String(); String appVersion = NavigatorBase::appVersion(); - if (shouldHideFourDot(m_frame)) + if (shouldHideFourDot(*m_frame)) appVersion.replace("4.", "4_"); return appVersion; } -String Navigator::language() const -{ - return defaultLanguage(); -} - String Navigator::userAgent() const { if (!m_frame) return String(); - + // If the frame is already detached, FrameLoader::userAgent may malfunction, because it calls a client method // that uses frame's WebView (at least, in Mac WebKit). if (!m_frame->page()) return String(); - + return m_frame->loader().userAgent(m_frame->document()->url()); } -DOMPluginArray* Navigator::plugins() const +DOMPluginArray& Navigator::plugins() { if (!m_plugins) m_plugins = DOMPluginArray::create(m_frame); - return m_plugins.get(); + return *m_plugins; } -DOMMimeTypeArray* Navigator::mimeTypes() const +DOMMimeTypeArray& Navigator::mimeTypes() { if (!m_mimeTypes) m_mimeTypes = DOMMimeTypeArray::create(m_frame); - return m_mimeTypes.get(); + return *m_mimeTypes; } bool Navigator::cookieEnabled() const @@ -116,7 +111,11 @@ bool Navigator::cookieEnabled() const if (m_frame->page() && !m_frame->page()->settings().cookieEnabled()) return false; - return cookiesEnabled(m_frame->document()); + auto* document = m_frame->document(); + if (!document) + return false; + + return cookiesEnabled(*document); } bool Navigator::javaEnabled() const @@ -126,22 +125,23 @@ bool Navigator::javaEnabled() const if (!m_frame->settings().isJavaEnabled()) return false; - if (m_frame->document()->securityOrigin()->isLocal() && !m_frame->settings().isJavaEnabledForLocalFiles()) + if (m_frame->document()->securityOrigin().isLocal() && !m_frame->settings().isJavaEnabledForLocalFiles()) return false; return true; } #if PLATFORM(IOS) + bool Navigator::standalone() const { return m_frame && m_frame->settings().standalone(); } + #endif void Navigator::getStorageUpdates() { - // FIXME: Remove this method or rename to yieldForStorageUpdates. } } // namespace WebCore |