2 * Copyright (c) 2014 Samsung Electronics Co., Ltd.
4 * Licensed under the Apache License, Version 2.0 (the License);
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
8 * http://www.apache.org/licenses/LICENSE-2.0
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an AS IS BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
17 #ifndef WEBKITENGINESERVICE_H_
18 #define WEBKITENGINESERVICE_H_
20 #include <boost/noncopyable.hpp>
25 #include "ServiceFactory.h"
26 #include "service_macros.h"
28 #include "AbstractWebEngine/AbstractWebEngine.h"
29 #include "AbstractWebEngine/TabId.h"
30 #include "AbstractWebEngine/WebConfirmation.h"
31 #include "BrowserImage.h"
33 namespace tizen_browser {
34 namespace basic_webengine {
35 namespace webkitengine_service {
39 typedef std::shared_ptr<WebView> WebViewPtr;
41 class BROWSER_EXPORT WebKitEngineService: public AbstractWebEngine<Evas_Object>, boost::noncopyable
44 WebKitEngineService();
45 virtual ~WebKitEngineService();
46 virtual std::string getName();
48 Evas_Object * getLayout();
49 void init(void * guiParent);
51 void setURI(const std::string &);
52 std::string getURI(void) const;
54 std::string getTitle(void) const;
56 void stopLoading(void);
62 bool isBackEnabled(void) const;
63 bool isForwardEnabled(void) const;
65 bool isLoading() const;
67 void clearPrivateData();
69 int tabsCount() const;
70 TabId currentTabId() const;
71 std::list<TabId> listTabs() const;
72 std::vector<std::shared_ptr<TabContent> > getTabContents() const;
75 * Adds new tab. If uri is specified setURI(uri).
76 * If it first tab in WebEngine switch to this tab.
78 * @return TabId of created tab
80 TabId addTab(const std::string & uri = std::string(), const TabId * openerId = NULL, bool desktopMode = true);
81 Evas_Object* getTabView(TabId id);
82 bool switchToTab(TabId);
87 * Change tab to next created, dummy implementation.
88 * @return true if changed successfully, false otherwise
92 * Change tab to previous created, dummy implementation.
93 * @return true if changed successfully, false otherwise
97 void confirmationResult(WebConfirmationPtr);
100 * @brief Get snapshot of webpage
102 * @param width of snapshot
103 * @param height of snapshot
104 * @return Shared pointer to BrowserImage
106 std::shared_ptr<tizen_browser::tools::BrowserImage> getSnapshotData(int width, int height);
108 std::shared_ptr<tizen_browser::tools::BrowserImage> getSnapshotData(TabId id, int width, int height);
110 void setPrivateMode(bool);
111 bool isPrivateMode() const;
115 * @brief Check if current tab has load error.
118 bool isLoadError() const;
121 * \brief Sets Focus to URI entry.
126 * @brief Remove focus form URI
131 * @brief check if URI is focused
133 bool hasFocus() const;
135 virtual int getZoomFactor() const;
138 * @brief check if autofit is enabled
141 virtual void setZoomFactor(int zoomFactor);
145 * @brief Search string on searchOnWebsite
147 * @param string to search on searchOnWebsite
148 * @param flags for search options
150 void searchOnWebsite(const std::string &, int flags);
153 * @brief Get favicon of current page loaded
155 std::shared_ptr<tizen_browser::tools::BrowserImage> getFavicon();
158 * @brief back or exit when back key is pressed
160 void backButtonClicked() const;
162 void switchToMobileMode();
163 void switchToDesktopMode();
164 bool isDesktopMode() const;
167 // callbacks from WebView
168 void _favIconChanged(std::shared_ptr<tizen_browser::tools::BrowserImage> bi);
169 void _titleChanged(const std::string &);
170 void _uriChanged(const std::string &);
171 void _uriChangedOnTab(TabId);
172 void _loadFinished();
176 void _forwardEnableChanged(bool);
177 void _backwardEnableChanged(bool);
178 void _loadProgress(double);
179 void _confirmationRequest(WebConfirmationPtr) ;
180 void _IMEStateChanged(bool);
181 void webViewClicked();
184 * disconnect signals from specified WebView
187 void disconnectSignals(WebViewPtr);
189 void disconnectCurrentWebViewSignals();
192 * connect signals of specified WebView
195 void connectSignals(WebViewPtr);
203 TabId m_currentTabId;
205 WebViewPtr m_currentWebView;
207 // map of all tabs (WebViews)
208 std::map<TabId, WebViewPtr > m_tabs;
209 // Most recent tab list
210 std::list<TabId> m_mostRecentTab;
211 // recently added tabs first
212 std::list<TabId> m_chronoTabs;
215 } /* end of webkitengine_service */
216 } /* end of basic_webengine */
217 } /* end of tizen_browser */
219 #endif /* WEBKITENGINESERVICE_H_ */