1 /* 2 Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies) 3 4 This library is free software; you can redistribute it and/or 5 modify it under the terms of the GNU Library General Public 6 License as published by the Free Software Foundation; either 7 version 2 of the License, or (at your option) any later version. 8 9 This library is distributed in the hope that it will be useful, 10 but WITHOUT ANY WARRANTY; without even the implied warranty of 11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 12 Library General Public License for more details. 13 14 You should have received a copy of the GNU Library General Public License 15 along with this library; see the file COPYING.LIB. If not, write to 16 the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, 17 Boston, MA 02110-1301, USA. 18 */ 19 20 #ifndef Navigator_h 21 #define Navigator_h 22 23 #include "NavigatorBase.h" 24 #include <wtf/Forward.h> 25 #include <wtf/PassRefPtr.h> 26 #include <wtf/RefCounted.h> 27 #include <wtf/RefPtr.h> 28 29 #if PLATFORM(ANDROID) && ENABLE(APPLICATION_INSTALLED) 30 #include "PlatformString.h" 31 #endif 32 33 namespace WebCore { 34 35 class DOMMimeTypeArray; 36 class DOMPluginArray; 37 class Frame; 38 class Geolocation; 39 class NavigatorUserMediaErrorCallback; 40 class NavigatorUserMediaSuccessCallback; 41 class PluginData; 42 #if PLATFORM(ANDROID) 43 class ApplicationInstalledCallback; 44 class Connection; 45 #endif 46 47 typedef int ExceptionCode; 48 49 class Navigator : public NavigatorBase, public RefCounted<Navigator> { 50 public: create(Frame * frame)51 static PassRefPtr<Navigator> create(Frame* frame) { return adoptRef(new Navigator(frame)); } 52 virtual ~Navigator(); 53 54 void resetGeolocation(); 55 void disconnectFrame(); frame()56 Frame* frame() const { return m_frame; } 57 58 String appVersion() const; 59 String language() const; 60 DOMPluginArray* plugins() const; 61 DOMMimeTypeArray* mimeTypes() const; 62 bool cookieEnabled() const; 63 bool javaEnabled() const; 64 65 virtual String userAgent() const; 66 67 Geolocation* geolocation() const; 68 // This is used for GC marking. optionalGeolocation()69 Geolocation* optionalGeolocation() const { return m_geolocation.get(); } 70 71 #if PLATFORM(ANDROID) 72 Connection* connection() const; 73 #endif 74 75 #if PLATFORM(ANDROID) && ENABLE(APPLICATION_INSTALLED) 76 bool isApplicationInstalled(const String& name, PassRefPtr<ApplicationInstalledCallback> callback); 77 void onPackageResult(); 78 #endif 79 80 #if ENABLE(DOM_STORAGE) 81 // Relinquishes the storage lock, if one exists. 82 void getStorageUpdates(); 83 #endif 84 85 #if ENABLE(REGISTER_PROTOCOL_HANDLER) 86 void registerProtocolHandler(const String& scheme, const String& url, const String& title, ExceptionCode&); 87 #endif 88 89 #if ENABLE(MEDIA_STREAM) 90 virtual void webkitGetUserMedia(const String& options, PassRefPtr<NavigatorUserMediaSuccessCallback>, 91 PassRefPtr<NavigatorUserMediaErrorCallback> = 0); 92 #endif 93 94 private: 95 Navigator(Frame*); 96 Frame* m_frame; 97 mutable RefPtr<DOMPluginArray> m_plugins; 98 mutable RefPtr<DOMMimeTypeArray> m_mimeTypes; 99 mutable RefPtr<Geolocation> m_geolocation; 100 #if PLATFORM(ANDROID) 101 mutable RefPtr<Connection> m_connection; 102 #endif 103 104 #if PLATFORM(ANDROID) && ENABLE(APPLICATION_INSTALLED) 105 RefPtr<ApplicationInstalledCallback> m_applicationInstalledCallback; 106 String m_applicationNameQuery; 107 #endif 108 }; 109 110 } 111 112 #endif 113