Create string tightly when retrive string from cbhm callback event
[framework/web/webkit-efl.git] / Source / WebKit2 / UIProcess / API / efl / 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 "DownloadManagerEfl.h"
24 #include "WKAPICast.h"
25 #include "WKRetainPtr.h"
26 #include "ewk_context.h"
27
28 #if OS(TIZEN)
29 #include "WKEinaSharedString.h"
30 #include "WKString.h"
31 #include "ewk_context.h"
32 #if ENABLE(TIZEN_SUPPORT)
33 #include "ewk_security_origin.h"
34 #endif
35
36 #if ENABLE(TIZEN_WEBKIT2_CONTEXT_X_WINDOW)
37 #ifdef HAVE_ECORE_X
38 #include <Ecore_X.h>
39 #endif
40 #endif
41
42 #if ENABLE(TIZEN_WEBKIT2_FORM_DATABASE)
43 #include "FormDatabase.h"
44 #endif
45 #endif // #if OS(TIZEN)
46
47 class Ewk_Url_Scheme_Request;
48 class Ewk_Cookie_Manager;
49 class Ewk_Favicon_Database;
50 #if ENABLE(BATTERY_STATUS)
51 class BatteryProvider;
52 #endif
53 #if ENABLE(NETWORK_INFO)
54 class NetworkInfoProvider;
55 #endif
56 #if ENABLE(VIBRATION)
57 class VibrationProvider;
58 #endif
59
60 namespace WebKit {
61 class ContextHistoryClientEfl;
62 class RequestManagerClientEfl;
63 }
64
65 class Ewk_Context : public RefCounted<Ewk_Context> {
66 public:
67     static PassRefPtr<Ewk_Context> create(WKContextRef context);
68     static PassRefPtr<Ewk_Context> create();
69     static PassRefPtr<Ewk_Context> create(const String& injectedBundlePath);
70
71     static PassRefPtr<Ewk_Context> defaultContext();
72
73     ~Ewk_Context();
74
75     Ewk_Cookie_Manager* cookieManager();
76
77     Ewk_Favicon_Database* faviconDatabase();
78
79     WebKit::RequestManagerClientEfl* requestManager();
80
81 #if ENABLE(VIBRATION)
82     PassRefPtr<VibrationProvider> vibrationProvider();
83 #endif
84
85     void addVisitedLink(const String& visitedURL);
86
87     void setCacheModel(Ewk_Cache_Model);
88
89     Ewk_Cache_Model cacheModel() const;
90
91     WKContextRef wkContext();
92
93     void urlSchemeRequestReceived(Ewk_Url_Scheme_Request*);
94
95     WebKit::DownloadManagerEfl* downloadManager() const;
96
97     WebKit::ContextHistoryClientEfl* historyClient();
98
99 #if OS(TIZEN)
100     const char* proxyAddress() const { return m_proxyAddress; }
101     bool setProxyAddress(const char*);
102
103 #if ENABLE(TIZEN_CERTIFICATE_HANDLING)
104     const char* certificateFile() const { return m_certificateFile; }
105     bool setCertificateFile(const char*);
106 #endif
107
108 #if ENABLE(TIZEN_SQL_DATABASE)
109     uint64_t defaultDatabaseQuota() const { return m_defaultDatabaseQuota; }
110     void setDefaultDatabaseQuota(uint64_t);
111 #endif
112
113     void setMessageFromInjectedBundleCallback(Ewk_Context_Message_From_Injected_Bundle_Callback, void*);
114     void didReceiveMessageFromInjectedBundle(WKStringRef, WKTypeRef, WKTypeRef*);
115
116     void setDidStartDownloadCallback(Ewk_Context_Did_Start_Download_Callback, void*);
117     void didStartDownload(WKStringRef);
118
119 #if ENABLE(TIZEN_CACHE_MEMORY_OPTIMIZATION)
120     void clearAllDecodedData();
121 #endif
122
123 #if ENABLE(TIZEN_WEBKIT2_CONTEXT_X_WINDOW)
124     Ecore_X_Window xWindow();
125     void setXWindow(Ecore_X_Window);
126 #endif
127
128 #if ENABLE(TIZEN_WEBKIT2_FORM_DATABASE)
129     void addFormData(const char*, WKDictionaryRef&, bool);
130     void passwordFormData(const char*, Vector<std::pair<String, String> >&);
131     void candidateFormData(const String&, Vector<String>&);
132     void clearPasswordFormData();
133     void clearCandidateFormData();
134 #endif
135
136 #if ENABLE(TIZEN_CACHE_DUMP_SYNC)
137     void dumpCache();
138 #endif
139 #endif // #if OS(TIZEN)
140
141 private:
142     explicit Ewk_Context(WKContextRef);
143
144     WKRetainPtr<WKContextRef> m_context;
145
146     OwnPtr<Ewk_Cookie_Manager> m_cookieManager;
147     OwnPtr<Ewk_Favicon_Database> m_faviconDatabase;
148 #if ENABLE(BATTERY_STATUS)
149     RefPtr<BatteryProvider> m_batteryProvider;
150 #endif
151 #if ENABLE(NETWORK_INFO)
152     RefPtr<NetworkInfoProvider> m_networkInfoProvider;
153 #endif
154 #if ENABLE(VIBRATION)
155     RefPtr<VibrationProvider> m_vibrationProvider;
156 #endif
157     OwnPtr<WebKit::DownloadManagerEfl> m_downloadManager;
158     OwnPtr<WebKit::RequestManagerClientEfl> m_requestManagerClient;
159
160     OwnPtr<WebKit::ContextHistoryClientEfl> m_historyClient;
161
162 #if OS(TIZEN)
163     WKEinaSharedString m_proxyAddress;
164 #if ENABLE(TIZEN_CERTIFICATE_HANDLING)
165     WKEinaSharedString m_certificateFile;
166 #endif
167 #if ENABLE(TIZEN_SQL_DATABASE)
168     uint64_t m_defaultDatabaseQuota;
169 #endif
170     struct {
171         Ewk_Context_Message_From_Injected_Bundle_Callback callback;
172         void* userData;
173     } m_messageFromInjectedBundle;
174     struct {
175         Ewk_Context_Did_Start_Download_Callback callback;
176         void* userData;
177     } m_didStartDownload;
178 #if ENABLE(TIZEN_WEBKIT2_CONTEXT_X_WINDOW)
179     Ecore_X_Window m_xWindow;
180 #endif
181 #if ENABLE(TIZEN_WEBKIT2_FORM_DATABASE)
182     RefPtr<WebKit::FormDatabase> m_formDatabase;
183 #endif
184 #endif
185 };
186
187 #if OS(TIZEN)
188 Ewk_Security_Origin* createSecurityOrigin(WKSecurityOriginRef securityOrigin);
189 void deleteSecurityOrigin(Ewk_Security_Origin* origin);
190 #endif
191
192 #endif // ewk_context_private_h