[Tizen][M34-Merge] Implement WebContext::ClearCandidateData
authorzhishun.zhou <zhishun.zhou@samsung.com>
Fri, 17 Oct 2014 09:32:09 +0000 (17:32 +0800)
committerYoungsoo Choi <kenshin.choi@samsung.com>
Tue, 10 Jul 2018 06:57:09 +0000 (06:57 +0000)
This patch implement ClearCandidateData, which will be
used by ewk_context_form_candidate_data_clear API.
It depended on auto fill feature(TIZEN_AUTOFILL_SUPPORT).
This is code migration from m34 beta to DEV,
Original patch info: http://suprem.sec.samsung.net/gerrit/#/c/4963/

Bug: http://107.108.218.239/bugzilla/show_bug.cgi?id=7742
Reviewed by:  Antonio Gomes

Change-Id: I73795f52d094c2b6f01d7bf5c579ddd60a589f31
Signed-off-by: zhishun.zhou <zhishun.zhou@samsung.com>
tizen_src/ewk/efl_integration/public/ewk_context.cc
tizen_src/impl/eweb_context.cc
tizen_src/impl/eweb_context.h
tizen_src/impl/tizen_webview/public/tw_web_context.cc
tizen_src/impl/tizen_webview/public/tw_web_context.h

index be32525..6d1bae8 100644 (file)
@@ -399,11 +399,7 @@ void ewk_context_form_password_data_list_free(Ewk_Context* ewkContext, Eina_List
 void ewk_context_form_candidate_data_clear(Ewk_Context* context)
 {
   EINA_SAFETY_ON_NULL_RETURN(context);
-#if !defined(EWK_BRINGUP)
   context->ClearCandidateData();
-#else
-  LOG_EWK_API_MOCKUP();
-#endif
 }
 
 Eina_List* ewk_context_form_autofill_profile_get_all(Ewk_Context* context)
index 24eeb75..355ffbc 100644 (file)
@@ -20,6 +20,7 @@
 #include "eweb_context.h"
 
 #include "base/synchronization/waitable_event.h"
+#include "components/autofill/content/browser/content_autofill_driver.h"
 #include "content/public/browser/appcache_service.h"
 #include "content/public/browser/browser_context.h"
 #include "content/public/browser/browser_thread.h"
@@ -28,6 +29,7 @@
 #include "content/public/browser/local_storage_usage_info.h"
 #include "content/public/browser/dom_storage_context.h"
 #include "browser/favicon/favicon_service.h"
+#include "browser/webdata/web_data_service_factory.h"
 #include "gl/gl_shared_context_efl.h"
 #include "net/http/http_cache.h"
 #include "net/proxy/proxy_config_service_fixed.h"
@@ -495,3 +497,18 @@ Evas_Object *EWebContext::AddFaviconObject(const char* uri, Evas* canvas) const
 
   return favicon;
 }
+
+void EWebContext::ClearCandidateData() {
+#ifdef TIZEN_AUTOFILL_SUPPORT
+  WebDataServiceFactory* webDataServiceInstance = WebDataServiceFactory::GetInstance();
+  scoped_refptr<autofill::AutofillWebDataService> autofillWebDataService = webDataServiceInstance->GetAutofillWebDataForProfile();
+  if(autofillWebDataService) {
+    //RemoveFormElementsAddedBetween will schedule task on proper thread, it is done in WebDatabaseService::ScheduleDBTask
+    autofillWebDataService->RemoveFormElementsAddedBetween(base::Time(), base::Time::Max());
+  } else {
+    DLOG(WARNING) << "AutofillWebDataService is NULL";
+  }
+#else
+  DLOG(WARNING) << "TIZEN_AUTOFILL_SUPPORT is not enabled";
+#endif
+}
index d8aa312..9f34aa6 100644 (file)
@@ -109,6 +109,7 @@ class EWebContext {
   void SetPixmap(int pixmap) { m_pixmap = pixmap; }
   int Pixmap() const { return m_pixmap; }
 
+  void ClearCandidateData();
   void Initialize(Evas_Object* object);
 
  private:
index 960ec23..1ade524 100644 (file)
@@ -193,4 +193,8 @@ void WebContext::SetMimeOverrideCallback(Mime_Override_Callback callback) {
   EWebContext::SetMimeOverrideCallback(callback);
 }
 
+void WebContext::ClearCandidateData() {
+  impl->ClearCandidateData();
+}
+
 } // namespace tizen_webview
index 3a209d5..f44c893 100644 (file)
@@ -89,6 +89,7 @@ struct WebContext : public tizen_webview::RefCounted<WebContext> {
       void* user_data);
   void WebStorageDelete();
   void WebStorageDelete(const URL& origin);
+  void ClearCandidateData();
 
   // File System
   void GetAllOriginsWithFileSystem(