2 * Copyright (C) 2000 Harri Porten (porten@kde.org)
3 * Copyright (c) 2000 Daniel Molkentin (molkentin@kde.org)
4 * Copyright (c) 2000 Stefan Schimanski (schimmi@kde.org)
5 * Copyright (C) 2003, 2004, 2005, 2006 Apple Computer, Inc.
6 * Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies)
8 * This library is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU Lesser General Public
10 * License as published by the Free Software Foundation; either
11 * version 2 of the License, or (at your option) any later version.
13 * This library is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16 * Lesser General Public License for more details.
18 * You should have received a copy of the GNU Lesser General Public
19 * License along with this library; if not, write to the Free Software
20 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
24 #include "core/frame/Navigator.h"
26 #include "bindings/v8/ScriptController.h"
27 #include "core/dom/Document.h"
28 #include "core/frame/NavigatorID.h"
29 #include "core/loader/CookieJar.h"
30 #include "core/loader/FrameLoader.h"
31 #include "core/frame/Frame.h"
32 #include "core/frame/Settings.h"
33 #include "core/plugins/DOMMimeTypeArray.h"
34 #include "core/plugins/DOMPluginArray.h"
35 #include "platform/Language.h"
37 #ifndef WEBCORE_NAVIGATOR_PRODUCT_SUB
38 #define WEBCORE_NAVIGATOR_PRODUCT_SUB "20030107"
39 #endif // ifndef WEBCORE_NAVIGATOR_PRODUCT_SUB
41 #ifndef WEBCORE_NAVIGATOR_VENDOR
42 #define WEBCORE_NAVIGATOR_VENDOR "Google Inc."
43 #endif // ifndef WEBCORE_NAVIGATOR_VENDOR
45 #ifndef WEBCORE_NAVIGATOR_VENDOR_SUB
46 #define WEBCORE_NAVIGATOR_VENDOR_SUB ""
47 #endif // ifndef WEBCORE_NAVIGATOR_VENDOR_SUB
51 Navigator::Navigator(Frame* frame)
52 : DOMWindowProperty(frame)
54 ScriptWrappable::init(this);
57 Navigator::~Navigator()
61 AtomicString Navigator::language() const
63 return defaultLanguage();
66 String Navigator::productSub() const
68 return WEBCORE_NAVIGATOR_PRODUCT_SUB;
71 String Navigator::vendor() const
73 return WEBCORE_NAVIGATOR_VENDOR;
76 String Navigator::vendorSub() const
78 return WEBCORE_NAVIGATOR_VENDOR_SUB;
81 String Navigator::userAgent() const
83 // If the frame is already detached it no longer has a meaningful useragent.
84 if (!m_frame || !m_frame->page())
87 return m_frame->loader().userAgent(m_frame->document()->url());
90 DOMPluginArray* Navigator::plugins() const
93 m_plugins = DOMPluginArray::create(m_frame);
94 return m_plugins.get();
97 DOMMimeTypeArray* Navigator::mimeTypes() const
100 m_mimeTypes = DOMMimeTypeArray::create(m_frame);
101 return m_mimeTypes.get();
104 bool Navigator::cookieEnabled() const
109 Settings* settings = m_frame->settings();
110 if (!settings || !settings->cookieEnabled())
113 return cookiesEnabled(m_frame->document());
116 bool Navigator::javaEnabled() const
118 if (!m_frame || !m_frame->settings())
121 if (!m_frame->settings()->javaEnabled())
127 void Navigator::getStorageUpdates()
129 // FIXME: Remove this method or rename to yieldForStorageUpdates.
132 } // namespace WebCore