2012-04-03 03:34:16 +02:00
|
|
|
// Copyright (c) 2012 The Chromium Embedded Framework Authors. All rights
|
|
|
|
// reserved. Use of this source code is governed by a BSD-style license that
|
|
|
|
// can be found in the LICENSE file.
|
|
|
|
|
2017-05-17 11:29:28 +02:00
|
|
|
#include "libcef/common/process_message_impl.h"
|
2017-05-19 11:06:00 +02:00
|
|
|
#include "libcef/common/cef_messages.h"
|
2012-04-03 03:34:16 +02:00
|
|
|
#include "libcef/common/values_impl.h"
|
|
|
|
|
|
|
|
#include "base/logging.h"
|
|
|
|
|
|
|
|
namespace {
|
|
|
|
|
2017-05-17 11:29:28 +02:00
|
|
|
void CopyValue(const Cef_Request_Params& source, Cef_Request_Params& target) {
|
2012-04-03 03:34:16 +02:00
|
|
|
target.name = source.name;
|
2016-10-21 21:52:29 +02:00
|
|
|
auto copy = source.arguments.CreateDeepCopy();
|
|
|
|
target.arguments.Swap(copy.get());
|
2012-04-03 03:34:16 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
} // namespace
|
|
|
|
|
|
|
|
// static
|
|
|
|
CefRefPtr<CefProcessMessage> CefProcessMessage::Create(const CefString& name) {
|
|
|
|
Cef_Request_Params* params = new Cef_Request_Params();
|
|
|
|
params->name = name;
|
|
|
|
return new CefProcessMessageImpl(params, true, false);
|
|
|
|
}
|
|
|
|
|
|
|
|
CefProcessMessageImpl::CefProcessMessageImpl(Cef_Request_Params* value,
|
|
|
|
bool will_delete,
|
|
|
|
bool read_only)
|
2017-05-17 11:29:28 +02:00
|
|
|
: CefValueBase<CefProcessMessage, Cef_Request_Params>(
|
|
|
|
value,
|
2020-01-15 14:36:24 +01:00
|
|
|
nullptr,
|
2017-05-17 11:29:28 +02:00
|
|
|
will_delete ? kOwnerWillDelete : kOwnerNoDelete,
|
|
|
|
read_only,
|
2020-01-15 14:36:24 +01:00
|
|
|
nullptr) {}
|
2012-04-03 03:34:16 +02:00
|
|
|
|
|
|
|
bool CefProcessMessageImpl::CopyTo(Cef_Request_Params& target) {
|
|
|
|
CEF_VALUE_VERIFY_RETURN(false, false);
|
|
|
|
CopyValue(const_value(), target);
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
bool CefProcessMessageImpl::IsValid() {
|
|
|
|
return !detached();
|
|
|
|
}
|
|
|
|
|
|
|
|
bool CefProcessMessageImpl::IsReadOnly() {
|
|
|
|
return read_only();
|
|
|
|
}
|
|
|
|
|
|
|
|
CefRefPtr<CefProcessMessage> CefProcessMessageImpl::Copy() {
|
2020-01-15 14:36:24 +01:00
|
|
|
CEF_VALUE_VERIFY_RETURN(false, nullptr);
|
2012-04-03 03:34:16 +02:00
|
|
|
Cef_Request_Params* params = new Cef_Request_Params();
|
|
|
|
CopyValue(const_value(), *params);
|
|
|
|
return new CefProcessMessageImpl(params, true, false);
|
|
|
|
}
|
|
|
|
|
|
|
|
CefString CefProcessMessageImpl::GetName() {
|
|
|
|
CEF_VALUE_VERIFY_RETURN(false, CefString());
|
|
|
|
return const_value().name;
|
|
|
|
}
|
|
|
|
|
|
|
|
CefRefPtr<CefListValue> CefProcessMessageImpl::GetArgumentList() {
|
2020-01-15 14:36:24 +01:00
|
|
|
CEF_VALUE_VERIFY_RETURN(false, nullptr);
|
2012-04-03 03:34:16 +02:00
|
|
|
return CefListValueImpl::GetOrCreateRef(
|
2017-05-17 11:29:28 +02:00
|
|
|
const_cast<base::ListValue*>(&(const_value().arguments)),
|
|
|
|
const_cast<Cef_Request_Params*>(&const_value()), read_only(),
|
|
|
|
controller());
|
2012-04-03 03:34:16 +02:00
|
|
|
}
|