Skip to content

Commit

Permalink
Migrate Value::Find*Path() calls in /google_apis
Browse files Browse the repository at this point in the history
Value::Find*Path() is deprecated in favor of
Value::Dict::FindByDottedPath(), so swap out the former for the latter.
Also switch callsites that were using a hard-coded path without dots to
Value::Dict::Find() instead. Also, in some cases, migrate a couple other
nearby deprecated base::Value methods as well.

This CL was uploaded by git cl split.

R=bsazonov@chromium.org

Bug: 1187001
Change-Id: I6ecfd372d7cb0e1f6da26c868b0d07818f448824
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4383027
Reviewed-by: Boris Sazonov <bsazonov@chromium.org>
Auto-Submit: Matt Menke <mmenke@chromium.org>
Commit-Queue: Boris Sazonov <bsazonov@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1124153}
  • Loading branch information
Matt Menke authored and Chromium LUCI CQ committed Mar 30, 2023
1 parent b41040f commit 5937064
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions google_apis/calendar/calendar_api_response_types.cc
Original file line number Diff line number Diff line change
Expand Up @@ -157,15 +157,15 @@ absl::optional<CalendarEvent::ResponseStatus> CalculateSelfResponseStatus(
// Pulls the video conference URI out of the conferenceData field, if there is
// one on the event. Returns the first one it finds or an empty GURL if there is
// none.
GURL GetConferenceDataUri(const base::Value& value) {
const auto* entry_points = value.FindListPath(kConferenceDataEntryPoints);
GURL GetConferenceDataUri(const base::Value::Dict& dict) {
const auto* entry_points =
dict.FindListByDottedPath(kConferenceDataEntryPoints);
if (!entry_points) {
return GURL();
}

const auto video_conference_entry_point = base::ranges::find_if(
entry_points->GetList().begin(), entry_points->GetList().end(),
[](const auto& entry_point) {
entry_points->begin(), entry_points->end(), [](const auto& entry_point) {
const std::string* entry_point_type =
entry_point.GetDict().FindString(kEntryPointType);
if (!entry_point_type) {
Expand All @@ -174,7 +174,7 @@ GURL GetConferenceDataUri(const base::Value& value) {
return *entry_point_type == kVideoConferenceValue;
});

if (video_conference_entry_point == entry_points->GetList().end()) {
if (video_conference_entry_point == entry_points->end()) {
return GURL();
}

Expand Down Expand Up @@ -210,7 +210,7 @@ bool ConvertResponseItems(const base::Value* value, CalendarEvent* event) {
event->set_self_response_status(self_response_status.value());
}

GURL conference_data_uri = GetConferenceDataUri(*value);
GURL conference_data_uri = GetConferenceDataUri(value->GetDict());
event->set_conference_data_uri(conference_data_uri);

return true;
Expand Down

0 comments on commit 5937064

Please sign in to comment.