[M108 Migration][HBBTV] Implement new ewk context api 35/288735/3
authorfr.fang <fr.fang@samsung.com>
Wed, 22 Feb 2023 01:24:18 +0000 (09:24 +0800)
committerBot Blink <blinkbot@samsung.com>
Thu, 23 Feb 2023 06:05:39 +0000 (06:05 +0000)
Support incognito mode in Injected bundle, implement the api of
ewk_context_new_with_injected_bundle_path_in_incognito_mode
for the request from hbbtv.

Reference:
https://review.tizen.org/gerrit/#/c/281230

Change-Id: I4f5153f0a88b2fbd655f8a597ba8d78955b122d4
Signed-off-by: fr.fang <fr.fang@samsung.com>
tizen_src/ewk/efl_integration/eweb_context.cc
tizen_src/ewk/efl_integration/eweb_context.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/public/ewk_context.cc

index 47e9c4c..b2c3b7d 100644 (file)
@@ -305,12 +305,6 @@ bool EWebContext::OverrideMimeForURL(const std::string& url_spec,
   return false;
 }
 
-EWebContext::EWebContext(bool incognito)
-    : EWebContext(incognito, std::string()) {}
-
-EWebContext::EWebContext(const std::string& injectedBundlePath)
-    : EWebContext(false, injectedBundlePath) {}
-
 EWebContext::EWebContext(bool incognito, const std::string& injectedBundlePath)
     : injected_bundle_path_(injectedBundlePath),
 #if BUILDFLAG(IS_TIZEN)
index 3e6cdf0..bb51d19 100644 (file)
@@ -206,8 +206,6 @@ class EWebContext {
   void SetMaxRefreshRate(int max_refresh_rate);
 
  private:
-  EWebContext(bool incognito);
-  EWebContext(const std::string& injectedBundlePath);
   EWebContext(bool incognito, const std::string& injectedBundlePath);
   ~EWebContext();
   friend class Ewk_Context;
index 9cc1f2d..be871bd 100644 (file)
@@ -60,8 +60,9 @@ Ewk_Context* Ewk_Context::Create(bool incognito) {
 }
 
 // static
-Ewk_Context* Ewk_Context::Create(const std::string& injectedBundlePath) {
-  Ewk_Context* context = new Ewk_Context(injectedBundlePath);
+Ewk_Context* Ewk_Context::Create(bool incognito,
+                                 const std::string& injected_bundle_path) {
+  Ewk_Context* context = new Ewk_Context(incognito, injected_bundle_path);
   context->AddRef();
   return context;
 }
@@ -80,12 +81,12 @@ void Ewk_Context::Delete(Ewk_Context* context) {
   }
 }
 
-Ewk_Context::Ewk_Context(bool incognito) : impl(new EWebContext(incognito)) {
-}
+Ewk_Context::Ewk_Context(bool incognito)
+    : impl(new EWebContext(incognito, std::string())) {}
 
-Ewk_Context::Ewk_Context(const std::string& injectedBundlePath)
-    : impl(new EWebContext(injectedBundlePath)) {
-}
+Ewk_Context::Ewk_Context(bool incognito,
+                         const std::string& injected_bundle_path)
+    : impl(new EWebContext(incognito, injected_bundle_path)) {}
 
 Ewk_Context::~Ewk_Context() {
   if (this == default_context_)
@@ -341,4 +342,4 @@ Ewk_Application_Type Ewk_Context::GetApplicationType() const {
 
 void Ewk_Context::SetMaxRefreshRate(int max_refresh_rate) {
   impl->SetMaxRefreshRate(max_refresh_rate);
-}
\ No newline at end of file
+}
index a7af91a..fc39ea3 100644 (file)
@@ -28,7 +28,8 @@ struct Ewk_Context : public base::RefCounted<Ewk_Context> {
   static Ewk_Context* IncognitoContext();
   static void DefaultContextRelease();
   static Ewk_Context* Create(bool incognito = false);
-  static Ewk_Context* Create(const std::string& injectedBundlePath);
+  static Ewk_Context* Create(bool incognito,
+                             const std::string& injected_bundle_path);
   static void Delete(Ewk_Context*);
 
   // Get related class
@@ -169,7 +170,7 @@ struct Ewk_Context : public base::RefCounted<Ewk_Context> {
   EWebContext* impl;
 
   Ewk_Context(bool incognito);
-  Ewk_Context(const std::string& injectedBundlePath);
+  Ewk_Context(bool incognito, const std::string& injected_bundle_path);
   ~Ewk_Context();
 
   Ewk_Context(const Ewk_Context&) = delete;
index caa783f..95dd572 100644 (file)
@@ -100,7 +100,8 @@ Ewk_Context* ewk_context_new()
 Ewk_Context *ewk_context_new_with_injected_bundle_path(const char *path)
 {
   EINA_SAFETY_ON_NULL_RETURN_VAL(path, NULL);
-  return Ewk_Context::Create(std::string(path));
+  // To create new Ewk_Context with default incognito = false.
+  return Ewk_Context::Create(false,std::string(path));
 }
 
 void ewk_context_delete(Ewk_Context* context)
@@ -742,8 +743,8 @@ void ewk_context_compression_proxy_data_size_reset(Ewk_Context* context)
 
 Ewk_Context *ewk_context_new_with_injected_bundle_path_in_incognito_mode(const char *path)
 {
-  LOG_EWK_API_MOCKUP();
-  return NULL;
+  EINA_SAFETY_ON_NULL_RETURN_VAL(path, NULL);
+  return Ewk_Context::Create(true, std::string(path));
 }
 
 Eina_Bool ewk_context_audio_latency_mode_set(Ewk_Context* context, Ewk_Audio_Latency_Mode latency_mode)