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)
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;
}
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;
#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)
#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"
"//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) {
initialized_ = true;
mojo_video_decoder_path_initialized_ = true;
return PP_OK;
-#endif
}
+#endif
decoder_.reset();
if (acceleration == PP_HARDWAREACCELERATION_ONLY)
return PP_ERROR_NOTSUPPORTED;
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:
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 =
#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)
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));
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));
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));
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 =
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));
}
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));
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();
}
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();
}
use_cups=false
depth=\"${TOPDIR}\"
use_libpci=false
- enable_ppapi=false
+ enable_ppapi=true
"
add_desktop_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
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(
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(
std::unordered_map<std::string, FunctionHandler> extension_function_handlers_;
ExtensionSystemDelegateManager::RenderFrameID render_frame_id_;
+
+ base::WeakPtrFactory<PepperExtensionSystemHost> weak_ptr_factory_{this};
};
} // 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,
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(
BrowserPpapiHost* host_;
std::unique_ptr<PlatformDelegate> delegate_;
+
+ base::WeakPtrFactory<PepperRemoteControllerHost> weak_ptr_factory_{this};
};
} // namespace content
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,
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;
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;
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);
}
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";
}
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))
}
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;
}
}
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";
}
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";
}
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) {
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)) {
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;
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 {
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;
}
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);
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_;
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);
}
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;
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;
}
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
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;
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) {
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);
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;
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;
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;
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;
}