EWebKit  1.0
ewk_context_private.h
1 /*
2  * Copyright (C) 2012 Samsung Electronics
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 ewk_context_private_h
21 #define ewk_context_private_h
22 
23 #include "ewk_context.h"
24 #include "ewk_object_private.h"
25 #include <JavaScriptCore/JSContextRef.h>
26 #include <WebKit/WKBase.h>
27 #include <WebKit/WKRetainPtr.h>
28 #include <wtf/RefPtr.h>
29 #include <wtf/text/WTFString.h>
30 
31 using namespace WebKit;
32 
34 class EwkCookieManager;
35 class EwkFaviconDatabase;
36 
37 namespace WebKit {
38 class ContextHistoryClientEfl;
39 class DownloadManagerEfl;
40 class RequestManagerClientEfl;
41 #if ENABLE(BATTERY_STATUS)
42 class BatteryProvider;
43 #endif
44 }
45 
46 class EwkContext : public EwkObject {
47 public:
48  EWK_OBJECT_DECLARE(EwkContext)
49 
50  static PassRefPtr<EwkContext> findOrCreateWrapper(WKContextRef context);
51  static Ref<EwkContext> create(const String& extensionsPath = String());
52 
53  static EwkContext* defaultContext();
54 
55  ~EwkContext();
56 
57  EwkApplicationCacheManager* applicationCacheManager();
58  EwkCookieManager* cookieManager();
59  EwkDatabaseManager* databaseManager();
60 
61  bool setFaviconDatabaseDirectoryPath(const String& databaseDirectory);
62  EwkFaviconDatabase* faviconDatabase();
63 
64  EwkStorageManager* storageManager() const;
65 
66  WebKit::RequestManagerClientEfl* requestManager();
67 
68  void addVisitedLink(const String& visitedURL);
69 
70  void setCacheModel(Ewk_Cache_Model);
71 
72  Ewk_Cache_Model cacheModel() const;
73 
74  void setProcessCountLimit(unsigned count);
75 
76  unsigned processCountLimit() const;
77 
78  WKContextRef wkContext() const { return m_context.get(); }
79 
80  WebKit::DownloadManagerEfl* downloadManager() const;
81 
82  WebKit::ContextHistoryClientEfl* historyClient();
83 
84  Ewk_TLS_Error_Policy ignoreTLSErrors() const;
85 
86  void setIgnoreTLSErrors(Ewk_TLS_Error_Policy TLSErrorPolicy) const;
87 
88  const String& extensionsPath() const { return m_extensionsPath; }
89 
90  void allowSpecificHTTPSCertificateForHost(const String& pem, const String& host) const;
91 
92 #if ENABLE(NETSCAPE_PLUGIN_API)
93  void setAdditionalPluginPath(const String&);
94 #endif
95 
96  void clearResourceCache();
97 
98  JSGlobalContextRef jsGlobalContext();
99 
100  static void didReceiveMessageFromInjectedBundle(WKContextRef, WKStringRef messageName, WKTypeRef messageBody, const void* clientInfo);
101  static WKTypeRef getInjectedBundleInitializationUserData(WKContextRef, const void* clientInfo);
102  void setMessageFromExtensionCallback(Ewk_Context_Message_From_Extension_Cb, void*);
103  void processReceivedMessageFromInjectedBundle(WKStringRef messageName, WKTypeRef messageBody);
104 
105 private:
106  explicit EwkContext(WKContextRef, const String& extensionsPath = String());
107 
108  void ensureFaviconDatabase();
109  bool isDefaultBundle() const;
110 
111  WKRetainPtr<WKContextRef> m_context;
112 
113  std::unique_ptr<EwkApplicationCacheManager> m_applicationCacheManager;
114  std::unique_ptr<EwkCookieManager> m_cookieManager;
115  std::unique_ptr<EwkDatabaseManager> m_databaseManager;
116  std::unique_ptr<EwkFaviconDatabase> m_faviconDatabase;
117  std::unique_ptr<EwkStorageManager> m_storageManager;
118 #if ENABLE(BATTERY_STATUS)
119  RefPtr<WebKit::BatteryProvider> m_batteryProvider;
120 #endif
121  std::unique_ptr<WebKit::DownloadManagerEfl> m_downloadManager;
122  std::unique_ptr<WebKit::RequestManagerClientEfl> m_requestManagerClient;
123 
124  std::unique_ptr<WebKit::ContextHistoryClientEfl> m_historyClient;
125 
126  JSGlobalContextRef m_jsGlobalContext;
127 
128  String m_extensionsPath;
129  unsigned m_processCountLimit { 0 };
130 
131  struct {
133  void* userData;
134  } m_callbackForMessageFromExtension;
135 };
136 
137 #endif // ewk_context_private_h
Definition: ewk_context_private.h:37
Definition: ewk_database_manager_private.h:38
Ewk_TLS_Error_Policy
Contains option for TLS error policy.
Definition: ewk_context.h:99
Describes the context API.
Definition: ewk_object_private.h:31
Definition: ewk_favicon_database_private.h:51
Definition: ewk_context_private.h:46
Definition: ewk_storage_manager_private.h:36
Definition: ewk_application_cache_manager_private.h:33
void(* Ewk_Context_Message_From_Extension_Cb)(const char *name, const Eina_Value *body, void *user_data)
Definition: ewk_context.h:179
Ewk_Cache_Model
Contains option for cache model.
Definition: ewk_context.h:82