[M120 Migration][NaCl][PPFwk] Enable VD Trusted Plugins functionality 93/308293/3
authorjinbei09 <jinbei09.dai@samsung.com>
Mon, 18 Mar 2024 13:12:15 +0000 (21:12 +0800)
committerBot Blink <blinkbot@samsung.com>
Thu, 28 Mar 2024 03:13:43 +0000 (03:13 +0000)
Migrated from tizen 8.0:
https://review.tizen.org/gerrit/#/c/platform/framework/web/chromium-efl/+/289527/

Change-Id: Idd760f65428cade6f2efa9df96dd8e15871fe795
Signed-off-by: jinbei09 <jinbei09.dai@samsung.com>
chrome/renderer/chrome_content_renderer_client.cc
content/public/renderer/content_renderer_client.cc
content/renderer/BUILD.gn
content/renderer/pepper/pepper_video_decoder_host.cc
content/renderer/pepper/ppb_graphics_3d_impl.cc
ppapi/proxy/var_value_converter.cc
tizen_src/build/gn_chromiumefl.sh
tizen_src/ewk/efl_integration/common/trusted_pepper_plugin_info_cache.cc
tizen_src/ewk/efl_integration/ewk_extension_system_delegate.cc
tizen_src/ewk/efl_integration/public/ewk_value.cc

index db900e7..a923e46 100644 (file)
@@ -1492,26 +1492,7 @@ bool ChromeContentRendererClient::IsExternalPepperPlugin(
 
 bool ChromeContentRendererClient::IsOriginIsolatedPepperPlugin(
     const base::FilePath& plugin_path) {
-  // Hosting plugins in-process is inherently incompatible with attempting to
-  // process-isolate plugins from different origins.
-  auto* cmdline = base::CommandLine::ForCurrentProcess();
-  if (cmdline->HasSwitch(switches::kPpapiInProcess)) {
-    // The kPpapiInProcess switch should only be used by tests.  In particular,
-    // we expect that the PDF plugin should always be isolated in the product
-    // (and that the switch won't interfere with PDF isolation).
-    CHECK_NE(ChromeContentClient::kPDFInternalPluginPath, plugin_path.value());
-
-    return false;
-  }
-
-#if BUILDFLAG(ENABLE_NACL)
-  // Don't isolate the NaCl plugin (preserving legacy behavior).
-  if (plugin_path.value() == nacl::kInternalNaClPluginFileName)
-    return false;
-#endif
-
-  // Isolate all the other plugins (including the PDF plugin + test plugins).
-  return true;
+  return plugin_path.value() == ChromeContentClient::kPDFInternalPluginPath;
 }
 
 #if BUILDFLAG(ENABLE_PLUGINS) && BUILDFLAG(ENABLE_EXTENSIONS)
index 85a765e..87b9bfe 100644 (file)
@@ -4,12 +4,10 @@
 
 #include "content/public/renderer/content_renderer_client.h"
 
-#include "base/command_line.h"
 #include "base/task/sequenced_task_runner.h"
 #include "base/task/single_thread_task_runner.h"
 #include "build/build_config.h"
 #include "build/chromecast_buildflags.h"
-#include "content/public/common/content_switches.h"
 #include "media/base/demuxer.h"
 #include "media/base/renderer_factory.h"
 #include "third_party/blink/public/common/security/protocol_handler_security_level.h"
index e5442c4..1cdb209 100644 (file)
@@ -538,15 +538,6 @@ target(link_target_type, "renderer") {
       "//ui/base/cursor",
       "//ui/base/cursor/mojom:cursor_type",
     ]
-
-    if (is_tizen) {
-      sources -= [
-        "pepper/video_decoder_shim.cc",
-        "pepper/video_decoder_shim.h",
-        "pepper/video_encoder_shim.cc",
-        "pepper/video_encoder_shim.h",
-      ]
-    }
   }
 
   if (is_win) {
index 36cd787..471ff14 100644 (file)
@@ -272,8 +272,8 @@ int32_t PepperVideoDecoderHost::OnHostMsgInitialize(
       context->reply_msg =
           PpapiPluginMsg_VideoDecoder_InitializeReply(use_shared_images_);
       return PP_OK;
-#endif
     }
+#endif
     decoder_.reset();
     if (acceleration == PP_HARDWAREACCELERATION_ONLY)
       return PP_ERROR_NOTSUPPORTED;
index 2a73734..d074107 100644 (file)
@@ -47,29 +47,6 @@ using blink::WebString;
 
 namespace content {
 
-namespace {
-
-#if BUILDFLAG(IS_TIZEN_TV)
-const int32_t kMaxTextureSamples = 4;
-#endif
-
-bool UseSharedImagesSwapChainForPPAPI() {
-  if (base::CommandLine::ForCurrentProcess()->HasSwitch(
-          switches::kDisablePPAPISharedImagesSwapChain)) {
-    // This log is to make diagnosing any outages for Enterprise customers
-    // easier.
-    LOG(WARNING) << "NaCL SwapChain: Disabled by policy";
-    return false;
-  }
-
-  auto enabled =
-      base::FeatureList::IsEnabled(features::kPPAPISharedImagesSwapChain);
-  // This log is to make diagnosing any outages for Enterprise customers easier.
-  LOG(WARNING) << "NaCL SwapChain: Feature Controled: " << enabled;
-  return enabled;
-}
-
-}  // namespace
 
 // This class encapsulates ColorBuffer for the plugin. It wraps corresponding
 // SharedImage that we draw to and that we send to display compositor.
@@ -371,11 +348,6 @@ bool PPB_Graphics3D_Impl::InitRaw(
   gpu::ContextCreationAttribs attrib_helper;
   attrib_helper.context_type = gpu::CONTEXT_TYPE_OPENGLES2;
 
-#if BUILDFLAG(IS_TIZEN_TV)
-  if (attrib_helper.samples > 1 && attrib_helper.sample_buffers > 1)
-    attrib_helper.samples = std::min(attrib_helper.samples, kMaxTextureSamples);
-#endif
-
   gpu::CommandBufferProxyImpl* share_buffer = nullptr;
   UMA_HISTOGRAM_BOOLEAN("Pepper.Graphics3DHasShareGroup", !!share_context);
   if (share_context) {
index b4381e2..2d5a504 100644 (file)
@@ -15,29 +15,24 @@ namespace proxy {
 
 namespace {
 
-std::unique_ptr<base::Value::List> ValueFromVarArray(const PP_Var& var) {
-#if !defined(EWK_BRINGUP)
-  LOG(ERROR) << " Remove EWK_BRINGUP ";
+std::unique_ptr<base::Value> ValueFromVarArray(const PP_Var& var) {
   if (var.type == PP_VARTYPE_ARRAY) {
     scoped_refptr<ArrayVar> array =
         scoped_refptr<ArrayVar>(ArrayVar::FromPPVar(var));
     if (!array) {
       return std::make_unique<base::Value>();
     }
-    auto ret = std::make_unique<base::ListValue>();
+    base::Value::List ret;
     for (size_t i = 0; i < array->GetLength(); ++i) {
       ScopedPPVar var(ScopedPPVar::PassRef(), array->Get(i));
-      ret->Append(std::move(*ValueFromVar(var.get())));
+      ret.Append(std::move(*ValueFromVar(var.get())));
     }
-    return std::move(ret);
+    return std::make_unique<base::Value>(std::move(ret));
   }
-#endif
-  return std::make_unique<base::Value::List>();
+  return std::make_unique<base::Value>();
 }
 
-std::unique_ptr<base::Value::Dict> ValueFromVarDictionary(const PP_Var& var) {
-#if !defined(EWK_BRINGUP)
-  LOG(ERROR) << " Remove EWK_BRINGUP ";
+std::unique_ptr<base::Value> ValueFromVarDictionary(const PP_Var& var) {
   if (var.type == PP_VARTYPE_DICTIONARY) {
     scoped_refptr<DictionaryVar> dict =
         scoped_refptr<DictionaryVar>(DictionaryVar::FromPPVar(var));
@@ -51,7 +46,7 @@ std::unique_ptr<base::Value::Dict> ValueFromVarDictionary(const PP_Var& var) {
       return std::make_unique<base::Value>();
     }
 
-    auto ret = std::make_unique<base::DictionaryValue>();
+    base::Value::Dict ret;
     for (size_t i = 0; i < keys->GetLength(); ++i) {
       ScopedPPVar var_k(ScopedPPVar::PassRef(), keys->Get(i));
       scoped_refptr<StringVar> key =
@@ -64,50 +59,43 @@ std::unique_ptr<base::Value::Dict> ValueFromVarDictionary(const PP_Var& var) {
       ScopedPPVar var_v(ScopedPPVar::PassRef(), dict->Get(var_k.get()));
       // SetWithoutPathExpansion is used instead of Set here to allow
       // e.g. URLs to be used as keys. Set method treats '.' as keys separator.
-      ret->SetKey(key_string, std::move(*ValueFromVar(var_v.get())));
+      ret.Set(key_string, std::move(*ValueFromVar(var_v.get())));
     }
-    return std::move(ret);
+    return std::make_unique<base::Value>(std::move(ret));
   }
-#endif
-  return std::make_unique<base::Value::Dict>();
+  return std::make_unique<base::Value>();
 }
 
 ScopedPPVar VarFromValueArray(const base::Value* value) {
-#if !defined(EWK_BRINGUP)
-  LOG(ERROR) << " Remove EWK_BRINGUP ";
   if (!value)
     return ScopedPPVar();
 
   if (value->type() == base::Value::Type::LIST) {
     scoped_refptr<ArrayVar> ret(new ArrayVar);
-    const base::ListValue* list = static_cast<const base::ListValue*>(value);
-       size_t size = list->GetList().size();
+    const base::Value::List* list = value->GetIfList();
+    size_t size = list->size();
     ret->SetLength(size);
     for (size_t i = 0; i < size; ++i) {
       const base::Value* val;
-      val = const_cast<base::Value*>(&(list->GetList().operator[](i)));
+      val = const_cast<base::Value*>(&(list->operator[](i)));
       ScopedPPVar var = VarFromValue(val);
       ret->Set(i, var.get());
     }
 
     return ScopedPPVar(ScopedPPVar::PassRef(), ret->GetPPVar());
   }
-#endif
   return ScopedPPVar();
 }
 
 ScopedPPVar VarFromValueDictionary(const base::Value* value) {
-#if !defined(EWK_BRINGUP)
-  LOG(ERROR) << " Remove EWK_BRINGUP ";
   if (!value)
     return ScopedPPVar();
 
-  if (value->type() == base::Value::Type::DICTIONARY) {
+  if (value->type() == base::Value::Type::DICT) {
     scoped_refptr<DictionaryVar> ret(new DictionaryVar);
-    const base::DictionaryValue* dict;
-    value->GetAsDictionary(&dict);
-    base::detail::const_dict_iterator it = dict->DictItems().begin();
-    while (it!=dict->DictItems().end()) {
+    const base::Value::Dict* dict = value->GetIfDict();
+    base::detail::const_dict_iterator it = dict->begin();
+    while (it!=dict->end()) {
       ScopedPPVar var_k(ScopedPPVar::PassRef(),
                         StringVar::StringToPPVar(it->first));
       ScopedPPVar var_v = VarFromValue(&(it->second));
@@ -116,15 +104,12 @@ ScopedPPVar VarFromValueDictionary(const base::Value* value) {
     }
     return ScopedPPVar(ScopedPPVar::PassRef(), ret->GetPPVar());
   }
-#endif
   return ScopedPPVar();
 }
 
 }  // namespace
 
 std::unique_ptr<base::Value> ValueFromVar(const PP_Var& var) {
-#if !defined(EWK_BRINGUP)
-  LOG(ERROR) << " Remove EWK_BRINGUP ";
   switch (var.type) {
     case PP_VARTYPE_BOOL:
       return std::make_unique<base::Value>(PP_ToBool(var.value.as_bool));
@@ -145,13 +130,10 @@ std::unique_ptr<base::Value> ValueFromVar(const PP_Var& var) {
     default:
       return std::make_unique<base::Value>();
   }
-#endif
   return std::make_unique<base::Value>();
 }
 
 ScopedPPVar VarFromValue(const base::Value* value) {
-#if !defined(EWK_BRINGUP)
-  LOG(ERROR) << " Remove EWK_BRINGUP ";
   if (!value)
     return ScopedPPVar();
 
@@ -174,12 +156,11 @@ ScopedPPVar VarFromValue(const base::Value* value) {
     }
     case base::Value::Type::LIST:
       return VarFromValueArray(value);
-    case base::Value::Type::DICTIONARY:
+    case base::Value::Type::DICT:
       return VarFromValueDictionary(value);
     default:
       return ScopedPPVar();
   }
-#endif
   return ScopedPPVar();
 }
 
index ec70017..bc8e429 100755 (executable)
@@ -122,7 +122,6 @@ COMMON_GN_PARAMETERS="use_libjpeg_turbo=true
                       use_cups=false
                       depth=\"${TOPDIR}\"
                       use_libpci=false
-                      enable_ppapi=false
                      "
 
 add_desktop_flags() {
@@ -255,7 +254,7 @@ add_tizen_flags() {
                             "
 
   if [ "$tizen_product_tv" == "true" ]; then
-    ADDITIONAL_GN_PARAMETERS+="tizen_pepper_extensions=false
+    ADDITIONAL_GN_PARAMETERS+="tizen_pepper_extensions=true
                               "
   fi
 
index 08986db..8a30865 100644 (file)
@@ -72,10 +72,10 @@ const char kPepperManifestMimesExtensionsKey[] = "extensions";
 using Hash = std::hash<FilePath>;
 using FilesContainer = std::unordered_set<FilePath, Hash>;
 
-bool GetStringValue(const base::DictionaryValue* dict,
+bool GetStringValue(const base::Value::Dict* dict,
                     const std::string& key,
                     std::string* out_value) {
-  const std::string* val = dict->FindStringPath(key);
+  const std::string* val = dict->FindStringByDottedPath(key);
   if (nullptr != val && !val->empty()) {
     *out_value = *val;
     return true;
@@ -84,10 +84,10 @@ bool GetStringValue(const base::DictionaryValue* dict,
   return false;
 }
 
-bool GetStringValue(const base::ListValue* list,
+bool GetStringValue(const base::Value::List* list,
                     size_t i,
                     std::string* out_value) {
-  std::string val = list->GetList().operator[](i).GetString();
+  std::string val = list->operator[](i).GetString();
   if (!val.empty()) {
     *out_value = val;
     return true;
@@ -96,49 +96,36 @@ bool GetStringValue(const base::ListValue* list,
   return false;
 }
 
-bool GetListValue(const base::DictionaryValue* dict,
-                  const std::string& key,
-                  const base::ListValue** out_value) {
-  const base::ListValue* val = static_cast<const base::ListValue*>(dict->FindListKey(key));
-  if (val) {
-    *out_value = val;
-    return true;
-  }
+const base::Value::List* GetListValue(const base::Value::Dict* dict,
+                  const std::string& key) {
+  const base::Value::List* val = dict->FindList(key);
 
-  return false;
+  return val ? val : nullptr;
 }
 
-bool GetDictionaryValue(const base::DictionaryValue* dict,
-                        const std::string& key,
-                        const base::DictionaryValue** out_value) {
-  const base::DictionaryValue* val = static_cast<const base::DictionaryValue*>(dict->FindDictKey(key));
-  if (val) {
-    *out_value = val;
-    return true;
-  }
+const base::Value::Dict* GetDictionaryValue(const base::Value::Dict* dict,
+                        const std::string& key) {
+  const base::Value::Dict* val = dict->FindDict(key);
 
-  return false;
+  return val ? val : nullptr;
 }
 
-bool GetDictionaryValue(const base::ListValue* list,
-                        size_t i,
-                        const base::DictionaryValue** out_value) {
-  const base::Value* val;
-  val = const_cast<base::Value*>(&(list->GetList().operator[](i)));
-  
+const base::Value::Dict* GetDictionaryValue(const base::Value::List* list,
+                        size_t i) {
+  const base::Value* val = const_cast<base::Value*>(&(list->operator[](i)));
+
   if(val && val->is_dict()) {
-    *out_value = static_cast<const base::DictionaryValue*>(val);
-       return true;
+    return val->GetIfDict();
   }
-  return false;
+  return nullptr;
 }
 
-void GetMimeTypeExtensions(const base::DictionaryValue* dict,
+void GetMimeTypeExtensions(const base::Value::Dict* dict,
                            std::vector<std::string>* out_exensions) {
-  const base::ListValue* list;
+  const base::Value::List* list = GetListValue(dict, kPepperManifestMimesExtensionsKey);
   std::string val;
-  if (GetListValue(dict, kPepperManifestMimesExtensionsKey, &list)) {
-       size_t size = list->GetList().size();
+  if (list) {
+    size_t size = list->size();
     for (size_t i = 0; i < size; ++i)
       if (GetStringValue(list, i, &val))
         out_exensions->push_back(val);
@@ -148,15 +135,15 @@ void GetMimeTypeExtensions(const base::DictionaryValue* dict,
 }
 
 bool GetWebPluginMimeType(const FilePath& pmf,
-                          const base::ListValue* mimes,
+                          const base::Value::List* mimes,
                           size_t i,
                           WebPluginMimeType* plugin_mime) {
   std::string type;
   std::string description;
   std::vector<std::string> extensions;
 
-  const base::DictionaryValue* dict = nullptr;
-  if (GetDictionaryValue(mimes, i, &dict)) {
+  const base::Value::Dict* dict = GetDictionaryValue(mimes, i);
+  if (dict) {
     // "type" : (mandatory)
     if (!GetStringValue(dict, kPepperManifestMimesTypeKey, &type)) {
       PARSING_ERROR(pmf) << "MIME type attribute not found";
@@ -180,14 +167,10 @@ bool GetWebPluginMimeType(const FilePath& pmf,
 }
 
 bool GetPuginMimeTypes(const FilePath& pmf,
-                       const base::ListValue* mimes_list,
+                       const base::Value::List* mimes_list,
                        std::vector<WebPluginMimeType>* mime_types) {
-  if (mimes_list->type() != base::Value::Type::LIST) {
-    PARSING_ERROR(pmf) << "The mimes must be a list";
-    return false;
-  }
 
-  size_t size = mimes_list->GetList().size();
+  size_t size = mimes_list->size();
   for (size_t i = 0; i < size; ++i) {
     WebPluginMimeType mime_type;
     if (GetWebPluginMimeType(pmf, mimes_list, i, &mime_type))
@@ -198,11 +181,11 @@ bool GetPuginMimeTypes(const FilePath& pmf,
 }
 
 bool ReadPluginMimeTypes(const FilePath& pmf,
-                         const base::DictionaryValue* dict,
+                         const base::Value::Dict* dict,
                          ContentPluginInfo* info) {
   // Get the MIME types.
-  const base::ListValue* mimes_list = nullptr;
-  if (!GetListValue(dict, kPepperManifestMimesKey, &mimes_list)) {
+  const base::Value::List* mimes_list = GetListValue(dict, kPepperManifestMimesKey);
+  if (!mimes_list) {
     PARSING_ERROR(pmf) << "Can't read the MIME types list";
     return false;
   }
@@ -223,15 +206,15 @@ bool ReadPluginMimeTypes(const FilePath& pmf,
 }
 
 bool ReadPluginPath(const FilePath& pmf,
-                    const base::DictionaryValue* dict,
+                    const base::Value::Dict* dict,
                     ContentPluginInfo* info) {
   // Path to the plugin. The url attribute has higher priority
   // than the manifest name.
-  const base::DictionaryValue* program_dict;
-  if (!GetDictionaryValue(dict, kPepperManifestProgramKey, &program_dict)) {
-       auto key = dict->FindKey(kPepperManifestProgramKey);
-       bool has_key = (key != nullptr ? true:false);
-       
+  const base::Value::Dict* program_dict = GetDictionaryValue(dict, kPepperManifestProgramKey);
+  if (!program_dict) {
+    auto key = dict->Find(kPepperManifestProgramKey);
+    bool has_key = (key != nullptr ? true:false);
+
     if (has_key) {
       PARSING_ERROR(pmf) << "invalid \"program\" key present:"
                          << " not a dictionary";
@@ -261,7 +244,7 @@ bool ReadPluginPath(const FilePath& pmf,
 }
 
 bool ValidatePluginType(const FilePath& pmf,
-                        const base::DictionaryValue* dict) {
+                        const base::Value::Dict* dict) {
   std::string val;
   if (!GetStringValue(dict, kPepperManifestTypeKey, &val)) {
     PARSING_ERROR(pmf) << "No type attribute in the PMF file";
@@ -437,45 +420,46 @@ void TrustedPepperPluginInfoCache::MaybeUpdateRw() {
     return;
   }
 
-  base::Value* dict = root->FindDictKey("forceupdate_webapi");
+  base::Value::Dict* dict = root->GetDict().FindDict("forceupdate_webapi");
   if (!dict) {
     LOG(ERROR) << "readJsonFile, no obj under key forceupdate_webapi";
     return;
   }
-  base::Value* list = dict->FindListKey("pepper");
+  base::Value::List* list = dict->FindList("pepper");
   if (!list) {
     LOG(ERROR) << "readJsonFile, no list under key pepper";
     return;
   }
-  for (base::Value& plugin : list->GetList()) {
-    if (!plugin.is_dict())
+  for (auto& plugin : *list) {
+    auto* plugin_dict = plugin.GetIfDict();
+    if (!plugin_dict)
       continue;
-    std::string* dir = plugin.FindStringKey("path");
-    std::string* dir_sys = plugin.FindStringKey("systempath");
-    if (dir_sys && plugin.FindBoolKey("system").value_or(false))
+    std::string* dir = plugin_dict->FindString("path");
+    std::string* dir_sys = plugin_dict->FindString("systempath");
+    if (dir_sys && plugin_dict->FindBool("system").value_or(false))
       AddPluginsFromDirectory(*dir_sys, kSRO);
     if (!dir || (dir_sys && (dir->compare(*dir_sys) == 0)))
       // no rw installed. rw path IS sro path
       continue;
-    bool force = plugin.FindBoolKey("forceupdate").value_or(false);
+    bool force = plugin_dict->FindBool("forceupdate").value_or(false);
     if (AddPluginsFromDirectory(*dir, kRW) && force)
       judge_map_.insert({*dir, true});
   }
 
-  dict = root->FindDictPath("upgradable_webapi_applist.pepper");
+  dict = root->GetDict().FindDict("upgradable_webapi_applist.pepper");
   if (!dict) {
     LOG(ERROR)
         << "readJsonFile, no obj under key upgradable_webapi_applist.pepper";
     return;
   }
-  for (auto kv : dict->DictItems()) {
+  for (auto kv : *dict) {
     base::Value& tpk_list = kv.second;
     if (!tpk_list.is_list())
       continue;
-    for (base::Value& tpk : tpk_list.GetList()) {
+    for (auto& tpk : tpk_list.GetList()) {
       if (!tpk.is_dict())
         continue;
-      std::string* dir = tpk.FindStringKey("path");
+      std::string* dir = tpk.GetDict().FindString("path");
       if (!dir)
         continue;
       if (!judge_map_.count(*dir)) {
@@ -540,11 +524,12 @@ bool ParsePepperPluginManifest(const FilePath& pmf,
     return false;
   }
 
-  base::DictionaryValue* dict = 0;
-  if (!root.value().GetAsDictionary(&dict) || !dict) {
+  if (!root.value().is_dict()) {
     PARSING_ERROR(pmf) << "Can't to get the root node as an object.";
     return false;
   }
+  const base::Value::Dict* dict = root.value().GetIfDict();
+
 
   if (!ValidatePluginType(pmf, dict))
     return false;
index f5fae93..5fd389d 100644 (file)
@@ -172,9 +172,9 @@ std::unique_ptr<base::Value> EwkExtensionSystemDelegate::GetExtensionInfo()
   base::AutoLock guard{access_lock_};
   if (!info_)
     return std::make_unique<base::Value>();
-  return static_cast<const EwkValuePrivate*>(info_)
-      ->GetValue()
-      ->CreateDeepCopy();
+  base::Value* value = static_cast<const EwkValuePrivate*>(info_)
+      ->GetValue();
+  return std::make_unique<base::Value>(value->Clone());
 }
 
 int EwkExtensionSystemDelegate::GetWindowId() const {
@@ -189,14 +189,14 @@ std::unique_ptr<base::Value> EwkExtensionSystemDelegate::GenericSyncCall(
     return std::make_unique<base::Value>();
 
   Ewk_Value arg = static_cast<Ewk_Value>(
-      new EwkValuePrivate(data.CreateDeepCopy()));
+      new EwkValuePrivate(std::make_unique<base::Value>(data.Clone())));
   ewk_value_ref(arg);
   Ewk_Value result = cb_(name.c_str(), arg, cb_data_);
   ewk_value_unref(arg);
   if (!result)
     return std::make_unique<base::Value>();
-  std::unique_ptr<base::Value> ret =
-      static_cast<const EwkValuePrivate*>(result)->GetValue()->CreateDeepCopy();
+  base::Value* value = static_cast<const EwkValuePrivate*>(result)->GetValue();
+  std::unique_ptr<base::Value> ret = std::make_unique<base::Value>(value->Clone());
   ewk_value_unref(result);
   return ret;
 }
index fb025b2..f53853c 100644 (file)
@@ -125,7 +125,7 @@ Eina_Stringshare* ewk_value_string_value_get(Ewk_Value value) {
 
 Ewk_Value ewk_value_array_new() {
   Ewk_Value val = static_cast<Ewk_Value>(
-      new EwkValuePrivate(std::unique_ptr<base::Value>(new base::ListValue())));
+      new EwkValuePrivate(std::unique_ptr<base::Value>(new base::Value(base::Value::Type::LIST))));
   return ewk_value_ref(val);
 }
 
@@ -142,12 +142,12 @@ Eina_Bool ewk_value_array_is_mutable(Ewk_Value array) {
 Eina_Bool ewk_value_array_append(Ewk_Value array, Ewk_Value value) {
   EINA_SAFETY_ON_FALSE_RETURN_VAL(ewk_value_array_is_mutable(array),
                                   EINA_FALSE);
-  base::ListValue* list;
+  base::Value::List* list;
   bool result = EwkValueCast(array)->GetValue()->is_list();
   if (result) {
     // TODO(m.majczak) consider a workaround for the deep copy
-       base::ListValue* list = static_cast<base::ListValue*>(EwkValueCast(array)->GetValue());
-    list->Append(std::move(*(EwkValueCast(value)->GetValue()->CreateDeepCopy())));
+    base::Value::List* list = EwkValueCast(array)->GetValue()->GetIfList();
+    list->Append(std::move(*(std::make_unique<base::Value>(EwkValueCast(value)->GetValue()->Clone()))));;
     return EINA_TRUE;
   } else {
     return EINA_FALSE;
@@ -156,11 +156,11 @@ Eina_Bool ewk_value_array_append(Ewk_Value array, Ewk_Value value) {
 
 size_t ewk_value_array_count(Ewk_Value array) {
   EWK_VALUE_TYPE_CHECK_RETURN_VAL(array, ewk_value_array_type_get(), 0);
-  base::ListValue* list;
+  base::Value::List* list;
   bool result = EwkValueCast(array)->GetValue()->is_list();
   if (result) {
-       list = static_cast<base::ListValue*>(EwkValueCast(array)->GetValue());
-    return list->GetList().size();
+    list = static_cast<base::Value::List*>(EwkValueCast(array)->GetValue()->GetIfList());
+    return list->size();
   } else {
     return 0;
   }
@@ -172,17 +172,17 @@ Eina_Bool ewk_value_array_get(Ewk_Value array,
   EINA_SAFETY_ON_FALSE_RETURN_VAL(position < ewk_value_array_count(array),
                                   EINA_FALSE);
   EINA_SAFETY_ON_NULL_RETURN_VAL(dst, EINA_FALSE);
-  base::ListValue* list;
+  base::Value::List* list;
   bool result = EwkValueCast(array)->GetValue()->is_list();
   if (result) {
     // TODO(m.majczak) consider a workaround for the deep copy
-       list = static_cast<base::ListValue*>(EwkValueCast(array)->GetValue());
+    list = EwkValueCast(array)->GetValue()->GetIfList();
     base::Value* val = nullptr;
-    val = &(list->GetList().operator[](position));
+    val = &(list->operator[](position));
     if (!val)
       return EINA_FALSE;
     Ewk_Value ret = static_cast<Ewk_Value>(
-        new EwkValuePrivate(std::unique_ptr<base::Value>(val->CreateDeepCopy())));
+        new EwkValuePrivate(std::unique_ptr<base::Value>(std::make_unique<base::Value>(val->Clone()))));
     // warning!!! the ownership is passed to the caller here
     ewk_value_ref(ret);
     *dst = ret;
@@ -213,12 +213,12 @@ Eina_Bool ewk_value_array_remove(Ewk_Value array, size_t position) {
 
 Ewk_Value ewk_value_dictionary_new() {
   Ewk_Value val = static_cast<Ewk_Value>(new EwkValuePrivate(
-      std::unique_ptr<base::Value>(new base::DictionaryValue())));
+      std::unique_ptr<base::Value>(new base::Value(base::Value::Type::DICT))));
   return ewk_value_ref(val);
 }
 
 Ewk_Value_Type ewk_value_dictionary_type_get() {
-  return static_cast<Ewk_Value_Type>(base::Value::Type::DICTIONARY);
+  return static_cast<Ewk_Value_Type>(base::Value::Type::DICT);
 }
 
 Eina_Bool ewk_value_dictionary_is_mutable(Ewk_Value dictionary) {
@@ -232,12 +232,11 @@ Eina_Bool ewk_value_dictionary_keys(Ewk_Value dictionary, Ewk_Value* keys) {
                                   EINA_FALSE);
   EINA_SAFETY_ON_NULL_RETURN_VAL(keys, EINA_FALSE);
   // warning!!! This is very expensive operation.
-  base::DictionaryValue* dict;
-  bool result = EwkValueCast(dictionary)->GetValue()->GetAsDictionary(&dict);
-  if (result) {
+  base::Value::Dict* dict = EwkValueCast(dictionary)->GetValue()->GetIfDict();
+  if (dict) {
     *keys = ewk_value_array_new();
-    base::detail::dict_iterator it = dict->DictItems().begin();
-    while (it!=dict->DictItems().end()) {
+    base::detail::dict_iterator it = dict->begin();
+    while (it!=dict->end()) {
           Ewk_Value str = ewk_value_string_new(it->first.c_str());
           ewk_value_array_append(*keys, str);
           ewk_value_unref(str);
@@ -256,18 +255,18 @@ Eina_Bool ewk_value_dictionary_set(Ewk_Value dictionary,
   EINA_SAFETY_ON_FALSE_RETURN_VAL(ewk_value_dictionary_is_mutable(dictionary),
                                   EINA_FALSE);
   EWK_VALUE_TYPE_CHECK_RETURN_VAL(key, ewk_value_string_type_get(), EINA_FALSE);
-  base::DictionaryValue* dict;
+  base::Value::Dict* dict;
   std::string k;
   bool result1 = EwkValueCast(dictionary)->GetValue()->is_dict();
   bool result2 = EwkValueCast(key)->GetValue()->is_string();
   if (result1 && result2) {
-       dict = static_cast<base::DictionaryValue*>(EwkValueCast(dictionary)->GetValue());
-       k = *(EwkValueCast(key)->GetValue()->GetIfString());
+    dict = EwkValueCast(dictionary)->GetValue()->GetIfDict();
+    k = *(EwkValueCast(key)->GetValue()->GetIfString());
     // TODO(m.majczak) consider a workaround for the deep copy
-       auto val = dict->FindKey(k);
-       auto haskey = (val != nullptr)?true:false;
+    auto val = dict->Find(k);
+    auto haskey = (val != nullptr)?true:false;
     *new_entry = Eina_FromBool(!haskey);
-    dict->Set(k, EwkValueCast(value)->GetValue()->CreateDeepCopy());
+    dict->Set(k, EwkValueCast(value)->GetValue()->Clone());
     return EINA_TRUE;
   } else {
     return EINA_FALSE;
@@ -281,18 +280,17 @@ Eina_Bool ewk_value_dictionary_add(Ewk_Value dictionary,
   EINA_SAFETY_ON_FALSE_RETURN_VAL(ewk_value_dictionary_is_mutable(dictionary),
                                   EINA_FALSE);
   EWK_VALUE_TYPE_CHECK_RETURN_VAL(key, ewk_value_string_type_get(), EINA_FALSE);
-  base::DictionaryValue* dict;
+  base::Value::Dict* dict = EwkValueCast(dictionary)->GetValue()->GetIfDict();
   std::string k;
-  bool result1 = EwkValueCast(dictionary)->GetValue()->GetAsDictionary(&dict);
   bool result2 = EwkValueCast(key)->GetValue()->is_string();
-  if (result1 && result2) {
-       k = *(EwkValueCast(key)->GetValue()->GetIfString());
-       auto val = dict->FindKey(k);
-       auto haskey = (val != nullptr)?true:false;
+  if (dict && result2) {
+    k = *(EwkValueCast(key)->GetValue()->GetIfString());
+    auto val = dict->Find(k);
+    auto haskey = (val != nullptr)?true:false;
     if (!haskey) {
       *new_entry = EINA_TRUE;
       // TODO(m.majczak) consider a workaround for the deep copy
-      dict->Set(k, EwkValueCast(value)->GetValue()->CreateDeepCopy());
+      dict->Set(k, EwkValueCast(value)->GetValue()->Clone());
       return EINA_TRUE;
     }
     *new_entry = EINA_FALSE;
@@ -309,19 +307,17 @@ Eina_Bool ewk_value_dictionary_get(Ewk_Value dictionary,
                                   EINA_FALSE);
   EWK_VALUE_TYPE_CHECK_RETURN_VAL(key, ewk_value_string_type_get(), EINA_FALSE);
   EINA_SAFETY_ON_NULL_RETURN_VAL(dst, EINA_FALSE);
-  base::DictionaryValue* dict;
+  base::Value::Dict* dict = EwkValueCast(dictionary)->GetValue()->GetIfDict();
   std::string k;
-  bool result1 = EwkValueCast(dictionary)->GetValue()->GetAsDictionary(&dict);
   bool result2 = EwkValueCast(key)->GetValue()->is_string();
-  if (result1 && result2) {
-       k = *(EwkValueCast(key)->GetValue()->GetIfString());
-    base::Value* val = nullptr;
-    dict->Get(k, &val);
+  if (dict && result2) {
+    k = *(EwkValueCast(key)->GetValue()->GetIfString());
+    base::Value* val = dict->FindByDottedPath(k);
     if (!val)
       return EINA_FALSE;
     // TODO(m.majczak) consider a workaround for the deep copy
     Ewk_Value ret = static_cast<Ewk_Value>(
-        new EwkValuePrivate(std::unique_ptr<base::Value>(val->CreateDeepCopy())));
+        new EwkValuePrivate(std::unique_ptr<base::Value>(std::make_unique<base::Value>(val->Clone()))));
     // warning!!! the ownership is passed to the caller here
     ewk_value_ref(ret);
     *dst = ret;
@@ -335,14 +331,13 @@ Eina_Bool ewk_value_dictionary_remove(Ewk_Value dictionary, Ewk_Value key) {
   EINA_SAFETY_ON_FALSE_RETURN_VAL(ewk_value_dictionary_is_mutable(dictionary),
                                   EINA_FALSE);
   EWK_VALUE_TYPE_CHECK_RETURN_VAL(key, ewk_value_string_type_get(), EINA_FALSE);
-  base::DictionaryValue* dict;
+  base::Value::Dict* dict = EwkValueCast(dictionary)->GetValue()->GetIfDict();
   std::string k;
-  bool result1 = EwkValueCast(dictionary)->GetValue()->GetAsDictionary(&dict);
   bool result2 = EwkValueCast(key)->GetValue()->is_string();
-  if (result1 && result2) {
-       k = *(EwkValueCast(key)->GetValue()->GetIfString());
+  if (dict && result2) {
+    k = *(EwkValueCast(key)->GetValue()->GetIfString());
     // warning!!! value is completely deleted here
-    return Eina_FromBool(dict->RemoveKey(k));
+    return Eina_FromBool(dict->Remove(k));
   } else {
     return EINA_FALSE;
   }