Home | History | Annotate | Download | only in page
      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 "PlatformString.h"
     25 #include <wtf/PassRefPtr.h>
     26 #include <wtf/RefCounted.h>
     27 #include <wtf/RefPtr.h>
     28 
     29 namespace WebCore {
     30 
     31     class Frame;
     32     class Geolocation;
     33     class MimeTypeArray;
     34     class PluginData;
     35     class PluginArray;
     36 #if PLATFORM(ANDROID)
     37     class ApplicationInstalledCallback;
     38     class Connection;
     39 #endif
     40 
     41 
     42     typedef int ExceptionCode;
     43 
     44     class Navigator : public NavigatorBase, public RefCounted<Navigator> {
     45     public:
     46         static PassRefPtr<Navigator> create(Frame* frame) { return adoptRef(new Navigator(frame)); }
     47         ~Navigator();
     48 
     49         void disconnectFrame();
     50         Frame* frame() const { return m_frame; }
     51 
     52         String appVersion() const;
     53         String language() const;
     54         PluginArray* plugins() const;
     55         MimeTypeArray* mimeTypes() const;
     56         bool cookieEnabled() const;
     57         bool javaEnabled() const;
     58 
     59         virtual String userAgent() const;
     60 
     61         Geolocation* geolocation() const;
     62         // This is used for GC marking.
     63         Geolocation* optionalGeolocation() const { return m_geolocation.get(); }
     64 
     65 #if PLATFORM(ANDROID)
     66         Connection* connection() const;
     67 #endif
     68 
     69 #if PLATFORM(ANDROID) && ENABLE(APPLICATION_INSTALLED)
     70         bool isApplicationInstalled(const String& name, PassRefPtr<ApplicationInstalledCallback> callback);
     71         void onPackageResult();
     72 #endif
     73 
     74 #if ENABLE(DOM_STORAGE)
     75         // Relinquishes the storage lock, if one exists.
     76         void getStorageUpdates();
     77 #endif
     78 
     79         void registerProtocolHandler(const String& scheme, const String& url, const String& title, ExceptionCode& ec);
     80         void registerContentHandler(const String& mimeType, const String& url, const String& title, ExceptionCode& ec);
     81 
     82     private:
     83         Navigator(Frame*);
     84         Frame* m_frame;
     85         mutable RefPtr<PluginArray> m_plugins;
     86         mutable RefPtr<MimeTypeArray> m_mimeTypes;
     87         mutable RefPtr<Geolocation> m_geolocation;
     88 #if PLATFORM(ANDROID)
     89         mutable RefPtr<Connection> m_connection;
     90 #endif
     91 
     92 #if PLATFORM(ANDROID) && ENABLE(APPLICATION_INSTALLED)
     93         RefPtr<ApplicationInstalledCallback> m_applicationInstalledCallback;
     94         String m_applicationNameQuery;
     95 #endif
     96     };
     97 
     98 }
     99 
    100 #endif
    101