*/
virtual int getZoomFactor()const = 0;
-
/**
* @brief Sets zoom factor in percentage
*
*/
virtual void backButtonClicked() = 0;
-#if PROFILE_MOBILE
/**
* @brief clear text selection or exit full screen when more key is pressed
*/
virtual void moreKeyPressed() = 0;
-#endif
/**
* @brief Switch current view to mobile mode
boost::signals2::signal<void (std::string)> iconDownload;
#endif
-#if PROFILE_MOBILE
/**
* Register H/W back key callback for the current webview
*/
*/
boost::signals2::signal<int()> getRotation;
+ /**
+ Async signal to inform browser to finish rotation.
+ */
+ boost::signals2::signal<void ()> rotatePrepared;
+
/**
* Unsecure connection to https host, do not even ask to confirm, just inform.
*/
boost::signals2::signal<void()> unsecureConnection;
-#endif
};
} /* end of basic_webengine */
const std::string ResetBrowserPopupMsg = "Do you really want to reset Browser?" \
" If you press Reset, delete all data" \
" and return to initial setting.";
-const int SCALE_FACTOR =
-#if PROFILE_MOBILE
- 720;
-#else
- 1920;
-#endif
+const int SCALE_FACTOR = 720;
SimpleUI::SimpleUI()
: AbstractMainWindow()
#if PWA
, m_pwa()
#endif
+ , m_manualRotation(false)
, m_current_angle(0)
, m_temp_angle(0)
{
elm_win_resize_object_add(main_window, m_viewManager.getConformant());
evas_object_show(main_window);
-#if PROFILE_MOBILE
+
if (elm_win_wm_rotation_supported_get(main_window)) {
rotationType(rotationLock::noLock);
evas_object_smart_callback_add(main_window, "wm,rotation,changed", __orientation_changed, this);
+ enableManualRotation(false);
} else
BROWSER_LOGW("[%s:%d] Device does not support rotation.", __PRETTY_FUNCTION__, __LINE__);
// determine if keyboard has been shown. I think it is possible to unify it with below callbacks.
evas_object_smart_callback_add(m_viewManager.getConformant(), "virtualkeypad,state,on", onUrlIMEOpened, this);
evas_object_smart_callback_add(m_viewManager.getConformant(), "virtualkeypad,state,off",onUrlIMEClosed, this);
-#endif
}
SimpleUI::~SimpleUI() {
}
m_webEngine->preinitializeWebViewCache();
m_webEngine->resume();
-#if PROFILE_MOBILE
if (m_findOnPageUI && m_findOnPageUI->isVisible())
m_findOnPageUI->show_ime();
-#endif
}
void SimpleUI::destroyUI()
initModelServices();
//Push first view to stack.
- m_viewManager.pushViewToStack(m_webPageUI.get());
+ pushViewToStack(m_webPageUI.get());
// Register H/W back key callback
m_platformInputManager->registerHWKeyCallback(m_viewManager.getContent());
m_webPageUI->unfocusWebView.connect(boost::bind(&basic_webengine::AbstractWebEngine::clearFocus, m_webEngine.get()));
m_webPageUI->bookmarkManagerClicked.connect(boost::bind(&SimpleUI::showBookmarkManagerUI, this,
m_favoriteService->getRoot(), BookmarkManagerState::Default));
+ m_webPageUI->updateManualRotation.connect([this](){enableManualRotation(isManualRotation(m_viewManager.topOfStack()));});
m_webPageUI->getWindow.connect(boost::bind(&SimpleUI::getMainWindow, this));
m_webPageUI->isBookmark.connect(boost::bind(&SimpleUI::checkBookmark, this));
m_webPageUI->deleteBookmark.connect(boost::bind(&SimpleUI::deleteBookmark, this));
m_webEngine->createTabId.connect(boost::bind(&SimpleUI::onCreateTabId, this));
m_webEngine->snapshotCaptured.connect(boost::bind(&SimpleUI::onSnapshotCaptured, this, _1, _2));
m_webEngine->redirectedWebPage.connect(boost::bind(&SimpleUI::redirectedWebPage, this, _1, _2));
+ m_webEngine->rotatePrepared.connect(boost::bind(&SimpleUI::rotatePrepared, this));
m_webEngine->switchToQuickAccess.connect(boost::bind(&SimpleUI::switchViewToQuickAccess, this));
m_webEngine->setCertificatePem.connect(boost::bind(&services::CertificateContents::saveCertificateInfo, m_certificateContents, _1, _2));
m_webEngine->setWrongCertificatePem.connect(boost::bind(&services::CertificateContents::saveWrongCertificateInfo, m_certificateContents, _1, _2));
m_certificateContents->init();
}
-#if PROFILE_MOBILE
+void SimpleUI::pushViewToStack(interfaces::AbstractUIComponent* view)
+{
+ m_viewManager.pushViewToStack(view);
+ enableManualRotation(isManualRotation(view));
+}
+
+void SimpleUI::popTheStack()
+{
+ m_viewManager.popTheStack();
+ enableManualRotation(isManualRotation(m_viewManager.topOfStack()));
+}
+
+void SimpleUI::popStackTo(interfaces::AbstractUIComponent* view)
+{
+ m_viewManager.popStackTo(view);
+ enableManualRotation(isManualRotation(view));
+}
+
void SimpleUI::registerHWKeyCallback()
{
BROWSER_LOGD("[%s:%d] ", __PRETTY_FUNCTION__, __LINE__);
BROWSER_LOGD("[%s:%d] ", __PRETTY_FUNCTION__, __LINE__);
m_platformInputManager->unregisterHWKeyCallback(m_webEngine->getLayout());
}
-#endif
-
void SimpleUI::switchViewToWebPage()
{
m_webPageUI->switchViewToQuickAccess(m_quickAccess->getContent());
m_webEngine->disconnectCurrentWebViewSignals();
- m_viewManager.popStackTo(m_webPageUI.get());
+ popStackTo(m_webPageUI.get());
}
void SimpleUI::switchViewToIncognitoPage()
{
BROWSER_LOGD("[%s:%d] ", __PRETTY_FUNCTION__, __LINE__);
m_webPageUI->switchViewToIncognitoPage();
- m_viewManager.popStackTo(m_webPageUI.get());
+ popStackTo(m_webPageUI.get());
}
void SimpleUI::openNewTab(const std::string &uri, const std::string& title,
{
BROWSER_LOGD("[%s:%d] ", __PRETTY_FUNCTION__, __LINE__);
if (m_webPageUI) {
- m_viewManager.popStackTo(m_webPageUI.get());
+ popStackTo(m_webPageUI.get());
if (tabsCount() == 0 || m_webPageUI->stateEquals(WPUState::QUICK_ACCESS))
openNewTab(url, title, boost::none, desktopMode, false, basic_webengine::TabOrigin::QUICKACCESS);
else {
m_webPageUI->getURIEntry().clearFocus();
closeBookmarkManagerUI();
}
- m_viewManager.popStackTo(m_webPageUI.get());
+ popStackTo(m_webPageUI.get());
}
}
m_bookmarkFlowUI->setState(true);
m_bookmarkFlowUI->setTitle(bookmarkItem->getTitle());
m_bookmarkFlowUI->setFolder(m_favoriteService->getBookmarkItem(bookmarkItem->getParent()));
- m_viewManager.pushViewToStack(m_bookmarkFlowUI.get());
+ pushViewToStack(m_bookmarkFlowUI.get());
}
}
showQuickAccess();
}
-#if PROFILE_MOBILE
void SimpleUI::onDeleteFolderClicked(const std::string& folder_name)
{
BROWSER_LOGD("[%s:%d] ", __PRETTY_FUNCTION__, __LINE__);
self->m_webPageUI->showBottomBar(true);
self->setwvIMEStatus(false);
}
-#endif
void SimpleUI::onSnapshotCaptured(std::shared_ptr<tools::BrowserImage> snapshot, tools::SnapshotType snapshot_type)
{
void SimpleUI::onBackPressed()
{
BROWSER_LOGD("[%s:%d] ", __PRETTY_FUNCTION__, __LINE__);
-#if PROFILE_MOBILE
if (m_findOnPageUI->isVisible())
closeFindOnPageUI();
else
-#else
- if (m_zoomUI->isVisible()) {
- m_zoomUI->escapeZoom();
- } else
-#endif
if (m_wvIMEStatus) { // if IME opened
return;
} else if (m_popupVector.size() > 0) {
} else if (m_viewManager.topOfStack() == m_settingsUI.get()) {
closeSettingsUI();
} else {
- m_viewManager.popTheStack();
+ popTheStack();
}
}
}
}
-#if !PROFILE_MOBILE
-void SimpleUI::onEscapePressed()
-{
- BROWSER_LOGD("[%s]", __func__);
- m_zoomUI->escapeZoom();
-}
-#else
void SimpleUI::onMenuButtonPressed()
{
BROWSER_LOGD("[%s:%d] ", __PRETTY_FUNCTION__, __LINE__);
view->showContextMenu();
}
+bool SimpleUI::isManualRotation(interfaces::AbstractUIComponent* view)
+{
+ WebPageUI *webPageUI = dynamic_cast<WebPageUI *>(view);
+ return (webPageUI && webPageUI->stateEquals(WPUState::MAIN_WEB_PAGE));
+}
+
+void SimpleUI::enableManualRotation(bool enable)
+{
+ m_manualRotation = enable;
+ BROWSER_LOGD("[%s:%d]: %d", __PRETTY_FUNCTION__, __LINE__, m_manualRotation);
+ elm_win_wm_rotation_manual_rotation_done_set(main_window,
+ m_manualRotation ? EINA_TRUE : EINA_FALSE);
+}
+
+void SimpleUI::rotatePrepared()
+{
+ BROWSER_LOGD("[%s:%d] ", __PRETTY_FUNCTION__, __LINE__);
+ if (m_manualRotation && elm_win_wm_rotation_manual_rotation_done_get(main_window)) {
+ elm_win_wm_rotation_manual_rotation_done(main_window);
+ m_webPageUI->orientationChanged();
+ }
+}
+
void SimpleUI::onRotation()
{
BROWSER_LOGD("[%s:%d] ", __PRETTY_FUNCTION__, __LINE__);
m_current_angle = m_temp_angle;
- elm_win_rotation_with_resize_set(main_window, m_current_angle);
- m_bookmarkFlowUI->orientationChanged();
- m_settingsUI->orientationChanged();
- m_bookmarkManagerUI->orientationChanged();
- m_webPageUI->orientationChanged();
- m_tabUI->orientationChanged();
m_webEngine->orientationChanged();
- if (!m_popupVector.empty())
- m_popupVector.back()->orientationChanged();
+ if (!m_manualRotation) {
+ m_bookmarkFlowUI->orientationChanged();
+ m_settingsUI->orientationChanged();
+ m_bookmarkManagerUI->orientationChanged();
+ m_webPageUI->orientationChanged();
+ m_tabUI->orientationChanged();
+
+ if (!m_popupVector.empty())
+ m_popupVector.back()->orientationChanged();
+ }
}
void SimpleUI::__orientation_changed(void* data, Evas_Object*, void*)
elm_win_wm_rotation_available_rotations_set( main_window, const_cast<const int*>(rots), size);
}
-#endif
-
Evas_Object* SimpleUI::getMainWindow()
{
return main_window;
{
BROWSER_LOGD("[%s:%d] ", __PRETTY_FUNCTION__, __LINE__);
m_webPageUI->loadStarted();
-#if PROFILE_MOBILE
if (m_findOnPageUI->isVisible())
closeFindOnPageUI();
-#endif
}
void SimpleUI::progressChanged(double progress)
m_webPageUI->getUrlHistoryList()->onURLEntryEditedByUser(editedUrl, result);
}
-#if !PROFILE_MOBILE
-void SimpleUI::onRedKeyPressed()
-{
- m_webPageUI->onRedKeyPressed();
-}
-
-void SimpleUI::onYellowKeyPressed()
-{
- m_webPageUI->onYellowKeyPressed();
-}
-
-void SimpleUI::showZoomUI()
-{
- BROWSER_LOGD("[%s:%d] ", __PRETTY_FUNCTION__, __LINE__);
- if(! m_webPageUI->stateEquals(WPUState::QUICK_ACCESS)) {
- m_viewManager.popStackTo(m_webPageUI.get());
- m_webPageUI->showTabUI.connect(boost::bind(&SimpleUI::closeZoomUI, this));
- m_zoomUI->show(m_window.get());
- }
-}
-
-void SimpleUI::closeZoomUI()
-{
- M_ASSERT(m_zoomUI);
- m_zoomUI->hideUI();
-}
-
-void SimpleUI::setZoomFactor(int level)
-{
- BROWSER_LOGD("[%s:%d]", __PRETTY_FUNCTION__, __LINE__);
- m_webEngine->setZoomFactor(level);
-}
-
-int SimpleUI::getZoomFactor()
-{
- BROWSER_LOGD("[%s:%d] %d", __PRETTY_FUNCTION__, __LINE__, m_webEngine->getZoomFactor());
- return m_webEngine->getZoomFactor();
-}
-#endif
-
void SimpleUI::scrollView(const int& dx, const int& dy)
{
m_webEngine->scrollView(dx, dy);
}
-#if PROFILE_MOBILE
void SimpleUI::showFindOnPageUI(const std::string& str)
{
BROWSER_LOGD("[%s:%d] ", __PRETTY_FUNCTION__, __LINE__);
if (m_findOnPageUI)
m_findOnPageUI->hideUI();
}
-#endif
void SimpleUI::showTabUI()
{
BROWSER_LOGD("[%s:%d] ", __PRETTY_FUNCTION__, __LINE__);
- m_viewManager.pushViewToStack(m_tabUI.get());
+ pushViewToStack(m_tabUI.get());
if (!m_webPageUI->stateEquals(WPUState::QUICK_ACCESS) &&
m_webEngine->tabsCount() > 0 &&
{
BROWSER_LOGD("[%s:%d] ", __PRETTY_FUNCTION__, __LINE__);
if (m_viewManager.topOfStack() == m_tabUI.get())
- m_viewManager.popTheStack();
+ popTheStack();
}
void SimpleUI::refetchTabUIData() {
{
BROWSER_LOGD("[%s:%d] ", __PRETTY_FUNCTION__, __LINE__);
switchToTab(tabId);
- m_viewManager.popStackTo(m_webPageUI.get());
+ popStackTo(m_webPageUI.get());
}
void SimpleUI::closeTabsClicked(const tizen_browser::basic_webengine::TabId& tabId)
return m_webEngine->tabsCount();
}
-#if PROFILE_MOBILE
void SimpleUI::handleConfirmationRequest(basic_webengine::WebConfirmationPtr webConfirmation)
{
BROWSER_LOGD("[%s:%d] ", __PRETTY_FUNCTION__, __LINE__);
popup->popupDismissed.connect(boost::bind(&SimpleUI::dismissPopup, this, _1));
popup->show();
}
-#endif
void SimpleUI::certPopupButtonClicked(PopupButtons button, std::shared_ptr<PopupData> popupData)
{
break;
case VIEW_CERTIFICATE:
{
-#if PROFILE_MOBILE
showCertificatePopup(certPopupData->cert->getURI(), certPopupData->cert->getPem(), services::CertificateContents::UNSECURE_HOST_UNKNOWN);
-#endif
break;
}
default:
{
BROWSER_LOGD("[%s:%d] ", __PRETTY_FUNCTION__, __LINE__);
if (m_viewManager.topOfStack() == m_historyUI.get())
- m_viewManager.popTheStack();
+ popTheStack();
}
void SimpleUI::showSettings(unsigned s)
BROWSER_LOGD("[%s:%d] ", __PRETTY_FUNCTION__, __LINE__);
m_settingsManager->init(m_viewManager.getContent());
m_settingsUI = m_settingsManager->getView(static_cast<SettingsMainOptions>(s));
- m_viewManager.pushViewToStack(m_settingsUI.get());
+ pushViewToStack(m_settingsUI.get());
}
void SimpleUI::closeSettingsUI()
{
BROWSER_LOGD("[%s:%d] ", __PRETTY_FUNCTION__, __LINE__);
- m_viewManager.popTheStack();
+ popTheStack();
}
void SimpleUI::onDefSearchEngineClicked()
BROWSER_LOGD("[%s:%d] ", __PRETTY_FUNCTION__, __LINE__);
if (!m_webPageUI->stateEquals(WPUState::QUICK_ACCESS)) {
m_webEngine->switchToMobileMode();
- m_viewManager.popStackTo(m_webPageUI.get());
+ popStackTo(m_webPageUI.get());
m_webEngine->reload();
} else {
m_quickAccess->setDesktopMode(false);
{
BROWSER_LOGD("[%s:%d] ", __PRETTY_FUNCTION__, __LINE__);
m_quickAccess->editQuickAccess();
- m_viewManager.pushViewToStack(m_webPageUI->getQuickAccessEditUI().get());
+ pushViewToStack(m_webPageUI->getQuickAccessEditUI().get());
}
void SimpleUI::addQuickAccess()
m_bookmarkFlowUI->setFolder(m_favoriteService->getRoot());
}
- m_viewManager.pushViewToStack(m_bookmarkFlowUI.get());
+ pushViewToStack(m_bookmarkFlowUI.get());
}
void SimpleUI::closeBookmarkFlowUI()
{
BROWSER_LOGD("[%s:%d] ", __PRETTY_FUNCTION__, __LINE__);
if (m_viewManager.topOfStack() == m_bookmarkFlowUI.get())
- m_viewManager.popTheStack();
+ popTheStack();
}
void SimpleUI::showBookmarkManagerUI(std::shared_ptr<services::BookmarkItem> parent,
{
BROWSER_LOGD("[%s:%d]", __PRETTY_FUNCTION__, __LINE__);
m_bookmarkManagerUI->setState(state);
- m_viewManager.pushViewToStack(m_bookmarkManagerUI.get());
+ pushViewToStack(m_bookmarkManagerUI.get());
m_bookmarkManagerUI->addBookmarkItems(parent,
m_favoriteService->getAllBookmarkItems(parent->getId()));
}
stateString.erase(it, Translations::CurrentPage.length());
}
auto url = m_webPageUI->getURIEntry().rewriteURI(stateString);
- m_viewManager.popStackTo(m_webPageUI.get());
+ popStackTo(m_webPageUI.get());
openNewTab(url);
}
{
BROWSER_LOGD("[%s:%d] ", __PRETTY_FUNCTION__, __LINE__);
if (m_viewManager.topOfStack() == m_bookmarkManagerUI.get())
- m_viewManager.popTheStack();
+ popTheStack();
}
void SimpleUI::settingsDeleteSelectedData(const std::map<SettingsDelPersDataOptions, bool>& options)
}
}
if (isSelected) {
-#if PROFILE_MOBILE
TextPopup* popup = TextPopup::createPopup(m_viewManager.getContent());
popup->addButton(OK);
popup->addButton(CANCEL);
-#else
- SimplePopup* popup = SimplePopup::createPopup(m_viewManager.getContent());
- popup->addButton(OK);
- popup->addButton(CANCEL);
-#endif
popup->buttonClicked.connect(boost::bind(&SimpleUI::onDeleteSelectedDataButton, this, _1, options));
popup->setTitle("Delete");
popup->setMessage("The selected web browsing data will be deleted.");
}
}
-#if PROFILE_MOBILE
void SimpleUI::tabLimitPopupButtonClicked(PopupButtons button)
-#else
-void SimpleUI::tabLimitPopupButtonClicked(PopupButtons button, std::shared_ptr< PopupData > /*popupData */)
-#endif
{
if (button == CLOSE_TAB) {
BROWSER_LOGD("[%s]: CLOSE TAB", __func__);
int tabs = m_webEngine->tabsCount();
if (tabs >= m_tabLimit) {
-#if PROFILE_MOBILE
TextPopup* popup = TextPopup::createPopup(m_viewManager.getContent());
popup->addButton(OK);
popup->buttonClicked.connect(boost::bind(&SimpleUI::tabLimitPopupButtonClicked, this, _1));
-#else
- SimplePopup *popup = SimplePopup::createPopup(m_viewManager.getContent());
- popup->addButton(OK);
- popup->buttonClicked.connect(boost::bind(&SimpleUI::tabLimitPopupButtonClicked, this, _1, _2));
-#endif
popup->setTitle(_("Maximum tab count reached"));
popup->setMessage("Close other tabs to open another new tab");
popup->popupShown.connect(boost::bind(&SimpleUI::showPopup, this, _1));
void SimpleUI::showPasswordUI()
{
BROWSER_LOGD("[%s:%d] ", __PRETTY_FUNCTION__, __LINE__);
- m_viewManager.pushViewToStack(&(m_tabUI->getPasswordUI()));
+ pushViewToStack(&(m_tabUI->getPasswordUI()));
}
void SimpleUI::closeTopView()
{
BROWSER_LOGD("[%s:%d] ", __PRETTY_FUNCTION__, __LINE__);
- m_viewManager.popTheStack();
+ popTheStack();
}
void SimpleUI::onFirstSecretMode()
void initModelServices();
void initUIServices();
void connectModelSignals();
+ void pushViewToStack(interfaces::AbstractUIComponent* view);
+ void popTheStack();
+ void popStackTo(interfaces::AbstractUIComponent* view);
void faviconChanged(tools::BrowserImagePtr favicon);
void restoreLastSession();
Evas_Object* createWebLayout(Evas_Object* parent);
void windowCreated();
void minimizeBrowser();
-#if PROFILE_MOBILE
void openNewTab(const std::string &uri, const std::string& title =
std::string(), const boost::optional<int> adaptorId = boost::none,
bool desktopMode = false, bool incognitoMode = false,
basic_webengine::TabOrigin origin = basic_webengine::TabOrigin::UNKNOWN);
-#else
- void openNewTab(const std::string &uri, const std::string& title =
- std::string(), const boost::optional<int> adaptorId = boost::none,
- bool desktopMode = true, bool incognitoMode = false,
- basic_webengine::TabOrigin origin = basic_webengine::TabOrigin::UNKNOWN);
-#endif
void switchToTab(const tizen_browser::basic_webengine::TabId& tabId);
void newTabClicked();
void onBookmarkDeleted(std::shared_ptr<tizen_browser::services::BookmarkItem> bookmarkItem);
void onNewFolderClicked(int parent);
void onNewFolderPopupClick(const std::string& folder_name, int parent);
-#if PROFILE_MOBILE
void onDeleteFolderClicked(const std::string& folder_name);
void onRemoveFoldersClicked(std::vector<std::shared_ptr<services::BookmarkItem>> items);
void onEditFolderPopupClicked(const std::string& newName, std::shared_ptr<services::BookmarkItem> item);
void onDeleteFolderPopupClicked(PopupButtons button);
static void onUrlIMEOpened(void* data, Evas_Object*, void*);
static void onUrlIMEClosed(void* data, Evas_Object*, void*);
-#endif
void onHistoryRemoved(const std::string& uri);
void onOpenURL(std::shared_ptr<tizen_browser::services::HistoryItem> historyItem, bool desktopMode);
void certPopupButtonClicked(PopupButtons button, std::shared_ptr<PopupData> popupData);
void onActionTriggered(const Action& action);
-#if PROFILE_MOBILE
void onMenuButtonPressed();
void handleConfirmationRequest(basic_webengine::WebConfirmationPtr webConfirmation);
-#else
- void onRedKeyPressed();
- void onYellowKeyPressed();
-#endif
void setwvIMEStatus(bool status);
sharedAction m_showBookmarkManagerUI;
void settingsOverrideUseragent(const std::string& userAgent);
void onOverrideUseragentButton(const std::string& newUA);
-#if !PROFILE_MOBILE
- /**
- * @brief show Zoom Menu
- */
- void showZoomUI();
- void closeZoomUI();
- void setZoomFactor(int level);
- int getZoomFactor();
-#endif
void scrollView(const int& dx, const int& dy);
void showTabUI();
void registerHWKeyCallback();
void unregisterHWKeyCallback();
+ bool isManualRotation(interfaces::AbstractUIComponent* view);
+ void enableManualRotation(bool enable);
+ void rotatePrepared();
void onRotation();
bool isLandscape();
int getRotation();
void onDeleteSelectedDataButton(const PopupButtons& button, const std::map<SettingsDelPersDataOptions, bool>& options);
void onDeleteMostVisitedButton(std::shared_ptr<PopupData> popupData);
void onResetBrowserButton(PopupButtons button, std::shared_ptr<PopupData> popupData);
-#if PROFILE_MOBILE
void tabLimitPopupButtonClicked(PopupButtons button);
-#else
- void tabLimitPopupButtonClicked(PopupButtons button, std::shared_ptr< PopupData > /*popupData*/);
- void onEscapePressed();
-#endif
int tabsCount();
void onReturnPressed(MenuButton *m);
services::TabServicePtr m_tabService;
std::shared_ptr<BookmarkFlowUI> m_bookmarkFlowUI;
-#if PROFILE_MOBILE
std::shared_ptr<FindOnPageUI> m_findOnPageUI;
-#else
- std::shared_ptr<tizen_browser::base_ui::ZoomUI> m_zoomUI;
-#endif
std::shared_ptr<services::CertificateContents> m_certificateContents;
std::shared_ptr<BookmarkManagerUI> m_bookmarkManagerUI;
std::shared_ptr<QuickAccess> m_quickAccess;
#endif
SharedNaviframeWrapper m_QAEditNaviframe;
Evas_Object *m_conformant;
+ bool m_manualRotation;
int m_current_angle;
int m_temp_angle;
bool m_isSessionRestored;
m_stateStruct->mostRecentTab.clear();
m_stateStruct->tabs.clear();
-#if PROFILE_MOBILE
// init settings
m_settings[WebEngineSettings::PAGE_OVERVIEW] = boost::any_cast<bool>(tizen_browser::config::Config::getInstance().get(CONFIG_KEY::WEB_ENGINE_PAGE_OVERVIEW));
m_settings[WebEngineSettings::LOAD_IMAGES] = boost::any_cast<bool>(tizen_browser::config::Config::getInstance().get(CONFIG_KEY::WEB_ENGINE_LOAD_IMAGES));
m_settings[WebEngineSettings::REMEMBER_PASSWORDS] = boost::any_cast<bool>(tizen_browser::config::Config::getInstance().get(CONFIG_KEY::WEB_ENGINE_REMEMBER_PASSWORDS));
m_settings[WebEngineSettings::AUTOFILL_PROFILE_DATA] = boost::any_cast<bool>(tizen_browser::config::Config::getInstance().get(CONFIG_KEY::WEB_ENGINE_AUTOFILL_PROFILE_DATA));
m_settings[WebEngineSettings::SCRIPTS_CAN_OPEN_PAGES] = boost::any_cast<bool>(tizen_browser::config::Config::getInstance().get(CONFIG_KEY::WEB_ENGINE_SCRIPTS_CAN_OPEN_PAGES));
-#endif
}
WebEngineService::~WebEngineService()
#if PWA
webView->iconDownload.connect(boost::bind(&WebEngineService::_iconDownload, this, _1));
#endif
-#if PROFILE_MOBILE
webView->getRotation.connect(boost::bind(&WebEngineService::_getRotation, this));
+ webView->rotatePrepared.connect([this](){rotatePrepared();});
webView->unsecureConnection.connect(boost::bind(&WebEngineService::_unsecureConnection, this));
webView->findOnPage.connect(boost::bind(&WebEngineService::_findOnPage, this, _1));
-#endif
}
void WebEngineService::disconnectSignals(std::shared_ptr<WebView> webView)
#if PWA
webView->iconDownload.disconnect(boost::bind(&WebEngineService::_iconDownload, this));
#endif
-#if PROFILE_MOBILE
webView->getRotation.disconnect(boost::bind(&WebEngineService::_getRotation, this));
+ webView->rotatePrepared.disconnect_all_slots();
webView->unsecureConnection.disconnect(boost::bind(&WebEngineService::_unsecureConnection, this));
webView->findOnPage.disconnect(boost::bind(&WebEngineService::_findOnPage, this, _1));
-#endif
}
void WebEngineService::disconnectCurrentWebViewSignals()
return;
}
m_currentWebView->suspend();
-#if PROFILE_MOBILE
- unregisterHWKeyCallback();
-#endif
+ unregisterHWKeyCallback();
}
void WebEngineService::resume()
return;
}
m_currentWebView->resume();
-#if PROFILE_MOBILE
- registerHWKeyCallback();
-#endif
+ registerHWKeyCallback();
}
bool WebEngineService::isSuspended() const
}
m_stopped = false;
m_currentWebView->back();
-#if PROFILE_MOBILE
closeFindOnPage();
-#endif
}
void WebEngineService::forward(void)
}
m_stopped = false;
m_currentWebView->forward();
-#if PROFILE_MOBILE
closeFindOnPage();
-#endif
}
bool WebEngineService::isBackEnabled() const
m_stateStruct->tabs[newTabId] = p;
-#if PROFILE_MOBILE
setWebViewSettings(p);
-#endif
if (!uri.empty()) {
p->setURI(uri);
BROWSER_LOGW("[%s:%d] there is no tab of id %d", __PRETTY_FUNCTION__, __LINE__, newTabId.get());
return false;
}
-#if PROFILE_MOBILE
closeFindOnPage();
-#endif
+
m_currentWebView = m_stateStruct->tabs[newTabId];
m_currentTabId = newTabId;
m_stateStruct->mostRecentTab.erase(
forwardEnableChanged(m_currentWebView->isForwardEnabled());
backwardEnableChanged(m_currentWebView->isBackEnabled());
currentTabChanged(m_currentTabId);
-#if PROFILE_MOBILE
m_currentWebView->orientationChanged();
-#endif
return true;
}
return std::make_shared<tizen_browser::tools::BrowserImage>();
}
-#if PROFILE_MOBILE
void WebEngineService::setWebViewSettings(std::shared_ptr<WebView> webView) {
webView->ewkSettingsAutoFittingSet(m_settings[WebEngineSettings::PAGE_OVERVIEW]);
webView->ewkSettingsLoadsImagesSet(m_settings[WebEngineSettings::LOAD_IMAGES]);
{
openFindOnPage(str);
}
-#endif
int WebEngineService::getZoomFactor() const
{
setWrongCertificatePem(uri, pem);
}
-#if PROFILE_MOBILE
void WebEngineService::_download_request_cb(const char *download_uri, void *data)
{
BROWSER_LOGD("[%s:%d] download_uri= [%s]", __PRETTY_FUNCTION__, __LINE__, download_uri);
m_currentWebView->exitFullScreen();
}
}
-#endif
void WebEngineService::backButtonClicked()
{
return;
}
-#if PROFILE_MOBILE
if (m_currentWebView->clearTextSelection())
return;
m_currentWebView->exitFullScreen();
return;
}
-#endif
if (isBackEnabled()) {
m_currentWebView->back();
*/
void backButtonClicked();
-#if PROFILE_MOBILE
void moreKeyPressed();
void orientationChanged();
-#endif
void switchToMobileMode();
void switchToDesktopMode();
#if PWA
void _iconDownload(std::string download_uri);
#endif
-#if PROFILE_MOBILE
+
int _getRotation();
void setWebViewSettings(std::shared_ptr<WebView> webView);
void _unsecureConnection();
void _findOnPage(const std::string& str);
static void _download_request_cb(const char *download_uri, void *data);
-#endif
/**
* disconnect signals from specified WebView
#include <shortcut_manager.h>
#include <string>
-#if PROFILE_MOBILE
#include <device/haptic.h>
#include <Ecore.h>
-#endif
#define certificate_crt_path CERTS_DIR
#define APPLICATION_NAME_FOR_USER_AGENT "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/47.0.2526.69 safari/537.36 "
//TODO: temporary user agent for mobile display, change to proper one
#define APPLICATION_NAME_FOR_USER_AGENT_MOBILE "Mozilla/5.0 (Linux; Tizen 3.0; SAMSUNG TM1) AppleWebKit/537.36 (KHTML, like Gecko) SamsungBrowser/1.0 Chrome/47.0.2526.69 Mobile safari/537.36"
-#if PROFILE_MOBILE
Ecore_Timer* m_haptic_timer_id =NULL;
haptic_device_h m_haptic_handle;
haptic_effect_h m_haptic_effect;
#define FIND_WORD_MAX_COUNT 1000
-#endif
using namespace tizen_browser::tools;
, m_suspended(false)
, m_private(incognitoMode)
, m_fullscreen(false)
-#if PROFILE_MOBILE
, m_downloadControl(nullptr)
-#endif
{
}
unregisterCallbacks();
evas_object_del(m_ewkView);
}
-#if PROFILE_MOBILE
delete m_downloadControl;
-#endif
}
void WebView::init(bool desktopMode, TabOrigin origin)
setupEwkSettings();
registerCallbacks();
-#if PROFILE_MOBILE
m_downloadControl = new DownloadControl();
orientationChanged();
-#endif
resume();
}
-#if PROFILE_MOBILE
void WebView::orientationChanged()
{
BROWSER_LOGD("[%s:%d] ", __PRETTY_FUNCTION__, __LINE__);
cancel_vibration();
}
-#endif
void WebView::registerCallbacks()
{
evas_object_smart_callback_add(m_ewkView, "create,window", __newWindowRequest, this);
evas_object_smart_callback_add(m_ewkView, "close,window", __closeWindowRequest, this);
-#if PROFILE_MOBILE
+
evas_object_smart_callback_add(m_ewkView, "policy,response,decide", __policy_response_decide_cb, this);
evas_object_smart_callback_add(m_ewkView, "policy,navigation,decide", __policy_navigation_decide_cb, this);
-#endif
+
evas_object_smart_callback_add(m_ewkView, "request,certificate,confirm", __requestCertificationConfirm, this);
evas_object_smart_callback_add(m_ewkView, "ssl,certificate,changed", __setCertificatePem, this);
evas_object_smart_callback_add(m_ewkView, "load,provisional,started", __load_provisional_started, this);
evas_object_smart_callback_add(m_ewkView, "load,provisional,redirect", __load_provisional_redirect, this);
-#if PROFILE_MOBILE
evas_object_smart_callback_add(m_ewkView, "contextmenu,customize", __contextmenu_customize_cb, this);
evas_object_smart_callback_add(m_ewkView, "contextmenu,selected", __contextmenu_selected_cb, this);
evas_object_smart_callback_add(m_ewkView, "fullscreen,enterfullscreen", __fullscreen_enter_cb, this);
evas_object_smart_callback_add(m_ewkView, "fullscreen,exitfullscreen", __fullscreen_exit_cb, this);
ewk_context_vibration_client_callbacks_set(m_ewkContext, __vibration_cb, __vibration_cancel_cb, this);
-#endif
+ evas_object_smart_callback_add(m_ewkView, "rotate,prepared", __rotate_prepared_cb, this);
}
void WebView::unregisterCallbacks()
evas_object_smart_callback_del_full(m_ewkView, "create,window", __newWindowRequest, this);
evas_object_smart_callback_del_full(m_ewkView, "close,window", __closeWindowRequest, this);
-#if PROFILE_MOBILE
+
evas_object_smart_callback_del_full(m_ewkView, "policy,response,decide", __policy_response_decide_cb, this);
evas_object_smart_callback_del_full(m_ewkView, "policy,navigation,decide", __policy_navigation_decide_cb, this);
-#endif
+
evas_object_smart_callback_del_full(m_ewkView, "request,certificate,confirm", __requestCertificationConfirm, this);
evas_object_smart_callback_del_full(m_ewkView, "icon,received", __faviconChanged, this);
evas_object_smart_callback_del_full(m_ewkView, "load,provisional,started", __load_provisional_started, this);
evas_object_smart_callback_del_full(m_ewkView, "load,provisional,redirect", __load_provisional_redirect, this);
-#if PROFILE_MOBILE
evas_object_smart_callback_del_full(m_ewkView, "contextmenu,customize", __contextmenu_customize_cb,this);
evas_object_smart_callback_del_full(m_ewkView, "contextmenu,selected", __contextmenu_selected_cb, this);
evas_object_smart_callback_del_full(m_ewkView, "fullscreen,enterfullscreen", __fullscreen_enter_cb, this);
evas_object_smart_callback_del_full(m_ewkView, "fullscreen,exitfullscreen", __fullscreen_exit_cb, this);
ewk_context_vibration_client_callbacks_set(m_ewkContext, NULL, NULL, this);
-#endif
+
+ evas_object_smart_callback_del_full(m_ewkView, "rotate,prepared", __rotate_prepared_cb, this);
}
void WebView::setupEwkSettings()
return uri_parts;
}
-#if PROFILE_MOBILE
Eina_Bool WebView::handle_scheme(const char *uri)
{
BROWSER_LOGD("[%s:%d] ", __PRETTY_FUNCTION__, __LINE__);
return EINA_TRUE;
}
-#endif
Evas_Object * WebView::getLayout()
{
}
}
-#if PROFILE_MOBILE
context_menu_type WebView::_get_menu_type(Ewk_Context_Menu *menu)
{
int count = ewk_context_menu_item_count(menu);
self->m_fullscreen = false;
self->fullscreenModeSet(self->m_fullscreen);
}
-#endif
+
+void WebView::__rotate_prepared_cb(void * data, Evas_Object *, void *)
+{
+ BROWSER_LOGD("[%s:%d] ", __PRETTY_FUNCTION__, __LINE__);
+ if (data) {
+ auto *self = static_cast<WebView *>(data);
+ self->rotatePrepared();
+ } else {
+ BROWSER_LOGW("[%s] data = nullptr", __PRETTY_FUNCTION__);
+ }
+}
void WebView::setFocus()
{
ewk_view_scroll_by(m_ewkView, dx, dy);
}
-#if PROFILE_MOBILE
void WebView::findWord(const char *word, Eina_Bool forward, Evas_Smart_Cb found_cb, void *data)
{
BROWSER_LOGD("[%s:%d] ", __PRETTY_FUNCTION__, __LINE__);
Ewk_Settings* settings = ewk_view_settings_get(m_ewkView);
ewk_settings_form_profile_data_enabled_set(settings, value);
}
-#endif
const TabId& WebView::getTabId() {
return m_tabId;
}
-
tools::BrowserImagePtr WebView::getFavicon()
{
BROWSER_LOGD("%s:%d, TabId: %s", __PRETTY_FUNCTION__, __LINE__, m_tabId.toString().c_str());
bool WebView::isDesktopMode() const {
return m_desktopMode;
}
-#if PROFILE_MOBILE
void WebView::__policy_response_decide_cb(void *data, Evas_Object * /* obj */, void *event_info)
{
}
ewk_policy_decision_use(policy_decision);
}
-#endif
} /* namespace webengine_service */
} /* end of basic_webengine */
#include "AbstractWebEngine/WebConfirmation.h"
#include "AbstractWebEngine/TabOrigin.h"
-#if PROFILE_MOBILE
#include "DownloadControl/DownloadControl.h"
#include <app_control.h>
#include <app.h>
#include "AbstractRotatable.h"
-#endif
-#if PROFILE_MOBILE
typedef enum _context_menu_type {
TEXT_ONLY = 0,
INPUT_FIELD,
CUSTOM_CONTEXT_MENU_ITEM_SEND_EMAIL,
CUSTOM_CONTEXT_MENU_ITEM_SEND_ADD_TO_CONTACT,
} custom_context_menu_item_tag;
-#endif
namespace tizen_browser {
namespace basic_webengine {
namespace webengine_service {
class WebView
-#if PROFILE_MOBILE
: public tizen_browser::interfaces::AbstractRotatable
-#endif
{
public:
WebView(Evas_Object *, TabId, const std::string& title, bool incognitoMode);
virtual ~WebView();
void init(bool desktopMode, TabOrigin origin);
-#if PROFILE_MOBILE
virtual void orientationChanged() override;
-#endif
void setURI(const std::string &);
std::string getURI(void);
TabOrigin getOrigin() { return m_origin; }
-#if PROFILE_MOBILE
/**
* @brief Searches for word in the current page.
*
* @brief Set autofill profile data enabled settings flag.
*/
void ewkSettingsFormProfileDataEnabledSet(bool value);
-#endif
// signals
boost::signals2::signal<void (std::shared_ptr<tizen_browser::tools::BrowserImage>)> favIconChanged;
boost::signals2::signal<void (const std::string&, const std::string&)> setCertificatePem;
boost::signals2::signal<void (const std::string&, const std::string&)> setWrongCertificatePem;
+ boost::signals2::signal<void ()> rotatePrepared;
+
boost::signals2::signal<void (const std::string&, const std::string&)> redirectedWebPage;
boost::signals2::signal<void()> unsecureConnection;
boost::signals2::signal<void(bool)> fullscreenModeSet;
static int result_cb(int ret, void *data);
#endif
-#if PROFILE_MOBILE
context_menu_type _get_menu_type(Ewk_Context_Menu *menu);
void _customize_context_menu(Ewk_Context_Menu *menu);
void _show_context_menu_text_link(Ewk_Context_Menu *menu);
static void __contextmenu_selected_cb(void *data, Evas_Object *obj, void *event_info);
static void __fullscreen_enter_cb(void *data, Evas_Object *obj, void *event_info);
static void __fullscreen_exit_cb(void *data, Evas_Object *obj, void *event_info);
+ static void __rotate_prepared_cb(void *data, Evas_Object *obj, void *event_info);
Eina_Bool handle_scheme(const char *uri);
Eina_Bool launch_email(const char *uri);
Eina_Bool launch_dialer(const char *uri);
Eina_Bool launch_message(const char *uri);
Eina_Bool launch_tizenstore(const char *uri);
-#endif
// Load
static void __loadStarted(void * data, Evas_Object * obj, void * event_info);
static void scriptLinkSearchCallback(Evas_Object *o, const char *value, void *data);
-#if PROFILE_MOBILE
// downloads
static void __policy_response_decide_cb(void *data, Evas_Object *obj, void *event_info);
static void __policy_navigation_decide_cb(void *data, Evas_Object *obj, void *event_info);
-#endif
// Screenshot capture
static void __screenshotCaptured(Evas_Object* image, void* user_data);
static std::string m_pwaData;
#endif
-#if PROFILE_MOBILE
int m_status_code;
Eina_Bool m_is_error_page;
DownloadControl *m_downloadControl;
-#endif
};
} /* namespace webengine_service */
elm_gesture_layer_attach(m_gestureLayer, content);
#endif
evas_object_smart_callback_add(content, "mouse,down", _content_clicked, this);
+ updateManualRotation();
evas_object_show(content);
}
boost::signals2::signal<void ()> backPage;
boost::signals2::signal<void ()> forwardPage;
boost::signals2::signal<void ()> showTabUI;
+ boost::signals2::signal<void ()> updateManualRotation;
boost::signals2::signal<void ()> showBookmarksUI;
boost::signals2::signal<void ()> showHomePage;
boost::signals2::signal<void ()> qaOrientationChanged;