[M130][NaCl][PPFwk] Enable VD Trusted Plugins functionality 98/323698/5
authorpc.ong <pc.ong@samsung.com>
Tue, 6 May 2025 05:54:52 +0000 (05:54 +0000)
committerBot Blink <blinkbot@samsung.com>
Thu, 22 May 2025 07:56:11 +0000 (07:56 +0000)
1. Enable VD Trusted Plugins functionality
2. Fix the issue of not being able to read json files correctly

References:
- https://archive.tizen.org/gerrit/#/c/platform/framework/web/chromium-efl/+/308293/
- https://archive.tizen.org/gerrit/#/c/platform/framework/web/chromium-efl/+/308800/

Change-Id: I033060af5b887852839acabce21f3490ad3d6e35
Signed-off-by: pc.ong <pc.ong@samsung.com>
19 files changed:
chrome/renderer/chrome_content_renderer_client.cc
content/browser/renderer_host/pepper/pepper_tcp_socket_message_filter.cc
content/ppapi_plugin/ppapi_thread.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
electron/shell/renderer/renderer_client_base.cc
ppapi/proxy/extension_system_resource.cc
ppapi/proxy/var_value_converter.cc
tizen_src/build/gn_chromiumefl.sh
tizen_src/chromium_impl/content/browser/renderer_host/pepper/pepper_extension_system_host.cc
tizen_src/chromium_impl/content/browser/renderer_host/pepper/pepper_extension_system_host.h
tizen_src/chromium_impl/content/browser/renderer_host/pepper/pepper_remote_controller_host.h
tizen_src/ewk/efl_integration/BUILD.gn
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/ewk_extension_system_delegate.h
tizen_src/ewk/efl_integration/public/ewk_value.cc

index 63758d5ce6580a09d0d473bcea31d94178fd834e..82d5d958c44ba1b638b7bb1309300bcc9f921e35 100644 (file)
@@ -1559,26 +1559,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 3d209f958d99ca53dbdaa3beb9953d8b7b1a7361..03c46d45f3f8ce7e509c1be4280b94046c008965 100644 (file)
@@ -809,7 +809,8 @@ void PepperTCPSocketMessageFilter::TryRead() {
 
     std::string_view chars_to_copy = base::as_string_view(
         buffer.first(std::min(buffer.size(), pending_read_size_)));
-    SendReadReply(PP_OK, std::string(chars_to_copy));
+    std::string chars_to_copy_string = std::string(chars_to_copy);
+    SendReadReply(PP_OK, ppapi::DataView(chars_to_copy_string.c_str(), chars_to_copy_string.size()));
     receive_stream_->EndReadData(chars_to_copy.size());
     break;
   }
@@ -846,7 +847,7 @@ void PepperTCPSocketMessageFilter::TryWrite() {
 
     DCHECK(write_watcher_);
 
-    auto view = base::cstring_view(pending_write_data_);
+    auto view = std::string_view(pending_write_data_.data);
     view.remove_prefix(pending_write_bytes_written_);
     DCHECK_GT(view.size(), 0u);
     size_t bytes_written = 0;
index de959d9ea3eb250937912ee650f32472fddb03ca..7ed83048e1cebd68cc88fbe00d1a1d0b3c1563f6 100644 (file)
@@ -59,7 +59,7 @@
 #if defined(TIZEN_PEPPER_EXTENSIONS)
 #include <sys/prctl.h>
 #include "base/files/file_path.h"
-#include "content/common/set_process_title_linux.h"
+#include "base/process/set_process_title_linux.h"
 #endif
 
 #if BUILDFLAG(IS_MAC)
index 38148c8ff49e804e2d17df2bcfe1113ec50563b8..4fb500473ad1be284433fec2b00d6bb03d9f30e1 100644 (file)
@@ -6,12 +6,10 @@
 
 #include <string_view>
 
-#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/media_switches.h"
 #include "media/base/renderer_factory.h"
index bf1c497005b6c16388e3092ab801aa8b840dbddd..71809571a846b65d68561765e6a3c1153d0c1d19 100644 (file)
@@ -565,15 +565,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 5c13fc5920470a90b8c716d38c03baf61ac9422c..36f79ab6160fb28821c837301ca3051353f76ccb 100644 (file)
@@ -263,8 +263,8 @@ int32_t PepperVideoDecoderHost::OnHostMsgInitialize(
       initialized_ = true;
       mojo_video_decoder_path_initialized_ = true;
       return PP_OK;
-#endif
     }
+#endif
     decoder_.reset();
     if (acceleration == PP_HARDWAREACCELERATION_ONLY)
       return PP_ERROR_NOTSUPPORTED;
index b49955a530802c0623d7540354e8b9c47fa56c63..736e4920d8efb9a80719ae86d1635e698169b089 100644 (file)
@@ -54,30 +54,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.
 // Can be in one of the 3 states:
@@ -380,11 +356,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;
   if (share_context) {
     PPB_Graphics3D_Impl* share_graphics =
index 0bee05dca368d31aec168fce4b8b2940dd8159c1..ec389d6fbdaf30dfb25be591fcffdf4c740a2a6e 100644 (file)
@@ -333,9 +333,6 @@ void RendererClientBase::RenderFrameCreated(
 #if defined(TOOLKIT_VIEWS) && !defined(ENABLE_WRT_JS)
   new AutofillAgent(render_frame,
                     render_frame->GetAssociatedInterfaceRegistry());
-#endif
-#if BUILDFLAG(ENABLE_PLUGINS) && (!defined(ENABLE_WRT_JS) || BUILDFLAG(ENABLE_PPAPI))
-  new PepperHelper(render_frame);
 #endif
   new ContentSettingsObserver(render_frame);
 #if BUILDFLAG(ENABLE_PRINTING)
index 1cc0953ca83fd6df0775c33f5da2d74361a2834d..f41b53eee0ce32f046cd935eef06e35f5bb7b4b8 100644 (file)
@@ -54,7 +54,7 @@ PP_Var ExtensionSystemResource::GetCurrentExtensionInfo() {
     if (sync_call_result != PP_OK)
       return PP_MakeUndefined();
 
-    base::StringPiece result_str(json_result);
+    std::string_view result_str(json_result);
     JSONStringValueDeserializer json_deserializer(result_str);
     std::unique_ptr<base::Value> result_ptr(
         json_deserializer.Deserialize(nullptr, nullptr));
@@ -119,7 +119,7 @@ int32_t ExtensionSystemResource::GenericSyncCall(PP_Var operation_name,
   if (sync_call_result != PP_OK)
     return sync_call_result;
 
-  base::StringPiece result_str(json_result);
+  std::string_view result_str(json_result);
   JSONStringValueDeserializer json_deserializer(result_str);
   std::unique_ptr<base::Value> result_ptr(
       json_deserializer.Deserialize(nullptr, nullptr));
index b4381e2b813a67f35a15c9b95d8227e978f63bfc..2d5a504884eea187671cd5db5275476416600839 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 fb89633dd91826bbfd844f2d4be720edfc510a24..cf203c423fff8694e71419fb019b4087a747d35c 100755 (executable)
@@ -126,7 +126,7 @@ COMMON_GN_PARAMETERS="use_libjpeg_turbo=true
                       use_cups=false
                       depth=\"${TOPDIR}\"
                       use_libpci=false
-                      enable_ppapi=false
+                      enable_ppapi=true
                      "
 
 add_desktop_flags() {
@@ -260,7 +260,7 @@ add_tizen_flags() {
                             "
 
   if [ "$tizen_product_tv" == "true" ]; then
-    ADDITIONAL_GN_PARAMETERS+="tizen_pepper_extensions=false
+    ADDITIONAL_GN_PARAMETERS+="tizen_pepper_extensions=true
                                samsung_elementary_media_stream_source=true
                               "
   fi
index bb2c7cf03c76987e031b2091e85a1e6c538f1288..6422a75553b29f721c6d5d8a79c0077a22c49240 100644 (file)
@@ -154,7 +154,7 @@ int32_t PepperExtensionSystemHost::OnHostMsgGenericSyncCall(
     ppapi::host::HostMessageContext* context,
     const std::string& operation_name,
     const std::string& operation_data) {
-  base::StringPiece data_str(operation_data);
+  std::string_view data_str(operation_data);
   JSONStringValueDeserializer json_deserializer(data_str);
 
   std::unique_ptr<base::Value> data(
index 3fd0a3070ea55f453943597770c196587258dc01..7272d508ac0cb2f82b68c96d5b318f238860c77c 100644 (file)
@@ -23,14 +23,17 @@ namespace content {
 class BrowserPpapiHost;
 
 class PepperExtensionSystemHost
-    : public ppapi::host::ResourceHost,
-      public base::SupportsWeakPtr<PepperExtensionSystemHost> {
+    : public ppapi::host::ResourceHost {
  public:
   PepperExtensionSystemHost(BrowserPpapiHost* host,
                             PP_Instance instance,
                             PP_Resource resource);
   ~PepperExtensionSystemHost() override;
 
+  base::WeakPtr<PepperExtensionSystemHost> AsWeakPtr() {
+    return weak_ptr_factory_.GetWeakPtr();
+  }
+
  protected:
   // ppapi::host::ResourceHost override.
   int32_t OnResourceMessageReceived(
@@ -71,6 +74,8 @@ class PepperExtensionSystemHost
   std::unordered_map<std::string, FunctionHandler> extension_function_handlers_;
 
   ExtensionSystemDelegateManager::RenderFrameID render_frame_id_;
+
+  base::WeakPtrFactory<PepperExtensionSystemHost> weak_ptr_factory_{this};
 };
 
 }  // namespace content
index c952545ae798c2a491494a6a3c23db5437bebd66..4bdc22c7b675527f1dab5a8e2e1d0bbd3cc853e3 100644 (file)
@@ -19,8 +19,7 @@ namespace content {
 class BrowserPpapiHost;
 
 class PepperRemoteControllerHost
-    : public ppapi::host::ResourceHost,
-      public base::SupportsWeakPtr<PepperRemoteControllerHost> {
+    : public ppapi::host::ResourceHost {
  public:
   PepperRemoteControllerHost(BrowserPpapiHost* host,
                              PP_Instance instance,
@@ -40,6 +39,10 @@ class PepperRemoteControllerHost
                                 const base::OnceCallback<void(int32_t)> cb) = 0;
   };
 
+  base::WeakPtr<PepperRemoteControllerHost> AsWeakPtr() {
+    return weak_ptr_factory_.GetWeakPtr();
+  }
+
  protected:
   // ppapi::host::ResourceHost override.
   int32_t OnResourceMessageReceived(
@@ -64,6 +67,8 @@ class PepperRemoteControllerHost
 
   BrowserPpapiHost* host_;
   std::unique_ptr<PlatformDelegate> delegate_;
+
+  base::WeakPtrFactory<PepperRemoteControllerHost> weak_ptr_factory_{this};
 };
 
 }  // namespace content
index 5856e6eab01519025d9dfdd7496992350b72d939..9f014ac36dd210d59d0c8117f8778e6d082b321b 100644 (file)
@@ -244,7 +244,6 @@ shared_library("chromium-ewk") {
     configs += [ "//tizen_src/build:cynara-client" ]
     configs += [ "//tizen_src/build:wayland-client" ]
     configs += [ "//tizen_src/build:tizen-extension-client" ]
-    configs += [ "//tizen_src/build:security-privilege-manager" ]
   }
 
   # TODO : Below dependency is set in chromium/device/battery_tizen.gypi,
index efd86af6c7fbbd1e22c74da5bcc36a1cf5db22bb..5c8bfeaff24c35f6677d2a2fab62be84c7bdfc13 100644 (file)
@@ -71,10 +71,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;
@@ -83,10 +83,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;
@@ -95,49 +95,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);
@@ -147,15 +134,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";
@@ -179,14 +166,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))
@@ -197,11 +180,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;
   }
@@ -222,15 +205,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";
@@ -260,7 +243,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";
@@ -403,9 +386,9 @@ TrustedPepperPluginInfoCache::TrustedPepperPluginInfoCache() {
 }
 
 void TrustedPepperPluginInfoCache::MaybeUpdateRw() {
-  char* kJsonPath = (char*)tzplatform_mkpath(
+  base::FilePath kJsonPath(tzplatform_mkpath(
       TZ_SYS_RW_APP,
-      "/appbinarymanager/webapi_result/upgrade_webapi_result.json");
+      "/appbinarymanager/webapi_result/upgrade_webapi_result.json"));
 
   base::stat_wrapper_t file_stat;
   if (base::File::Stat(kJsonPath, &file_stat) == -1) {
@@ -436,45 +419,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().FindDictByDottedPath("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)) {
@@ -539,11 +523,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 (!dict || !ValidatePluginType(pmf, dict))
     return false;
index f1d6d9e7a42dee93285d93cc322af3c9aa1e0cb4..48c3c73ccdc944be3414361e00df7b89e809dcc9 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;
 }
@@ -236,6 +236,10 @@ void EwkExtensionSystemDelegate::SetGenericSyncCallback(
   cb_data_ = data;
 }
 
+void EwkExtensionSystemDelegate::SetWindowId(const int window_id) {
+  window_id_ = window_id;
+}
+
 void EwkExtensionSystemDelegate::SetWindowId(const Evas_Object* main_window) {
 #if BUILDFLAG(IS_TIZEN_TV)
   Evas* evas = evas_object_evas_get(main_window);
index f84bec2f98386ed4a3cf0348a7673a571500603d..874163a11b13cc764a838322cf8abe92fa9fe747 100644 (file)
@@ -31,6 +31,7 @@ class EwkExtensionSystemDelegate : public content::ExtensionSystemDelegate {
   void SetGenericSyncCallback(Generic_Sync_Call_Callback cb, void* data);
 
   void SetWindowId(const Evas_Object* main_window);
+  void SetWindowId(const int window_id);
 
  private:
   Ewk_Value info_;
index ee3e22070dc7445867563e3cb70e258e47183c2e..b507e591fe92ffe5bd5290b6285987bdf997ee0c 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,7 +172,7 @@ 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
@@ -181,11 +181,11 @@ Eina_Bool ewk_value_array_get(Ewk_Value array,
         return EINA_FALSE;
 
     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;
@@ -216,12 +216,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) {
@@ -235,12 +235,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);
@@ -259,18 +258,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;
@@ -284,18 +283,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;
@@ -312,19 +310,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;
@@ -338,14 +334,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;
   }