Remove tw_web_context
authorArnaud Renevier <a.renevier@samsung.com>
Fri, 24 Apr 2015 05:43:57 +0000 (22:43 -0700)
committerYoungsoo Choi <kenshin.choi@samsung.com>
Tue, 10 Jul 2018 06:57:09 +0000 (06:57 +0000)
Use Ewk_Context directly

Bug: http://web.sec.samsung.net/bugzilla/show_bug.cgi?id=11619

Change-Id: Ica1a38660a38fdc2ac778d25989a2a798553cb89
Signed-off-by: Arnaud Renevier <a.renevier@samsung.com>
23 files changed:
tizen_src/ewk/efl_integration/browser/autofill/autofill_manager_delegate_efl.cc
tizen_src/ewk/efl_integration/browser/autofill/personal_data_manager_factory.cc
tizen_src/ewk/efl_integration/browser/geolocation/access_token_store_efl.cc
tizen_src/ewk/efl_integration/cookie_manager.cc
tizen_src/ewk/efl_integration/efl_integration.gypi
tizen_src/ewk/efl_integration/eweb_context.h
tizen_src/ewk/efl_integration/eweb_view.cc
tizen_src/ewk/efl_integration/eweb_view.h
tizen_src/ewk/efl_integration/ewk_global_data.cc
tizen_src/ewk/efl_integration/private/ewk_context_form_autofill_profile_private.cc
tizen_src/ewk/efl_integration/private/ewk_context_form_autofill_profile_private.h
tizen_src/ewk/efl_integration/private/ewk_context_private.cc
tizen_src/ewk/efl_integration/private/ewk_context_private.h
tizen_src/ewk/efl_integration/private/ewk_favicon_database_private.h
tizen_src/ewk/efl_integration/private/ewk_wrt_private.cc
tizen_src/ewk/efl_integration/public/ewk_context.cc
tizen_src/ewk/efl_integration/public/ewk_main.cc
tizen_src/ewk/efl_integration/public/ewk_view.cc
tizen_src/ewk/efl_integration/tizen_webview/public/tw_web_context.cc [deleted file]
tizen_src/ewk/efl_integration/tizen_webview/public/tw_web_context.h [deleted file]
tizen_src/ewk/efl_integration/tizen_webview/public/tw_webview.cc
tizen_src/ewk/efl_integration/tizen_webview/public/tw_webview.h
tizen_src/ewk/efl_integration/web_contents_delegate_efl.cc

index 9e86f69..c2deea5 100644 (file)
@@ -21,7 +21,6 @@
 #include "content/public/browser/render_view_host.h"
 #include "content/public/browser/browser_thread.h"
 #include "ui/gfx/geometry/rect.h"
-#include "tizen_webview/public/tw_web_context.h"
 
 DEFINE_WEB_CONTENTS_USER_DATA_KEY(autofill::AutofillManagerDelegateEfl);
 
index 11e9381..83239b7 100644 (file)
@@ -13,7 +13,6 @@
 #include "components/autofill/core/browser/webdata/autofill_webdata_service.h"
 #include "components/user_prefs/user_prefs.h"
 #include "content/public/common/content_client.h"
-#include "tizen_webview/public/tw_web_context.h"
 
 // GetContentClient() is defined in content_client.cc, but in content_client.h
 // it is hidden by CONTENT_IMPLEMENTATION ifdef. We don't want to define
index 54d9106..8f1b6f6 100644 (file)
@@ -10,9 +10,7 @@
 #include "content/public/browser/browser_thread.h"
 #include "eweb_context.h"
 #include "ewk_global_data.h"
-#include "tizen_webview/public/tw_web_context.h"
-
-using tizen_webview::WebContext;
+#include "private/ewk_context_private.h"
 
 namespace content {
 
@@ -38,7 +36,7 @@ void AccessTokenStoreEfl::LoadAccessTokens(const LoadAccessTokensCallbackType& c
 
 void AccessTokenStoreEfl::GetRequestContextOnUIThread()
 {
-  WebContext* default_context = WebContext::DefaultContext();
+  Ewk_Context* default_context = Ewk_Context::DefaultContext();
   net::URLRequestContextGetter* context_getter = default_context->browser_context()->GetRequestContext();
   system_request_context_ = EwkGlobalData::GetInstance()->GetSystemRequestContextGetter();
 }
index a8aa7d1..b6daa03 100644 (file)
@@ -32,8 +32,6 @@ using net::CookieList;
 using net::CookieMonster;
 using base::AutoLock;
 
-using namespace tizen_webview;
-
 namespace {
 
 void TriggerHostPolicyGetCallbackAsyncOnUIThread(Ewk_Cookie_Accept_Policy policy,
index 219682c..3b4f928 100644 (file)
       'public/ewk_touch.h',
       'public/text_encoding_map_efl.cc',
       'public/text_encoding_map_efl.h',
+
       'tizen_webview/public/tw_webview_delegate.cc',
       'tizen_webview/public/tw_webview_delegate.h',
-      'tizen_webview/public/tw_hit_test.h',
-      'tizen_webview/public/tw_web_context.h',
       'tizen_webview/public/tw_webview_evas_event_handler.h',
       'tizen_webview/public/tw_webview_evas_event_handler.cc',
       'tizen_webview/public/tw_webview.h',
       'tizen_webview/public/tw_webview.cc',
-      'tizen_webview/public/tw_web_context.cc',
 
       'renderer/content_renderer_client_efl.cc',
       'renderer/content_renderer_client_efl.h',
index 6614221..f95c4ef 100644 (file)
 #include "public/ewk_context.h"
 #include "devtools_delegate_efl.h"
 
-namespace tizen_webview {
-class WebContext;
-}
-
 class CookieManager;
 class Ewk_Wrt_Message_Data;
 #if defined(OS_TIZEN_TV)
@@ -118,7 +114,7 @@ class EWebContext {
  private:
   EWebContext(bool incognito);
   ~EWebContext();
-  friend class tizen_webview::WebContext;
+  friend class Ewk_Context;
 
   static EWebContext* default_context_;
   scoped_ptr<WebCacheManagerEfl> web_cache_manager_;
index 600b5ed..15e3c7e 100644 (file)
@@ -15,6 +15,7 @@
 #include "components/sessions/serialized_navigation_entry.h"
 #include "components/sessions/content/content_serialized_navigation_builder.h"
 #include "private/ewk_back_forward_list_private.h"
+#include "private/ewk_context_private.h"
 #include "private/ewk_frame_private.h"
 #include "private/ewk_policy_decision_private.h"
 #include "private/ewk_settings_private.h"
@@ -55,7 +56,6 @@
 #include "ui/gfx/screen.h"
 #include "devtools_delegate_efl.h"
 
-#include "tizen_webview/public/tw_web_context.h"
 #include "tizen_webview/public/tw_webview.h"
 #include "tizen_webview/public/tw_webview_delegate.h"
 #include "tizen_webview/public/tw_webview_evas_event_handler.h"
@@ -294,7 +294,7 @@ RenderWidgetHostViewEfl* EWebView::rwhv() const {
   return static_cast<RenderWidgetHostViewEfl*>(web_contents_->GetRenderWidgetHostView());
 }
 
-EWebView::EWebView(tizen_webview::WebView* owner, tizen_webview::WebContext* context, Evas_Object* object)
+EWebView::EWebView(tizen_webview::WebView* owner, Ewk_Context* context, Evas_Object* object)
     : public_webview_(owner),
       context_(context),
       evas_object_(object),
@@ -952,7 +952,7 @@ bool EWebView::SetPrivateBrowsing(bool incognito) {
     old_context_ = NULL;
   } else {
     old_context_ = context_;
-    context_ = tizen_webview::WebContext::Create(incognito);
+    context_ = Ewk_Context::Create(incognito);
   }
 
   InitializeContent();
index 17d8fdc..e1e41e4 100644 (file)
@@ -65,7 +65,6 @@ class PopupControllerEfl;
 }
 
 namespace tizen_webview {
-class WebContext;
 class WebView;
 class WebViewEvasEventHandler;
 }
@@ -73,6 +72,7 @@ class WebViewEvasEventHandler;
 class ErrorParams;
 class _Ewk_Policy_Decision;
 class _Ewk_Hit_Test;
+class Ewk_Context;
 
 class WebAppScreenshotCapturedCallback : public base::RefCounted<WebAppScreenshotCapturedCallback> {
  public:
@@ -218,7 +218,7 @@ class EWebView {
   static Evas_Object* GetHostWindowDelegate(const content::WebContents*);
 
   tizen_webview::WebView* GetPublicWebView();
-  tizen_webview::WebContext* context() const { return context_.get(); }
+  Ewk_Context* context() const { return context_.get(); }
   Evas_Object* evas_object() const { return evas_object_; }
   Evas* GetEvas() const { return evas_object_evas_get(evas_object_); }
 
@@ -473,8 +473,8 @@ class EWebView {
 
   tizen_webview::WebView* public_webview_;
   scoped_refptr<tizen_webview::WebViewEvasEventHandler> evas_event_handler_;
-  scoped_refptr<tizen_webview::WebContext> context_;
-  scoped_refptr<tizen_webview::WebContext> old_context_;
+  scoped_refptr<Ewk_Context> context_;
+  scoped_refptr<Ewk_Context> old_context_;
   scoped_ptr<content::WebContents> web_contents_;
   scoped_ptr<content::WebContentsDelegateEfl> web_contents_delegate_;
   std::string pending_url_request_;
@@ -553,7 +553,7 @@ private:
 
   std::map<int64_t, WebViewAsyncRequestHitTestDataCallback*> hit_test_callback_;
   // only tizen_webview::WebView can create and delete this
-  EWebView(tizen_webview::WebView* owner, tizen_webview::WebContext*, Evas_Object* smart_object);
+  EWebView(tizen_webview::WebView* owner, Ewk_Context*, Evas_Object* smart_object);
   ~EWebView();
   friend class tizen_webview::WebView;
 };
index 747e118..91e339b 100644 (file)
@@ -24,7 +24,6 @@
 #include "content/browser/renderer_host/render_process_host_impl.h"
 #include "efl/window_factory.h"
 #include "eweb_view.h"
-#include "tizen_webview/public/tw_web_context.h"
 #include "ui/base/resource/resource_bundle.h"
 
 #include "command_line_efl.h"
index 37f730c..012f5c7 100644 (file)
@@ -17,7 +17,6 @@
 #include "components/autofill/core/browser/personal_data_manager.h"
 #include "eweb_view.h"
 #include "ewk_autofill_profile_private.h"
-#include "tizen_webview/public/tw_web_context.h"
 
 namespace autofill {
 class PersonalDataManagerFactory;
@@ -191,7 +190,7 @@ Ewk_Autofill_Profile* to_Ewk_Autofill_Profile(
 
 Eina_List*
 EwkContextFormAutofillProfileManager::priv_form_autofill_profile_get_all(
-    tizen_webview::WebContext* context) {
+    Ewk_Context* context) {
   EINA_SAFETY_ON_NULL_RETURN_VAL(context, nullptr);
   autofill::PersonalDataManagerFactory* dataManagerFactory =
       autofill::PersonalDataManagerFactory::GetInstance();
@@ -218,7 +217,7 @@ EwkContextFormAutofillProfileManager::priv_form_autofill_profile_get_all(
 
 Ewk_Autofill_Profile*
 EwkContextFormAutofillProfileManager::priv_form_autofill_profile_get(
-    tizen_webview::WebContext* context, unsigned id) {
+    Ewk_Context* context, unsigned id) {
   EINA_SAFETY_ON_NULL_RETURN_VAL(context, nullptr);
   autofill::PersonalDataManagerFactory* dataManagerFactory =
       autofill::PersonalDataManagerFactory::GetInstance();
@@ -233,7 +232,7 @@ EwkContextFormAutofillProfileManager::priv_form_autofill_profile_get(
 }
 
 Eina_Bool EwkContextFormAutofillProfileManager::priv_form_autofill_profile_set(
-    tizen_webview::WebContext* context,
+    Ewk_Context* context,
     unsigned id, Ewk_Autofill_Profile* profile) {
   autofill::PersonalDataManagerFactory* personalDataManagerFactory =
       autofill::PersonalDataManagerFactory::GetInstance();
@@ -253,7 +252,7 @@ Eina_Bool EwkContextFormAutofillProfileManager::priv_form_autofill_profile_set(
 }
 
 Eina_Bool EwkContextFormAutofillProfileManager::priv_form_autofill_profile_add(
-    tizen_webview::WebContext* context, Ewk_Autofill_Profile* profile) {
+    Ewk_Context* context, Ewk_Autofill_Profile* profile) {
   autofill::PersonalDataManagerFactory* personalDataManagerFactory =
       autofill::PersonalDataManagerFactory::GetInstance();
   personalDataManagerFactory->AddProfile(
@@ -263,7 +262,7 @@ Eina_Bool EwkContextFormAutofillProfileManager::priv_form_autofill_profile_add(
 
 Eina_Bool
 EwkContextFormAutofillProfileManager::priv_form_autofill_profile_remove(
-    tizen_webview::WebContext* context, unsigned id) {
+    Ewk_Context* context, unsigned id) {
   autofill::PersonalDataManagerFactory* personalDataManagerFactory =
       autofill::PersonalDataManagerFactory::GetInstance();
   personalDataManagerFactory->RemoveByGUID(context->browser_context(),
index 32731fa..c68428e 100644 (file)
@@ -9,9 +9,7 @@
 
 #include <Evas.h>
 
-namespace tizen_webview {
-class WebContext;
-}
+class Ewk_Context;
 
 typedef struct _Ewk_Autofill_Profile Ewk_Autofill_Profile;
 typedef void (*Ewk_Context_Form_Autofill_Profile_Changed_Callback)(void *data);
@@ -28,7 +26,7 @@ class EwkContextFormAutofillProfileManager
    * @return @c Eina_List of Ewk_Autofill_Profile @c NULL otherwise
    * @see ewk_autofill_profile_delete
    */
-  static Eina_List* priv_form_autofill_profile_get_all(tizen_webview::WebContext* context);
+  static Eina_List* priv_form_autofill_profile_get_all(Ewk_Context* context);
 
   /**
    * Gets the existing profile for given index
@@ -41,7 +39,7 @@ class EwkContextFormAutofillProfileManager
    * @return @c Ewk_Autofill_Profile if profile exists, @c NULL otherwise
    * @see ewk_autofill_profile_delete
    */
-  static Ewk_Autofill_Profile* priv_form_autofill_profile_get(tizen_webview::WebContext* context,
+  static Ewk_Autofill_Profile* priv_form_autofill_profile_get(Ewk_Context* context,
       unsigned id);
 
   /**
@@ -57,7 +55,7 @@ class EwkContextFormAutofillProfileManager
    * @see ewk_autofill_profile_new
    * @see ewk_context_form_autofill_profile_add
    */
-  static Eina_Bool priv_form_autofill_profile_set(tizen_webview::WebContext* context,
+  static Eina_Bool priv_form_autofill_profile_set(Ewk_Context* context,
       unsigned id, Ewk_Autofill_Profile* profile);
 
   /**
@@ -72,7 +70,7 @@ class EwkContextFormAutofillProfileManager
    * @return @c EINA_TRUE if the profile data is saved successfully, @c EINA_FALSE otherwise
    * @see ewk_autofill_profile_new
    */
-  static Eina_Bool priv_form_autofill_profile_add(tizen_webview::WebContext* context,
+  static Eina_Bool priv_form_autofill_profile_add(Ewk_Context* context,
       Ewk_Autofill_Profile* profile);
 
   /**
@@ -84,7 +82,7 @@ class EwkContextFormAutofillProfileManager
    * @return @c EINA_TRUE if the profile data is removed successfully, @c EINA_FALSE otherwise
    * @see ewk_context_form_autofill_profile_get_all
    */
-    static EAPI Eina_Bool priv_form_autofill_profile_remove(tizen_webview::WebContext* context,
+    static EAPI Eina_Bool priv_form_autofill_profile_remove(Ewk_Context* context,
         unsigned id);
 
   /**
index 7aa361a..fba64c6 100644 (file)
@@ -4,5 +4,257 @@
 
 #include "ewk_context_private.h"
 
-// Use compiler generated constructor and destructor
-// No significant implementation is required.
+#include "browser_context_efl.h"
+#include "eweb_context.h"
+
+using content::BrowserContextEfl;
+
+namespace {
+BrowserContextEfl::ResourceContextEfl* GetResourceContextEfl(
+    EWebContext* ctx) {
+  BrowserContextEfl::ResourceContextEfl* retval = NULL;
+
+  if (ctx) {
+    BrowserContextEfl* browser_context = ctx->browser_context();
+
+    if (browser_context)
+      retval = browser_context->GetResourceContextEfl();
+  }
+  return retval;
+}
+}
+
+static Ewk_Context* default_context_ = NULL;
+
+// static
+Ewk_Context* Ewk_Context::DefaultContext() {
+  if (!default_context_) {
+    // default context is not incognito
+    default_context_ = Ewk_Context::Create(false);
+  }
+
+  return default_context_;
+}
+
+// static
+void Ewk_Context::DefaultContextRelease() {
+  if (default_context_) {
+    // this method should be called from ewk_shutdown and ewk_shutdown should
+    // be called only when all webviews are closed. This won't check if all
+    // webviews are destroyed but we will be sure that all webviews using
+    // default web context are destroyed.
+    CHECK(default_context_->HasOneRef());
+    default_context_->Release();
+    CHECK(default_context_ == NULL);
+  }
+}
+
+// static
+Ewk_Context* Ewk_Context::Create(bool incognito) {
+  Ewk_Context* context = new Ewk_Context(incognito);
+  context->AddRef();
+  return context;
+}
+
+// static
+void Ewk_Context::Delete(Ewk_Context* context) {
+  if (context) {
+    if (context == default_context_ && context->HasOneRef()) {
+      // With chromium engine there is only single context
+      // which is default context hence this delete
+      // function will not be implemented
+      NOTIMPLEMENTED();
+      return;
+    }
+    context->Release();
+  }
+}
+
+Ewk_Context::Ewk_Context(bool incognito) : impl(new EWebContext(incognito)) {
+}
+
+Ewk_Context::~Ewk_Context() {
+  if (this == default_context_)
+    default_context_= NULL;
+  delete impl;
+}
+
+content::BrowserContextEfl* Ewk_Context::browser_context() const {
+  return impl->browser_context();
+}
+
+Ewk_Cookie_Manager* Ewk_Context::ewkCookieManager() const {
+  return impl->ewkCookieManager();
+}
+
+scoped_refptr<CookieManager> Ewk_Context::cookieManager() const {
+  return impl->cookieManager();
+}
+
+void Ewk_Context::SetDidStartDownloadCallback(Ewk_Context_Did_Start_Download_Callback callback, void* user_data) {
+  impl->SetDidStartDownloadCallback(callback, user_data);
+}
+
+void Ewk_Context::SetCertificate(const char* certificate_file) {
+  impl->SetCertificate(certificate_file);
+}
+
+void Ewk_Context::SetProxyUri(const char* uri) {
+  impl->SetProxyUri(uri);
+}
+
+const char* Ewk_Context::GetProxyUri() const {
+  return impl->GetProxyUri();
+}
+
+void Ewk_Context::AddExtraPluginDir(const char *path) {
+  impl->AddExtraPluginDir(path);
+}
+
+void Ewk_Context::NotifyLowMemory() {
+  impl->NotifyLowMemory();
+}
+
+bool Ewk_Context::HTTPCustomHeaderAdd(const char* name, const char* value) {
+  BrowserContextEfl::ResourceContextEfl* rc = GetResourceContextEfl(impl);
+
+  if (rc)
+    return rc->HTTPCustomHeaderAdd(name, value);
+
+  return false;
+}
+
+bool Ewk_Context::HTTPCustomHeaderRemove(const char* name) {
+  BrowserContextEfl::ResourceContextEfl* rc = GetResourceContextEfl(impl);
+
+  if (rc)
+    return rc->HTTPCustomHeaderRemove(name);
+
+  return false;
+}
+
+void Ewk_Context::HTTPCustomHeaderClear() {
+  BrowserContextEfl::ResourceContextEfl* rc = GetResourceContextEfl(impl);
+
+  if (rc)
+    rc->HTTPCustomHeaderClear();
+}
+
+void Ewk_Context::SetCacheModel(Ewk_Cache_Model cm) {
+  impl->SetCacheModel(cm);
+}
+
+Ewk_Cache_Model Ewk_Context::GetCacheModel() const {
+  return impl->GetCacheModel();
+}
+
+void Ewk_Context::SetNetworkCacheEnable(bool enable) {
+  impl->SetNetworkCacheEnable(enable);
+}
+
+bool Ewk_Context::GetNetworkCacheEnable() const {
+  return impl->GetNetworkCacheEnable();
+}
+
+void Ewk_Context::ClearNetworkCache() {
+  impl->ClearNetworkCache();
+}
+
+void Ewk_Context::ClearWebkitCache() {
+  impl->ClearWebkitCache();
+}
+
+void Ewk_Context::GetAllOriginsWithApplicationCache(Ewk_Web_Application_Cache_Origins_Get_Callback callback, void* user_data) {
+  impl->GetAllOriginsWithApplicationCache(callback, user_data);
+}
+
+void Ewk_Context::GetApplicationCacheUsage(const GURL& url, Ewk_Web_Application_Cache_Usage_For_Origin_Get_Callback callback, void* user_data) {
+  impl->GetApplicationCacheUsage(url, callback, user_data);
+}
+
+void Ewk_Context::DeleteAllApplicationCache() {
+  impl->DeleteAllApplicationCache();
+}
+
+void Ewk_Context::DeleteApplicationCacheForSite(const GURL& url) {
+  impl->DeleteApplicationCacheForSite(url);
+}
+
+void Ewk_Context::GetAllOriginsWithWebDB(Ewk_Web_Database_Origins_Get_Callback callback, void* user_data) {
+  impl->GetAllOriginsWithWebDB(callback, user_data);
+}
+
+void Ewk_Context::WebDBDelete(const GURL& host) {
+  impl->WebDBDelete(host);
+}
+
+void Ewk_Context::IndexedDBDelete() {
+  impl->IndexedDBDelete();
+}
+
+void Ewk_Context::WebStorageOriginsAllGet(Ewk_Web_Storage_Origins_Get_Callback callback, void* user_data) {
+  impl->WebStorageOriginsAllGet(callback, user_data);
+}
+
+void Ewk_Context::WebStorageDelete() {
+  impl->WebStorageDelete();
+}
+
+void Ewk_Context::WebStorageDelete(const GURL& origin) {
+  impl->WebStorageDeleteForOrigin(origin);
+}
+
+void Ewk_Context::GetAllOriginsWithFileSystem(Ewk_Local_File_System_Origins_Get_Callback callback, void* user_data) const {
+  impl->GetAllOriginsWithFileSystem(callback, user_data);
+}
+
+void Ewk_Context::FileSystemDelete(const GURL& host) {
+  impl->FileSystemDelete(host);
+}
+
+bool Ewk_Context::SetFaviconDatabasePath(const char *path) {
+  return impl->SetFaviconDatabasePath(path);
+}
+
+#if defined(OS_TIZEN_TV)
+FaviconDatabase* Ewk_Context::GetFaviconDatabase() {
+  return impl->GetFaviconDatabase();
+}
+#endif
+
+Evas_Object * Ewk_Context::AddFaviconObject(const char *uri, Evas *canvas) const {
+  return impl->AddFaviconObject(uri, canvas);
+}
+
+void Ewk_Context::SendWidgetInfo(int widget_id, double scale, const std::string &theme, const std::string &encoded_bundle) {
+  impl->SendWidgetInfo(widget_id, scale, theme, encoded_bundle);
+}
+
+int Ewk_Context::Pixmap() const {
+  return impl->Pixmap();
+}
+
+void Ewk_Context::SetPixmap(int pixmap) {
+  impl->SetPixmap( pixmap);
+}
+
+void Ewk_Context::SetMimeOverrideCallback(Ewk_Context_Override_Mime_For_Url_Callback callback,
+                                         void* user_data) const {
+  impl->SetMimeOverrideCallback(callback, user_data);
+}
+
+void Ewk_Context::ClearCandidateData() {
+  impl->ClearCandidateData();
+}
+
+void Ewk_Context::ClearPasswordData() {
+  impl->ClearPasswordData();
+}
+
+unsigned int Ewk_Context::InspectorServerStart(unsigned int port) const {
+  return impl->InspectorServerStart(port);
+}
+
+bool Ewk_Context::InspectorServerStop() const {
+  return impl->InspectorServerStop();
+}
index 41b0806..bab5ad1 100644 (file)
@@ -5,9 +5,135 @@
 #ifndef ewk_context_private_h
 #define ewk_context_private_h
 
-#include <tizen_webview/public/tw_web_context.h>
+#include <string>
+#include <Evas.h>
 
-struct Ewk_Context : public tizen_webview::WebContext {
+#include "base/memory/ref_counted.h"
+#include "ewk_enums.h"
+#include "public/ewk_context.h"
+
+class CookieManager;
+class Ewk_Cookie_Manager;
+class EWebContext;
+#if defined(OS_TIZEN_TV)
+class FaviconDatabase;
+#endif
+class GURL;
+
+namespace content {
+class BrowserContextEfl;
+};
+
+struct Ewk_Context : public base::RefCounted<Ewk_Context> {
+ public:
+  static Ewk_Context* DefaultContext();
+  static void DefaultContextRelease();
+  static Ewk_Context* Create(bool incognito = false);
+  static void Delete(Ewk_Context*);
+
+  // Get related class
+  content::BrowserContextEfl* browser_context() const;
+  Ewk_Cookie_Manager* ewkCookieManager() const;
+  scoped_refptr<CookieManager> cookieManager() const;
+
+  // Set Callbacks
+  void SetDidStartDownloadCallback(Ewk_Context_Did_Start_Download_Callback callback,
+      void* user_data);
+  //EwkDidStartDownloadCallback* DidStartDownloadCallback();
+
+  // Certificate
+  void SetCertificate(const char* certificate_file);
+
+  // Proxy URI
+  void SetProxyUri(const char* uri);
+  const char* GetProxyUri() const;
+
+  // System
+  void AddExtraPluginDir(const char *path);
+  void NotifyLowMemory();
+
+  // HTTP Custom Header
+  bool HTTPCustomHeaderAdd(const char* name, const char* value);
+  bool HTTPCustomHeaderRemove(const char* name);
+  void HTTPCustomHeaderClear();
+
+  // Cache Model
+  void SetCacheModel(Ewk_Cache_Model cm);
+  Ewk_Cache_Model GetCacheModel() const;
+
+  // Network Cache
+  void SetNetworkCacheEnable(bool enable);
+  bool GetNetworkCacheEnable() const;
+  void ClearNetworkCache();
+  void ClearWebkitCache();
+
+  // Application Cache
+  void GetAllOriginsWithApplicationCache(
+      Ewk_Web_Application_Cache_Origins_Get_Callback callback, void* user_data);
+  void GetApplicationCacheUsage(const GURL& url,
+      Ewk_Web_Application_Cache_Usage_For_Origin_Get_Callback callback,
+      void* user_data);
+  void DeleteAllApplicationCache();
+  void DeleteApplicationCacheForSite(const GURL& url);
+
+  // Web Database
+  void GetAllOriginsWithWebDB(Ewk_Web_Database_Origins_Get_Callback callback,
+      void* user_data);
+  void WebDBDelete(const GURL& host);
+
+  // Indexed DB
+  void IndexedDBDelete();
+
+  // Web Storage
+  void WebStorageOriginsAllGet(Ewk_Web_Storage_Origins_Get_Callback callback,
+      void* user_data);
+  void WebStorageDelete();
+  void WebStorageDelete(const GURL& origin);
+  void ClearCandidateData();
+
+  // File System
+  void GetAllOriginsWithFileSystem(
+      Ewk_Local_File_System_Origins_Get_Callback callback, void* user_data) const;
+  void FileSystemDelete(const GURL& host);
+
+  // Favicon
+  bool SetFaviconDatabasePath(const char *path);
+  Evas_Object *AddFaviconObject(const char *uri, Evas *canvas) const;
+
+  // Widget
+  void SendWidgetInfo(int widget_id, double scale, const std::string &theme,
+      const std::string &encoded_bundle);
+  //void SendWrtMessage(const Ewk_IPC_Wrt_Message_Data& message);
+
+  // Pixmap
+  int  Pixmap() const;
+  void SetPixmap(int pixmap);
+
+  // Password
+  void ClearPasswordData();
+
+  // Set MIME override callback
+  void SetMimeOverrideCallback(Ewk_Context_Override_Mime_For_Url_Callback callback,
+                               void* user_data) const;
+
+  // Note: Do not use outside chromium
+  EWebContext* GetImpl() { return impl; }
+#if defined(OS_TIZEN_TV)
+  FaviconDatabase* GetFaviconDatabase();
+#endif
+
+  unsigned int InspectorServerStart(unsigned int port) const;
+  bool InspectorServerStop() const;
+
+ private:
+  EWebContext* impl;
+
+  Ewk_Context(bool incognito);
+  ~Ewk_Context();
+  friend class base::RefCounted<Ewk_Context>;
+
+  DISALLOW_COPY_AND_ASSIGN(Ewk_Context);
 };
 
+
 #endif // ewk_context_private_h
index 607a7ce..5a267f0 100644 (file)
@@ -10,7 +10,6 @@
 #include <Evas.h>
 
 #include "browser/favicon/favicon_database.h"
-#include <tizen_webview/public/tw_web_context.h>
 #include "private/ewk_context_private.h"
 
 struct EwkFaviconDatabase {
index c4731c9..cd0215d 100644 (file)
@@ -5,7 +5,6 @@
 #include "ewk_wrt_private.h"
 
 #include "common/render_messages_ewk.h"
-#include "tizen_webview/public/tw_web_context.h"
 
 const char* Ewk_Wrt_Message_Data::GetType() const {
   return type.c_str();
index 0c71e4b..90ab294 100644 (file)
@@ -4,8 +4,6 @@
 
 #include "ewk_context.h"
 
-#include <tizen_webview/public/tw_web_context.h>
-
 #include "base/memory/ref_counted.h"
 #include "browser/vibration/vibration_provider_client.h"
 #include "browser_context_efl.h"
@@ -18,8 +16,6 @@
 #include "private/ewk_cookie_manager_private.h"
 #include "private/ewk_context_form_autofill_profile_private.h"
 
-using tizen_webview::WebContext;
-
 Ewk_Context *ewk_context_ref(Ewk_Context *context)
 {
   EINA_SAFETY_ON_NULL_RETURN_VAL(context, NULL);
@@ -41,12 +37,12 @@ Ewk_Cookie_Manager* ewk_context_cookie_manager_get(const Ewk_Context* context)
 
 Ewk_Context* ewk_context_default_get()
 {
-  return static_cast<Ewk_Context*>(WebContext::DefaultContext());
+  return Ewk_Context::DefaultContext();
 }
 
 Ewk_Context* ewk_context_new()
 {
-  return static_cast<Ewk_Context*>(WebContext::Create());
+  return Ewk_Context::Create();
 }
 
 Ewk_Context *ewk_context_new_with_injected_bundle_path(const char *path)
index d79c4b1..fc792de 100644 (file)
@@ -35,9 +35,9 @@
 #include "public/ewk_log.h"
 #include "public/ewk_view.h"
 #include "private/webview_delegate_ewk.h"
+#include "private/ewk_context_private.h"
 #include "private/ewk_private.h"
 #include "private/ewk_main_private.h"
-#include "tizen_webview/public/tw_web_context.h"
 
 #if defined(HAVE_ECORE_X)
 #include <Ecore_X.h>
@@ -191,7 +191,7 @@ void _ewk_shutdown_web_engine(void)
 {
   //TODO: any web engine destroy to be done here
   CommandLineEfl::Shutdown();
-  tizen_webview::WebContext::DefaultContextRelease();
+  Ewk_Context::DefaultContextRelease();
   EwkGlobalData::Delete();
 }
 
index 26a5f77..54ccc4c 100644 (file)
@@ -53,7 +53,6 @@
 #include "web_contents_delegate_efl.h"
 
 using tizen_webview::WebView;
-using tizen_webview::WebContext;
 
 Eina_Bool ewk_view_smart_class_set(Ewk_View_Smart_Class* api)
 {
@@ -101,7 +100,7 @@ Evas_Object* ewk_view_add(Evas* e)
 
 Evas_Object* ewk_view_add_in_incognito_mode(Evas* e)
 {
-  Ewk_Context* context = static_cast<Ewk_Context*>(WebContext::Create(true));
+  Ewk_Context* context = Ewk_Context::Create(true);
   EINA_SAFETY_ON_NULL_RETURN_VAL(context, NULL);
   return ewk_view_add_with_context(e, context);
 }
diff --git a/tizen_src/ewk/efl_integration/tizen_webview/public/tw_web_context.cc b/tizen_src/ewk/efl_integration/tizen_webview/public/tw_web_context.cc
deleted file mode 100644 (file)
index c268b7b..0000000
+++ /dev/null
@@ -1,264 +0,0 @@
-// Copyright (c) 2014 The Chromium Authors. All rights reserved.
-// Copyright 2014-2015 Samsung Electronics. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#include "browser_context_efl.h"
-#include "eweb_context.h"
-#include "tw_web_context.h"
-
-using content::BrowserContextEfl;
-
-namespace tizen_webview {
-
-namespace {
-BrowserContextEfl::ResourceContextEfl* GetResourceContextEfl(
-    EWebContext* ctx) {
-  BrowserContextEfl::ResourceContextEfl* retval = NULL;
-
-  if (ctx) {
-    BrowserContextEfl* browser_context = ctx->browser_context();
-
-    if (browser_context)
-      retval = browser_context->GetResourceContextEfl();
-  }
-  return retval;
-}
-}
-
-static WebContext* default_context_ = NULL;
-
-// static
-WebContext* WebContext::DefaultContext() {
-  if (!default_context_) {
-    // default context is not incognito
-    default_context_ = WebContext::Create(false);
-  }
-
-  return default_context_;
-}
-
-// static
-void WebContext::DefaultContextRelease() {
-  if (default_context_) {
-    // this method should be called from ewk_shutdown and ewk_shutdown should
-    // be called only when all webviews are closed. This won't check if all
-    // webviews are destroyed but we will be sure that all webviews using
-    // default web context are destroyed.
-    CHECK(default_context_->HasOneRef());
-    default_context_->Release();
-    CHECK(default_context_ == NULL);
-  }
-}
-
-// static
-WebContext* WebContext::Create(bool incognito) {
-  WebContext* context = new WebContext(incognito);
-  context->AddRef();
-  return context;
-}
-
-// static
-void WebContext::Delete(WebContext* context) {
-  if (context) {
-    if (context == default_context_ && context->HasOneRef()) {
-      // With chromium engine there is only single context
-      // which is default context hence this delete
-      // function will not be implemented
-      NOTIMPLEMENTED();
-      return;
-    }
-    context->Release();
-  }
-}
-
-WebContext::WebContext(bool incognito) : impl(new EWebContext(incognito)) {
-}
-
-WebContext::~WebContext() {
-  if (this == default_context_)
-    default_context_= NULL;
-  delete impl;
-}
-
-content::BrowserContextEfl* WebContext::browser_context() const {
-  return impl->browser_context();
-}
-
-Ewk_Cookie_Manager* WebContext::ewkCookieManager() const {
-  return impl->ewkCookieManager();
-}
-
-scoped_refptr<CookieManager> WebContext::cookieManager() const {
-  return impl->cookieManager();
-}
-
-void WebContext::SetDidStartDownloadCallback(Ewk_Context_Did_Start_Download_Callback callback, void* user_data) {
-  impl->SetDidStartDownloadCallback(callback, user_data);
-}
-
-void WebContext::SetCertificate(const char* certificate_file) {
-  impl->SetCertificate(certificate_file);
-}
-
-void WebContext::SetProxyUri(const char* uri) {
-  impl->SetProxyUri(uri);
-}
-
-const char* WebContext::GetProxyUri() const {
-  return impl->GetProxyUri();
-}
-
-void WebContext::AddExtraPluginDir(const char *path) {
-  impl->AddExtraPluginDir(path);
-}
-
-void WebContext::NotifyLowMemory() {
-  impl->NotifyLowMemory();
-}
-
-bool WebContext::HTTPCustomHeaderAdd(const char* name, const char* value) {
-  BrowserContextEfl::ResourceContextEfl* rc = GetResourceContextEfl(impl);
-
-  if (rc)
-    return rc->HTTPCustomHeaderAdd(name, value);
-
-  return false;
-}
-
-bool WebContext::HTTPCustomHeaderRemove(const char* name) {
-  BrowserContextEfl::ResourceContextEfl* rc = GetResourceContextEfl(impl);
-
-  if (rc)
-    return rc->HTTPCustomHeaderRemove(name);
-
-  return false;
-}
-
-void WebContext::HTTPCustomHeaderClear() {
-  BrowserContextEfl::ResourceContextEfl* rc = GetResourceContextEfl(impl);
-
-  if (rc)
-    rc->HTTPCustomHeaderClear();
-}
-
-void WebContext::SetCacheModel(Ewk_Cache_Model cm) {
-  impl->SetCacheModel(cm);
-}
-
-Ewk_Cache_Model WebContext::GetCacheModel() const {
-  return impl->GetCacheModel();
-}
-
-void WebContext::SetNetworkCacheEnable(bool enable) {
-  impl->SetNetworkCacheEnable(enable);
-}
-
-bool WebContext::GetNetworkCacheEnable() const {
-  return impl->GetNetworkCacheEnable();
-}
-
-void WebContext::ClearNetworkCache() {
-  impl->ClearNetworkCache();
-}
-
-void WebContext::ClearWebkitCache() {
-  impl->ClearWebkitCache();
-}
-
-void WebContext::GetAllOriginsWithApplicationCache(Ewk_Web_Application_Cache_Origins_Get_Callback callback, void* user_data) {
-  impl->GetAllOriginsWithApplicationCache(callback, user_data);
-}
-
-void WebContext::GetApplicationCacheUsage(const GURL& url, Ewk_Web_Application_Cache_Usage_For_Origin_Get_Callback callback, void* user_data) {
-  impl->GetApplicationCacheUsage(url, callback, user_data);
-}
-
-void WebContext::DeleteAllApplicationCache() {
-  impl->DeleteAllApplicationCache();
-}
-
-void WebContext::DeleteApplicationCacheForSite(const GURL& url) {
-  impl->DeleteApplicationCacheForSite(url);
-}
-
-void WebContext::GetAllOriginsWithWebDB(Ewk_Web_Database_Origins_Get_Callback callback, void* user_data) {
-  impl->GetAllOriginsWithWebDB(callback, user_data);
-}
-
-void WebContext::WebDBDelete(const GURL& host) {
-  impl->WebDBDelete(host);
-}
-
-void WebContext::IndexedDBDelete() {
-  impl->IndexedDBDelete();
-}
-
-void WebContext::WebStorageOriginsAllGet(Ewk_Web_Storage_Origins_Get_Callback callback, void* user_data) {
-  impl->WebStorageOriginsAllGet(callback, user_data);
-}
-
-void WebContext::WebStorageDelete() {
-  impl->WebStorageDelete();
-}
-
-void WebContext::WebStorageDelete(const GURL& origin) {
-  impl->WebStorageDeleteForOrigin(origin);
-}
-
-void WebContext::GetAllOriginsWithFileSystem(Ewk_Local_File_System_Origins_Get_Callback callback, void* user_data) const {
-  impl->GetAllOriginsWithFileSystem(callback, user_data);
-}
-
-void WebContext::FileSystemDelete(const GURL& host) {
-  impl->FileSystemDelete(host);
-}
-
-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);
-}
-
-void WebContext::SendWidgetInfo(int widget_id, double scale, const std::string &theme, const std::string &encoded_bundle) {
-  impl->SendWidgetInfo(widget_id, scale, theme, encoded_bundle);
-}
-
-int WebContext::Pixmap() const {
-  return impl->Pixmap();
-}
-
-void WebContext::SetPixmap(int pixmap) {
-  impl->SetPixmap( pixmap);
-}
-
-void WebContext::SetMimeOverrideCallback(Ewk_Context_Override_Mime_For_Url_Callback callback,
-                                         void* user_data) const {
-  impl->SetMimeOverrideCallback(callback, user_data);
-}
-
-void WebContext::ClearCandidateData() {
-  impl->ClearCandidateData();
-}
-
-void WebContext::ClearPasswordData() {
-  impl->ClearPasswordData();
-}
-
-unsigned int WebContext::InspectorServerStart(unsigned int port) const {
-  return impl->InspectorServerStart(port);
-}
-
-bool WebContext::InspectorServerStop() const {
-  return impl->InspectorServerStop();
-}
-
-} // namespace tizen_webview
diff --git a/tizen_src/ewk/efl_integration/tizen_webview/public/tw_web_context.h b/tizen_src/ewk/efl_integration/tizen_webview/public/tw_web_context.h
deleted file mode 100644 (file)
index d75418c..0000000
+++ /dev/null
@@ -1,143 +0,0 @@
-// Copyright (c) 2014 The Chromium Authors. All rights reserved.
-// Copyright 2014-2015 Samsung Electronics. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#ifndef TIZEN_WEBVIEW_PUBLIC_TW_WEB_CONTEXT_H_
-#define TIZEN_WEBVIEW_PUBLIC_TW_WEB_CONTEXT_H_
-
-#include <string>
-#include <Evas.h>
-
-#include "base/memory/ref_counted.h"
-#include "ewk_enums.h"
-#include "public/ewk_context.h"
-
-class CookieManager;
-class Ewk_Cookie_Manager;
-class EWebContext;
-#if defined(OS_TIZEN_TV)
-class FaviconDatabase;
-#endif
-class GURL;
-//struct Ewk_IPC_Wrt_Message_Data;
-
-namespace content {
-class BrowserContextEfl;
-}
-
-namespace tizen_webview {
-
-struct WebContext : public base::RefCounted<WebContext> {
- public:
-  static WebContext* DefaultContext();
-  static void DefaultContextRelease();
-  static WebContext* Create(bool incognito = false);
-  static void Delete(WebContext*);
-
-  // Get related class
-  content::BrowserContextEfl* browser_context() const;
-  Ewk_Cookie_Manager* ewkCookieManager() const;
-  scoped_refptr<CookieManager> cookieManager() const;
-
-  // Set Callbacks
-  void SetDidStartDownloadCallback(Ewk_Context_Did_Start_Download_Callback callback,
-      void* user_data);
-  //EwkDidStartDownloadCallback* DidStartDownloadCallback();
-
-  // Certificate
-  void SetCertificate(const char* certificate_file);
-
-  // Proxy URI
-  void SetProxyUri(const char* uri);
-  const char* GetProxyUri() const;
-
-  // System
-  void AddExtraPluginDir(const char *path);
-  void NotifyLowMemory();
-
-  // HTTP Custom Header
-  bool HTTPCustomHeaderAdd(const char* name, const char* value);
-  bool HTTPCustomHeaderRemove(const char* name);
-  void HTTPCustomHeaderClear();
-
-  // Cache Model
-  void SetCacheModel(Ewk_Cache_Model cm);
-  Ewk_Cache_Model GetCacheModel() const;
-
-  // Network Cache
-  void SetNetworkCacheEnable(bool enable);
-  bool GetNetworkCacheEnable() const;
-  void ClearNetworkCache();
-  void ClearWebkitCache();
-
-  // Application Cache
-  void GetAllOriginsWithApplicationCache(
-      Ewk_Web_Application_Cache_Origins_Get_Callback callback, void* user_data);
-  void GetApplicationCacheUsage(const GURL& url,
-      Ewk_Web_Application_Cache_Usage_For_Origin_Get_Callback callback,
-      void* user_data);
-  void DeleteAllApplicationCache();
-  void DeleteApplicationCacheForSite(const GURL& url);
-
-  // Web Database
-  void GetAllOriginsWithWebDB(Ewk_Web_Database_Origins_Get_Callback callback,
-      void* user_data);
-  void WebDBDelete(const GURL& host);
-
-  // Indexed DB
-  void IndexedDBDelete();
-
-  // Web Storage
-  void WebStorageOriginsAllGet(Ewk_Web_Storage_Origins_Get_Callback callback,
-      void* user_data);
-  void WebStorageDelete();
-  void WebStorageDelete(const GURL& origin);
-  void ClearCandidateData();
-
-  // File System
-  void GetAllOriginsWithFileSystem(
-      Ewk_Local_File_System_Origins_Get_Callback callback, void* user_data) const;
-  void FileSystemDelete(const GURL& host);
-
-  // Favicon
-  bool SetFaviconDatabasePath(const char *path);
-  Evas_Object *AddFaviconObject(const char *uri, Evas *canvas) const;
-
-  // Widget
-  void SendWidgetInfo(int widget_id, double scale, const std::string &theme,
-      const std::string &encoded_bundle);
-  //void SendWrtMessage(const Ewk_IPC_Wrt_Message_Data& message);
-
-  // Pixmap
-  int  Pixmap() const;
-  void SetPixmap(int pixmap);
-
-  // Password
-  void ClearPasswordData();
-
-  // Set MIME override callback
-  void SetMimeOverrideCallback(Ewk_Context_Override_Mime_For_Url_Callback callback,
-                               void* user_data) const;
-
-  // Note: Do not use outside chromium
-  EWebContext* GetImpl() { return impl; }
-#if defined(OS_TIZEN_TV)
-  FaviconDatabase* GetFaviconDatabase();
-#endif
-
-  unsigned int InspectorServerStart(unsigned int port) const;
-  bool InspectorServerStop() const;
-
- private:
-  EWebContext* impl;
-
-  WebContext(bool incognito);
-  ~WebContext();
-  friend class base::RefCounted<WebContext>;
-
-  DISALLOW_COPY_AND_ASSIGN(WebContext);
-};
-} // namespace tizen_webview
-
-#endif  // TIZEN_WEBVIEW_PUBLIC_TW_WEB_CONTEXT_H_
index 7f9062f..df4ac25 100644 (file)
@@ -18,7 +18,7 @@ using content::SelectionControllerEfl;
 
 namespace tizen_webview {
 
-WebView* WebView::Create(WebContext* wc, Evas_Object* eo) {
+WebView* WebView::Create(Ewk_Context* wc, Evas_Object* eo) {
   WebView* wv = new WebView();
   DCHECK(wv);
 
@@ -57,7 +57,7 @@ WebView* WebView::FromEvasObject(Evas_Object* eo) {
   return WebViewDelegate::GetInstance()->GetWebViewFromEvasObject(eo);
 }
 
-WebContext* WebView::GetWebContext() {
+Ewk_Context* WebView::GetWebContext() {
   return impl_->context();
 }
 
index 87a7e79..86380a9 100644 (file)
@@ -25,6 +25,7 @@ class WebContentDelegateEfl;
 struct SelectionStylePrams;
 // TODO END
 
+class Ewk_Context;
 class EWebView;
 class _Ewk_Frame;
 
@@ -39,14 +40,13 @@ class ContextMenuControllerEfl;
 
 namespace tizen_webview {
 
-class WebContext;
 class WebViewDelegate;
 class WebViewEvasEventHandler;
 
 class WebView {
  public:
   // ---- create/delete
-  static WebView* Create(WebContext* wc, Evas_Object* eo) WARN_UNUSED_RESULT;
+  static WebView* Create(Ewk_Context* wc, Evas_Object* eo) WARN_UNUSED_RESULT;
   static void Delete(WebView* wv);
 
   // initialize data members and activate event handlers.
@@ -56,7 +56,7 @@ class WebView {
   // ---- Get various objects related with this webview
   Evas_Object* AsEvasObject();
   static WebView* FromEvasObject(Evas_Object* eo);
-  WebContext* GetWebContext();
+  Ewk_Context* GetWebContext();
   bool SetPrivateBrowsing(bool incognito);
   bool GetPrivateBrowsing() const;
   Ewk_Settings* GetSettings();
index 69fb87c..774a4a0 100644 (file)
@@ -32,8 +32,6 @@
 #include "url/gurl.h"
 #include "browser/favicon/favicon_service.h"
 
-#include "tizen_webview/public/tw_web_context.h"
-
 #if defined(OS_TIZEN)
 #include "content/public/browser/media_capture_devices.h"
 #include "media/video/capture/tizen/video_capture_device_tizen.h"