Remove deprecated base::[Dictionary|List]Value API usage

This commit is contained in:
Marshall Greenblatt
2023-01-30 16:42:40 -05:00
parent 36ee304ed4
commit 4c41f14360
34 changed files with 387 additions and 375 deletions

View File

@@ -61,9 +61,9 @@ bool CefPrintRenderFrameHelperDelegate::OverridePrint(
// instructs the PDF plugin to print. This is to make window.print() on a
// PDF plugin document correctly print the PDF. See
// https://crbug.com/448720.
base::DictionaryValue message;
message.SetString("type", "print");
post_message_support->PostMessageFromValue(message);
base::Value::Dict message;
message.Set("type", "print");
post_message_support->PostMessageFromValue(base::Value(std::move(message)));
return true;
}
return false;

View File

@@ -290,7 +290,7 @@ void CefFrameImpl::SendProcessMessage(CefProcessId target_process,
SendToBrowserFrame(
__FUNCTION__,
base::BindOnce(
[](const CefString& name, base::ListValue argument_list,
[](const CefString& name, base::Value::List argument_list,
const BrowserFrameType& render_frame) {
render_frame->SendMessage(name, std::move(argument_list));
},
@@ -732,13 +732,13 @@ void CefFrameImpl::FrameDetached() {
OnDisconnect(DisconnectReason::BROWSER_FRAME_DETACHED);
}
void CefFrameImpl::SendMessage(const std::string& name, base::Value arguments) {
void CefFrameImpl::SendMessage(const std::string& name,
base::Value::List arguments) {
if (auto app = CefAppManager::Get()->GetApplication()) {
if (auto handler = app->GetRenderProcessHandler()) {
auto& list_value = base::Value::AsListValue(arguments);
CefRefPtr<CefProcessMessageImpl> message(new CefProcessMessageImpl(
name, std::move(const_cast<base::ListValue&>(list_value)),
/*read_only=*/true));
CefRefPtr<CefProcessMessageImpl> message(
new CefProcessMessageImpl(name, std::move(arguments),
/*read_only=*/true));
handler->OnProcessMessageReceived(browser_, this, PID_BROWSER,
message.get());
}
@@ -835,8 +835,9 @@ void CefFrameImpl::DidStopLoading() {
void CefFrameImpl::MoveOrResizeStarted() {
if (frame_) {
auto web_view = frame_->View();
if (web_view)
if (web_view) {
web_view->CancelPagePopup();
}
}
}

View File

@@ -149,7 +149,8 @@ class CefFrameImpl
// cef::mojom::RenderFrame methods:
void FrameAttachedAck() override;
void FrameDetached() override;
void SendMessage(const std::string& name, base::Value arguments) override;
void SendMessage(const std::string& name,
base::Value::List arguments) override;
void SendSharedMemoryRegion(const std::string& name,
base::ReadOnlySharedMemoryRegion region) override;
void SendCommand(const std::string& command) override;

View File

@@ -350,15 +350,11 @@ CefRefPtr<CefBrowserImpl> CefRenderManager::MaybeCreateBrowser(
if (handler.get()) {
CefRefPtr<CefDictionaryValueImpl> dictValuePtr;
if (params->extra_info) {
auto& dict_value = base::Value::AsDictionaryValue(*params->extra_info);
dictValuePtr = new CefDictionaryValueImpl(
const_cast<base::DictionaryValue*>(&dict_value),
/*will_delete=*/false, /*read_only=*/true);
dictValuePtr =
new CefDictionaryValueImpl(std::move(*params->extra_info),
/*read_only=*/true);
}
handler->OnBrowserCreated(browser.get(), dictValuePtr.get());
if (dictValuePtr) {
std::ignore = dictValuePtr->Detach(nullptr);
}
}
}