[Tizen][M34-Merge] Implement favicon database get API
authorzhishun.zhou <zhishun.zhou@samsung.com>
Thu, 16 Oct 2014 10:17:50 +0000 (18:17 +0800)
committerYoungsoo Choi <kenshin.choi@samsung.com>
Tue, 10 Jul 2018 06:57:09 +0000 (06:57 +0000)
This patch is needed to support ewk_context_favicon_database_get.
This is code migration from m34 beta to DEV,
Original patch info: http://suprem.sec.samsung.net/gerrit/#/c/6865/

Bug: http://107.108.218.239/bugzilla/show_bug.cgi?id=7636
Reviewed by: Antonio Gomes, SeungSeop Park

Change-Id: Ida3a261efa38ea4b636eb1abe65da64f107fc244
Signed-off-by: zhishun.zhou <zhishun.zhou@samsung.com>
tizen_src/ewk/efl_integration/private/ewk_favicon_database_private.h
tizen_src/ewk/efl_integration/public/ewk_context.cc
tizen_src/impl/browser/favicon/favicon_service.cc
tizen_src/impl/browser/favicon/favicon_service.h
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 f4970b2..5bfd2cc 100644 (file)
@@ -2,7 +2,7 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
-#if defined(OS_TIZEN_TV) && !defined(EWK_BRINGUP)
+#if defined(OS_TIZEN_TV)
 
 #ifndef ewk_favicon_database_private_h
 #define ewk_favicon_database_private_h
 
 struct EwkFaviconDatabase {
  public:
+  static EwkFaviconDatabase *Instance()
+  {
+    static EwkFaviconDatabase database;
+    return &database;
+  }
+
   EwkFaviconDatabase()
   :favicon_database(NULL)
   {
index 04ec1a4..02d3d4f 100644 (file)
@@ -531,11 +531,11 @@ Ewk_Application_Cache_Manager* ewk_context_application_cache_manager_get(const E
 
 Ewk_Favicon_Database* ewk_context_favicon_database_get(const Ewk_Context* ewkContext)
 {
-#if defined(OS_TIZEN_TV) && !defined(EWK_BRINGUP)
+#if defined(OS_TIZEN_TV)
   EINA_SAFETY_ON_NULL_RETURN_VAL(ewkContext, 0);
-  Ewk_Favicon_Database favicon_database;
-  favicon_database.InitEwkFaviconDatabase(ewkContext);
-  return (&favicon_database);
+  Ewk_Favicon_Database *favicon_database = Ewk_Favicon_Database::Instance();
+  favicon_database->InitEwkFaviconDatabase(ewkContext);
+  return favicon_database;
 #else
   LOG_EWK_API_MOCKUP("Only for Tizen TV Browser");
   return NULL;
index a68bcf2..4804cea 100644 (file)
@@ -70,3 +70,9 @@ void FaviconService::Clear() {
   CHECK_OPEN;
   m_database->Clear();
 }
+
+#if defined(OS_TIZEN_TV)
+FaviconDatabase* FaviconService::GetFaviconDatabase() {
+  return FaviconDatabase::Instance();
+}
+#endif
index f124c8b..5359270 100644 (file)
@@ -31,6 +31,9 @@ class FaviconService {
   bool ExistsForPageURL(const GURL &pageUrl) const;
   bool ExistsForFaviconURL(const GURL &iconUrl) const;
   void Clear();
+#if defined(OS_TIZEN_TV)
+  static FaviconDatabase* GetFaviconDatabase();
+#endif
 
  private:
   FaviconDatabase *m_database;
index fb51e93..a160ebc 100644 (file)
@@ -464,6 +464,12 @@ bool EWebContext::SetFaviconDatabasePath(const char* path) {
   return fs.SetDatabasePath(path);
 }
 
+#if defined(OS_TIZEN_TV)
+FaviconDatabase* EWebContext::GetFaviconDatabase() {
+  return FaviconService::GetFaviconDatabase();
+}
+#endif
+
 Evas_Object *EWebContext::AddFaviconObject(const char* uri, Evas* canvas) const {
   if (uri == NULL || canvas == NULL) {
     return NULL;
index e570967..4df8cb4 100644 (file)
@@ -20,6 +20,9 @@ class WrtIpcMessageData;
 typedef std::map<std::string, std::string> HTTPCustomHeadersEflMap;
 
 class CookieManager;
+#if defined(OS_TIZEN_TV)
+class FaviconDatabase;
+#endif
 
 namespace content {
 class BrowserContextEfl;
@@ -97,6 +100,9 @@ class EWebContext {
   void ClearCandidateData();
   void ClearPasswordData();
   void Initialize(Evas_Object* object);
+#if defined(OS_TIZEN_TV)
+  FaviconDatabase* GetFaviconDatabase();
+#endif
 
  private:
   EWebContext();
index ca58174..a2fe331 100644 (file)
@@ -174,6 +174,12 @@ bool WebContext::SetFaviconDatabasePath(const char *path) {
   return impl->SetFaviconDatabasePath(path);
 }
 
+#if defined(OS_TIZEN_TV)
+FaviconDatabase* WebContext::GetFaviconDatabase() {
+  return impl->GetFaviconDatabase();
+}
+#endif
+
 Evas_Object * WebContext::AddFaviconObject(const char *uri, Evas *canvas) const {
   return impl->AddFaviconObject(uri, canvas);
 }
index fba0649..9161348 100644 (file)
@@ -16,6 +16,9 @@
 class CookieManager;
 class Ewk_Cookie_Manager;
 class EWebContext;
+#if defined(OS_TIZEN_TV)
+class FaviconDatabase;
+#endif
 //struct Ewk_IPC_Wrt_Message_Data;
 
 namespace content {
@@ -118,6 +121,9 @@ struct WebContext : public tizen_webview::RefCounted<WebContext> {
 
   // Note: Do not use outside chromium
   EWebContext* GetImpl() { return impl; }
+#if defined(OS_TIZEN_TV)
+  FaviconDatabase* GetFaviconDatabase();
+#endif
 
  private:
   EWebContext* impl;