Fix Reset browser functionality. 14/49114/3
authorDariusz Frankiewicz <d.frankiewic@samsung.com>
Tue, 6 Oct 2015 11:56:41 +0000 (13:56 +0200)
committerDariusz Frankiewicz <d.frankiewic@samsung.com>
Tue, 6 Oct 2015 14:13:40 +0000 (07:13 -0700)
[Issue]    https://bugs.tizen.org/jira/browse/TT-176
[Problem]  Reset browser button didn't work.
[Cause]    Not implemented
[Solution] Add function calls that remove necessary items.
[verify]   Open some tabs, add some pages to bookmarks.
           Then go to the settings and press Reset Broswser.
           History, bookmarks, cookies, opened tabs should be deleted.

Change-Id: I592f2897e1d7447c544d2c8fc14847668c8e2059
Signed-off-by: Dariusz Frankiewicz <d.frankiewic@samsung.com>
services/SimpleUI/SimpleUI.cpp

index 56a99f2f959f88924712702547c163c002d994fb..14adab50ce41b3288b3ef0ce0e6cab2934dc2af6 100644 (file)
@@ -970,6 +970,20 @@ void SimpleUI::onResetBrowserButton(PopupButtons button, std::shared_ptr< PopupD
     if (button == OK) {
         BROWSER_LOGD("[%s]: OK", __func__);
         BROWSER_LOGD("[%s]: Resetting browser", __func__);
+
+        m_webEngine->clearPrivateData();
+        m_historyService->clearAllHistory();
+        m_favoriteService->deleteAllBookmarks();
+
+        // Close all openend tabs
+        std::vector<std::shared_ptr<tizen_browser::basic_webengine::TabContent>> openedTabs = m_webEngine->getTabContents();
+        for (auto it = openedTabs.begin(); it < openedTabs.end(); ++it) {
+            tizen_browser::basic_webengine::TabId id = it->get()->getId();
+            m_currentSession.removeItem(id.toString());
+            m_webEngine->closeTab(id);
+        }
+
+        //TODO: add here any missing functionality that should be cleaned.
     }
 }