// Generated by the proto_extras plugin. DO NOT EDIT!
// source: components/optimization_guide/proto/features/common_quality_data.proto

#include "components/optimization_guide/proto/features/common_quality_data.to_value.h"



#include "base/base64.h"
#include "base/strings/string_number_conversions.h"
#include "base/values.h"
#include "components/optimization_guide/proto/features/common_quality_data.pb.h"
#include "components/proto_extras/proto_extras_lib.h"


namespace optimization_guide {
namespace proto {
void MaybeToValue(const std::optional<FloatArray>& opt_message,
                    std::string_view name,
                    base::DictValue& output_dictionary) {
  if (!opt_message.has_value()) {
    return;
  }
  output_dictionary.Set(name, ToValue(*opt_message));
}
base::Value ToValue(const FloatArray& message) {
  base::DictValue dict;
  ::proto_extras::SerializeUnknownFields(message, dict);
  if (!message.values().empty()) {
    base::ListValue list;
    for (const auto& value : message.values()) {
      list.Append(static_cast<double>(value));
    }
    dict.Set("values", std::move(list));
  }
  return base::Value(std::move(dict));
}
void MaybeToValue(const std::optional<Embedding>& opt_message,
                    std::string_view name,
                    base::DictValue& output_dictionary) {
  if (!opt_message.has_value()) {
    return;
  }
  output_dictionary.Set(name, ToValue(*opt_message));
}
base::Value ToValue(const Embedding& message) {
  base::DictValue dict;
  ::proto_extras::SerializeUnknownFields(message, dict);
  if (message.has_floats()) {
    dict.Set("floats", ::optimization_guide::proto::ToValue(message.floats()));
  }
  return base::Value(std::move(dict));
}
void MaybeToValue(const std::optional<AXTreeUpdate>& opt_message,
                    std::string_view name,
                    base::DictValue& output_dictionary) {
  if (!opt_message.has_value()) {
    return;
  }
  output_dictionary.Set(name, ToValue(*opt_message));
}
base::Value ToValue(const AXTreeUpdate& message) {
  base::DictValue dict;
  ::proto_extras::SerializeUnknownFields(message, dict);
  if (message.has_tree_data()) {
    dict.Set("tree_data", ::optimization_guide::proto::ToValue(message.tree_data()));
  }
  if (message.has_root_id()) {
    dict.Set("root_id", ::proto_extras::ToNumericTypeForValue(message.root_id()));
  }
  if (!message.nodes().empty()) {
    base::ListValue list;
    for (const auto& value : message.nodes()) {
      list.Append(::optimization_guide::proto::ToValue(value));
    }
    dict.Set("nodes", std::move(list));
  }
  return base::Value(std::move(dict));
}
void MaybeToValue(const std::optional<AXTreeData>& opt_message,
                    std::string_view name,
                    base::DictValue& output_dictionary) {
  if (!opt_message.has_value()) {
    return;
  }
  output_dictionary.Set(name, ToValue(*opt_message));
}
base::Value ToValue(const AXTreeData& message) {
  base::DictValue dict;
  ::proto_extras::SerializeUnknownFields(message, dict);
  if (message.has_doctype()) {
    dict.Set("doctype", (message.doctype()));
  }
  if (message.has_loaded()) {
    dict.Set("loaded", static_cast<bool>(message.loaded()));
  }
  if (message.has_loading_progress()) {
    dict.Set("loading_progress", static_cast<double>(message.loading_progress()));
  }
  if (message.has_mimetype()) {
    dict.Set("mimetype", (message.mimetype()));
  }
  if (message.has_title()) {
    dict.Set("title", (message.title()));
  }
  if (message.has_focus_id()) {
    dict.Set("focus_id", ::proto_extras::ToNumericTypeForValue(message.focus_id()));
  }
  if (message.has_sel_is_backward()) {
    dict.Set("sel_is_backward", static_cast<bool>(message.sel_is_backward()));
  }
  if (message.has_sel_anchor_object_id()) {
    dict.Set("sel_anchor_object_id", ::proto_extras::ToNumericTypeForValue(message.sel_anchor_object_id()));
  }
  if (message.has_sel_anchor_offset()) {
    dict.Set("sel_anchor_offset", ::proto_extras::ToNumericTypeForValue(message.sel_anchor_offset()));
  }
  if (message.has_sel_anchor_affinity()) {
    dict.Set("sel_anchor_affinity", ::optimization_guide::proto::AXTextAffinity_Name(message.sel_anchor_affinity()));
  }
  if (message.has_sel_focus_object_id()) {
    dict.Set("sel_focus_object_id", ::proto_extras::ToNumericTypeForValue(message.sel_focus_object_id()));
  }
  if (message.has_sel_focus_offset()) {
    dict.Set("sel_focus_offset", ::proto_extras::ToNumericTypeForValue(message.sel_focus_offset()));
  }
  if (message.has_sel_focus_affinity()) {
    dict.Set("sel_focus_affinity", ::optimization_guide::proto::AXTextAffinity_Name(message.sel_focus_affinity()));
  }
  if (message.has_root_scroller_id()) {
    dict.Set("root_scroller_id", ::proto_extras::ToNumericTypeForValue(message.root_scroller_id()));
  }
  if (!message.metadata().empty()) {
    base::ListValue list;
    for (const auto& value : message.metadata()) {
      list.Append((value));
    }
    dict.Set("metadata", std::move(list));
  }
  return base::Value(std::move(dict));
}
void MaybeToValue(const std::optional<AXNodeData>& opt_message,
                    std::string_view name,
                    base::DictValue& output_dictionary) {
  if (!opt_message.has_value()) {
    return;
  }
  output_dictionary.Set(name, ToValue(*opt_message));
}
base::Value ToValue(const AXNodeData& message) {
  base::DictValue dict;
  ::proto_extras::SerializeUnknownFields(message, dict);
  if (message.has_id()) {
    dict.Set("id", ::proto_extras::ToNumericTypeForValue(message.id()));
  }
  if (message.has_role()) {
    dict.Set("role", ::optimization_guide::proto::AXRole_Name(message.role()));
  }
  if (message.has_state()) {
    dict.Set("state", ::proto_extras::ToNumericTypeForValue(message.state()));
  }
  if (message.has_actions()) {
    dict.Set("actions", ::proto_extras::ToNumericTypeForValue(message.actions()));
  }
  if (!message.attributes().empty()) {
    base::ListValue list;
    for (const auto& value : message.attributes()) {
      list.Append(::optimization_guide::proto::ToValue(value));
    }
    dict.Set("attributes", std::move(list));
  }
  if (!message.child_ids().empty()) {
    base::ListValue list;
    for (const auto& value : message.child_ids()) {
      list.Append((value));
    }
    dict.Set("child_ids", std::move(list));
  }
  if (message.has_relative_bounds()) {
    dict.Set("relative_bounds", ::optimization_guide::proto::ToValue(message.relative_bounds()));
  }
  return base::Value(std::move(dict));
}
void MaybeToValue(const std::optional<AXAttribute>& opt_message,
                    std::string_view name,
                    base::DictValue& output_dictionary) {
  if (!opt_message.has_value()) {
    return;
  }
  output_dictionary.Set(name, ToValue(*opt_message));
}
base::Value ToValue(const AXAttribute& message) {
  base::DictValue dict;
  ::proto_extras::SerializeUnknownFields(message, dict);
  if (message.has_string_type()) {
    dict.Set("string_type", ::optimization_guide::proto::AXStringAttribute_Name(message.string_type()));
  }
  if (message.has_int_type()) {
    dict.Set("int_type", ::optimization_guide::proto::AXIntAttribute_Name(message.int_type()));
  }
  if (message.has_float_type()) {
    dict.Set("float_type", ::optimization_guide::proto::AXFloatAttribute_Name(message.float_type()));
  }
  if (message.has_bool_type()) {
    dict.Set("bool_type", ::optimization_guide::proto::AXBoolAttribute_Name(message.bool_type()));
  }
  if (message.has_intlist_type()) {
    dict.Set("intlist_type", ::optimization_guide::proto::AXIntListAttribute_Name(message.intlist_type()));
  }
  if (message.has_stringlist_type()) {
    dict.Set("stringlist_type", ::optimization_guide::proto::AXStringListAttribute_Name(message.stringlist_type()));
  }
  if (message.has_html_attribute_name()) {
    dict.Set("html_attribute_name", (message.html_attribute_name()));
  }
  if (message.has_string_value()) {
    dict.Set("string_value", (message.string_value()));
  }
  if (message.has_int_value()) {
    dict.Set("int_value", (message.int_value()));
  }
  if (message.has_float_value()) {
    dict.Set("float_value", static_cast<double>(message.float_value()));
  }
  if (message.has_bool_value()) {
    dict.Set("bool_value", static_cast<bool>(message.bool_value()));
  }
  if (message.has_int_list_value()) {
    dict.Set("int_list_value", ::optimization_guide::proto::ToValue(message.int_list_value()));
  }
  if (message.has_string_list_value()) {
    dict.Set("string_list_value", ::optimization_guide::proto::ToValue(message.string_list_value()));
  }
  if (message.has_html_attribute_value()) {
    dict.Set("html_attribute_value", (message.html_attribute_value()));
  }
  return base::Value(std::move(dict));
}
void MaybeToValue(const std::optional<AXIntList>& opt_message,
                    std::string_view name,
                    base::DictValue& output_dictionary) {
  if (!opt_message.has_value()) {
    return;
  }
  output_dictionary.Set(name, ToValue(*opt_message));
}
base::Value ToValue(const AXIntList& message) {
  base::DictValue dict;
  ::proto_extras::SerializeUnknownFields(message, dict);
  if (!message.value().empty()) {
    base::ListValue list;
    for (const auto& value : message.value()) {
      list.Append((value));
    }
    dict.Set("value", std::move(list));
  }
  return base::Value(std::move(dict));
}
void MaybeToValue(const std::optional<AXStringList>& opt_message,
                    std::string_view name,
                    base::DictValue& output_dictionary) {
  if (!opt_message.has_value()) {
    return;
  }
  output_dictionary.Set(name, ToValue(*opt_message));
}
base::Value ToValue(const AXStringList& message) {
  base::DictValue dict;
  ::proto_extras::SerializeUnknownFields(message, dict);
  if (!message.value().empty()) {
    base::ListValue list;
    for (const auto& value : message.value()) {
      list.Append((value));
    }
    dict.Set("value", std::move(list));
  }
  return base::Value(std::move(dict));
}
void MaybeToValue(const std::optional<AXRelativeBounds>& opt_message,
                    std::string_view name,
                    base::DictValue& output_dictionary) {
  if (!opt_message.has_value()) {
    return;
  }
  output_dictionary.Set(name, ToValue(*opt_message));
}
base::Value ToValue(const AXRelativeBounds& message) {
  base::DictValue dict;
  ::proto_extras::SerializeUnknownFields(message, dict);
  if (message.has_offset_container_id()) {
    dict.Set("offset_container_id", (message.offset_container_id()));
  }
  if (message.has_x()) {
    dict.Set("x", static_cast<double>(message.x()));
  }
  if (message.has_y()) {
    dict.Set("y", static_cast<double>(message.y()));
  }
  if (message.has_width()) {
    dict.Set("width", static_cast<double>(message.width()));
  }
  if (message.has_height()) {
    dict.Set("height", static_cast<double>(message.height()));
  }
  if (!message.transform().empty()) {
    base::ListValue list;
    for (const auto& value : message.transform()) {
      list.Append(static_cast<double>(value));
    }
    dict.Set("transform", std::move(list));
  }
  return base::Value(std::move(dict));
}
void MaybeToValue(const std::optional<PageContext>& opt_message,
                    std::string_view name,
                    base::DictValue& output_dictionary) {
  if (!opt_message.has_value()) {
    return;
  }
  output_dictionary.Set(name, ToValue(*opt_message));
}
base::Value ToValue(const PageContext& message) {
  base::DictValue dict;
  ::proto_extras::SerializeUnknownFields(message, dict);
  if (message.has_url()) {
    dict.Set("url", (message.url()));
  }
  if (message.has_title()) {
    dict.Set("title", (message.title()));
  }
  if (message.has_ax_tree_data()) {
    dict.Set("ax_tree_data", ::optimization_guide::proto::ToValue(message.ax_tree_data()));
  }
  if (message.has_inner_text()) {
    dict.Set("inner_text", (message.inner_text()));
  }
  if (message.has_inner_text_offset()) {
    dict.Set("inner_text_offset", ::proto_extras::ToNumericTypeForValue(message.inner_text_offset()));
  }
  if (!message.page_passages().empty()) {
    base::ListValue list;
    for (const auto& value : message.page_passages()) {
      list.Append((value));
    }
    dict.Set("page_passages", std::move(list));
  }
  if (message.has_tab_screenshot()) {
    dict.Set("tab_screenshot", (message.tab_screenshot()));
  }
  if (message.has_pdf_data()) {
    dict.Set("pdf_data", (message.pdf_data()));
  }
  if (message.has_annotated_page_content()) {
    dict.Set("annotated_page_content", ::optimization_guide::proto::ToValue(message.annotated_page_content()));
  }
  return base::Value(std::move(dict));
}
void MaybeToValue(const std::optional<AnnotatedPageContent>& opt_message,
                    std::string_view name,
                    base::DictValue& output_dictionary) {
  if (!opt_message.has_value()) {
    return;
  }
  output_dictionary.Set(name, ToValue(*opt_message));
}
base::Value ToValue(const AnnotatedPageContent& message) {
  base::DictValue dict;
  ::proto_extras::SerializeUnknownFields(message, dict);
  if (message.has_version()) {
    dict.Set("version", ::optimization_guide::proto::AnnotatedPageContentVersion_Name(message.version()));
  }
  if (message.has_mode()) {
    dict.Set("mode", ::optimization_guide::proto::AnnotatedPageContentMode_Name(message.mode()));
  }
  if (message.has_root_node()) {
    dict.Set("root_node", ::optimization_guide::proto::ToValue(message.root_node()));
  }
  if (message.has_main_frame_data()) {
    dict.Set("main_frame_data", ::optimization_guide::proto::ToValue(message.main_frame_data()));
  }
  if (message.has_page_interaction_info()) {
    dict.Set("page_interaction_info", ::optimization_guide::proto::ToValue(message.page_interaction_info()));
  }
  if (message.has_viewport_geometry()) {
    dict.Set("viewport_geometry", ::optimization_guide::proto::ToValue(message.viewport_geometry()));
  }
  if (message.has_tab_id()) {
    dict.Set("tab_id", (message.tab_id()));
  }
  if (message.has_popup_window()) {
    dict.Set("popup_window", ::optimization_guide::proto::ToValue(message.popup_window()));
  }
  if (message.has_profile_information()) {
    dict.Set("profile_information", ::optimization_guide::proto::ToValue(message.profile_information()));
  }
  if (message.has_gemini_in_chrome_page_metadata()) {
    dict.Set("gemini_in_chrome_page_metadata", ::optimization_guide::proto::ToValue(message.gemini_in_chrome_page_metadata()));
  }
  return base::Value(std::move(dict));
}
void MaybeToValue(const std::optional<ContentNode>& opt_message,
                    std::string_view name,
                    base::DictValue& output_dictionary) {
  if (!opt_message.has_value()) {
    return;
  }
  output_dictionary.Set(name, ToValue(*opt_message));
}
base::Value ToValue(const ContentNode& message) {
  base::DictValue dict;
  ::proto_extras::SerializeUnknownFields(message, dict);
  if (!message.children_nodes().empty()) {
    base::ListValue list;
    for (const auto& value : message.children_nodes()) {
      list.Append(::optimization_guide::proto::ToValue(value));
    }
    dict.Set("children_nodes", std::move(list));
  }
  if (message.has_content_attributes()) {
    dict.Set("content_attributes", ::optimization_guide::proto::ToValue(message.content_attributes()));
  }
  return base::Value(std::move(dict));
}
void MaybeToValue(const std::optional<ContentAttributes>& opt_message,
                    std::string_view name,
                    base::DictValue& output_dictionary) {
  if (!opt_message.has_value()) {
    return;
  }
  output_dictionary.Set(name, ToValue(*opt_message));
}
base::Value ToValue(const ContentAttributes& message) {
  base::DictValue dict;
  ::proto_extras::SerializeUnknownFields(message, dict);
  if (message.has_text_data()) {
    dict.Set("text_data", ::optimization_guide::proto::ToValue(message.text_data()));
  }
  if (message.has_image_data()) {
    dict.Set("image_data", ::optimization_guide::proto::ToValue(message.image_data()));
  }
  if (message.has_svg_root_data()) {
    dict.Set("svg_root_data", ::optimization_guide::proto::ToValue(message.svg_root_data()));
  }
  if (message.has_canvas_data()) {
    dict.Set("canvas_data", ::optimization_guide::proto::ToValue(message.canvas_data()));
  }
  if (message.has_video_data()) {
    dict.Set("video_data", ::optimization_guide::proto::ToValue(message.video_data()));
  }
  if (message.has_anchor_data()) {
    dict.Set("anchor_data", ::optimization_guide::proto::ToValue(message.anchor_data()));
  }
  if (message.has_form_data()) {
    dict.Set("form_data", ::optimization_guide::proto::ToValue(message.form_data()));
  }
  if (message.has_form_control_data()) {
    dict.Set("form_control_data", ::optimization_guide::proto::ToValue(message.form_control_data()));
  }
  if (message.has_table_data()) {
    dict.Set("table_data", ::optimization_guide::proto::ToValue(message.table_data()));
  }
  if (message.has_iframe_data()) {
    dict.Set("iframe_data", ::optimization_guide::proto::ToValue(message.iframe_data()));
  }
  if (message.has_table_row_data()) {
    dict.Set("table_row_data", ::optimization_guide::proto::ToValue(message.table_row_data()));
  }
  if (message.has_common_ancestor_dom_node_id()) {
    dict.Set("common_ancestor_dom_node_id", (message.common_ancestor_dom_node_id()));
  }
  if (message.has_attribute_type()) {
    dict.Set("attribute_type", ::optimization_guide::proto::ContentAttributeType_Name(message.attribute_type()));
  }
  if (message.has_geometry()) {
    dict.Set("geometry", ::optimization_guide::proto::ToValue(message.geometry()));
  }
  if (message.has_interaction_info()) {
    dict.Set("interaction_info", ::optimization_guide::proto::ToValue(message.interaction_info()));
  }
  if (!message.annotated_roles().empty()) {
    base::ListValue list;
    for (const auto& value : message.annotated_roles()) {
      list.Append(::optimization_guide::proto::AnnotatedRole_Name(value));
    }
    dict.Set("annotated_roles", std::move(list));
  }
  if (message.has_label()) {
    dict.Set("label", (message.label()));
  }
  if (message.has_label_for_dom_node_id()) {
    dict.Set("label_for_dom_node_id", (message.label_for_dom_node_id()));
  }
  if (message.has_aria_role()) {
    dict.Set("aria_role", ::optimization_guide::proto::AXRole_Name(message.aria_role()));
  }
  if (message.has_is_ad_related()) {
    dict.Set("is_ad_related", static_cast<bool>(message.is_ad_related()));
  }
  if (message.has_redaction_decision()) {
    dict.Set("redaction_decision", ::optimization_guide::proto::RedactionDecision_Name(message.redaction_decision()));
  }
  return base::Value(std::move(dict));
}
void MaybeToValue(const std::optional<Geometry>& opt_message,
                    std::string_view name,
                    base::DictValue& output_dictionary) {
  if (!opt_message.has_value()) {
    return;
  }
  output_dictionary.Set(name, ToValue(*opt_message));
}
base::Value ToValue(const Geometry& message) {
  base::DictValue dict;
  ::proto_extras::SerializeUnknownFields(message, dict);
  if (message.has_outer_bounding_box()) {
    dict.Set("outer_bounding_box", ::optimization_guide::proto::ToValue(message.outer_bounding_box()));
  }
  if (message.has_visible_bounding_box()) {
    dict.Set("visible_bounding_box", ::optimization_guide::proto::ToValue(message.visible_bounding_box()));
  }
  if (!message.fragment_visible_bounding_boxes().empty()) {
    base::ListValue list;
    for (const auto& value : message.fragment_visible_bounding_boxes()) {
      list.Append(::optimization_guide::proto::ToValue(value));
    }
    dict.Set("fragment_visible_bounding_boxes", std::move(list));
  }
  if (message.has_is_fixed_or_sticky_position()) {
    dict.Set("is_fixed_or_sticky_position", static_cast<bool>(message.is_fixed_or_sticky_position()));
  }
  if (message.has_css_position()) {
    dict.Set("css_position", ::optimization_guide::proto::CssPosition_Name(message.css_position()));
  }
  return base::Value(std::move(dict));
}
void MaybeToValue(const std::optional<BoundingRect>& opt_message,
                    std::string_view name,
                    base::DictValue& output_dictionary) {
  if (!opt_message.has_value()) {
    return;
  }
  output_dictionary.Set(name, ToValue(*opt_message));
}
base::Value ToValue(const BoundingRect& message) {
  base::DictValue dict;
  ::proto_extras::SerializeUnknownFields(message, dict);
  if (message.has_x()) {
    dict.Set("x", (message.x()));
  }
  if (message.has_y()) {
    dict.Set("y", (message.y()));
  }
  if (message.has_width()) {
    dict.Set("width", (message.width()));
  }
  if (message.has_height()) {
    dict.Set("height", (message.height()));
  }
  if (message.has_is_screenshot_relative()) {
    dict.Set("is_screenshot_relative", static_cast<bool>(message.is_screenshot_relative()));
  }
  return base::Value(std::move(dict));
}
void MaybeToValue(const std::optional<InteractionInfo>& opt_message,
                    std::string_view name,
                    base::DictValue& output_dictionary) {
  if (!opt_message.has_value()) {
    return;
  }
  output_dictionary.Set(name, ToValue(*opt_message));
}
base::Value ToValue(const InteractionInfo& message) {
  base::DictValue dict;
  ::proto_extras::SerializeUnknownFields(message, dict);
  if (message.has_scroller_info()) {
    dict.Set("scroller_info", ::optimization_guide::proto::ToValue(message.scroller_info()));
  }
  if (message.has_is_selectable()) {
    dict.Set("is_selectable", static_cast<bool>(message.is_selectable()));
  }
  if (message.has_is_editable()) {
    dict.Set("is_editable", static_cast<bool>(message.is_editable()));
  }
  if (message.has_can_resize_horizontal()) {
    dict.Set("can_resize_horizontal", static_cast<bool>(message.can_resize_horizontal()));
  }
  if (message.has_can_resize_vertical()) {
    dict.Set("can_resize_vertical", static_cast<bool>(message.can_resize_vertical()));
  }
  if (message.has_is_focusable()) {
    dict.Set("is_focusable", static_cast<bool>(message.is_focusable()));
  }
  if (message.has_is_draggable()) {
    dict.Set("is_draggable", static_cast<bool>(message.is_draggable()));
  }
  if (message.has_is_clickable()) {
    dict.Set("is_clickable", static_cast<bool>(message.is_clickable()));
  }
  if (message.has_document_scoped_z_order()) {
    dict.Set("document_scoped_z_order", (message.document_scoped_z_order()));
  }
  if (!message.debug_clickability_reasons().empty()) {
    base::ListValue list;
    for (const auto& value : message.debug_clickability_reasons()) {
      list.Append(::optimization_guide::proto::ClickabilityReason_Name(value));
    }
    dict.Set("debug_clickability_reasons", std::move(list));
  }
  if (!message.clickability_reasons().empty()) {
    base::ListValue list;
    for (const auto& value : message.clickability_reasons()) {
      list.Append(::optimization_guide::proto::ClickabilityReason_Name(value));
    }
    dict.Set("clickability_reasons", std::move(list));
  }
  if (message.has_is_disabled()) {
    dict.Set("is_disabled", static_cast<bool>(message.is_disabled()));
  }
  if (!message.interaction_disabled_reasons().empty()) {
    base::ListValue list;
    for (const auto& value : message.interaction_disabled_reasons()) {
      list.Append(::optimization_guide::proto::InteractionDisabledReason_Name(value));
    }
    dict.Set("interaction_disabled_reasons", std::move(list));
  }
  if (message.has_is_tabbable()) {
    dict.Set("is_tabbable", static_cast<bool>(message.is_tabbable()));
  }
  if (message.has_has_aria_activedescendant()) {
    dict.Set("has_aria_activedescendant", static_cast<bool>(message.has_aria_activedescendant()));
  }
  if (!message.aria_action_target_node_ids().empty()) {
    base::ListValue list;
    for (const auto& value : message.aria_action_target_node_ids()) {
      list.Append((value));
    }
    dict.Set("aria_action_target_node_ids", std::move(list));
  }
  return base::Value(std::move(dict));
}
void MaybeToValue(const std::optional<ScrollerInfo>& opt_message,
                    std::string_view name,
                    base::DictValue& output_dictionary) {
  if (!opt_message.has_value()) {
    return;
  }
  output_dictionary.Set(name, ToValue(*opt_message));
}
base::Value ToValue(const ScrollerInfo& message) {
  base::DictValue dict;
  ::proto_extras::SerializeUnknownFields(message, dict);
  if (message.has_scrolling_bounds()) {
    dict.Set("scrolling_bounds", ::optimization_guide::proto::ToValue(message.scrolling_bounds()));
  }
  if (message.has_visible_area()) {
    dict.Set("visible_area", ::optimization_guide::proto::ToValue(message.visible_area()));
  }
  if (message.has_user_scrollable_horizontal()) {
    dict.Set("user_scrollable_horizontal", static_cast<bool>(message.user_scrollable_horizontal()));
  }
  if (message.has_user_scrollable_vertical()) {
    dict.Set("user_scrollable_vertical", static_cast<bool>(message.user_scrollable_vertical()));
  }
  return base::Value(std::move(dict));
}
void MaybeToValue(const std::optional<BoundingSize>& opt_message,
                    std::string_view name,
                    base::DictValue& output_dictionary) {
  if (!opt_message.has_value()) {
    return;
  }
  output_dictionary.Set(name, ToValue(*opt_message));
}
base::Value ToValue(const BoundingSize& message) {
  base::DictValue dict;
  ::proto_extras::SerializeUnknownFields(message, dict);
  if (message.has_width()) {
    dict.Set("width", (message.width()));
  }
  if (message.has_height()) {
    dict.Set("height", (message.height()));
  }
  return base::Value(std::move(dict));
}
void MaybeToValue(const std::optional<TextInfo>& opt_message,
                    std::string_view name,
                    base::DictValue& output_dictionary) {
  if (!opt_message.has_value()) {
    return;
  }
  output_dictionary.Set(name, ToValue(*opt_message));
}
base::Value ToValue(const TextInfo& message) {
  base::DictValue dict;
  ::proto_extras::SerializeUnknownFields(message, dict);
  if (message.has_text_content()) {
    dict.Set("text_content", (message.text_content()));
  }
  if (message.has_text_style()) {
    dict.Set("text_style", ::optimization_guide::proto::ToValue(message.text_style()));
  }
  return base::Value(std::move(dict));
}
void MaybeToValue(const std::optional<TextStyle>& opt_message,
                    std::string_view name,
                    base::DictValue& output_dictionary) {
  if (!opt_message.has_value()) {
    return;
  }
  output_dictionary.Set(name, ToValue(*opt_message));
}
base::Value ToValue(const TextStyle& message) {
  base::DictValue dict;
  ::proto_extras::SerializeUnknownFields(message, dict);
  if (message.has_text_size()) {
    dict.Set("text_size", ::optimization_guide::proto::TextSize_Name(message.text_size()));
  }
  if (message.has_has_emphasis()) {
    dict.Set("has_emphasis", static_cast<bool>(message.has_emphasis()));
  }
  if (message.has_color()) {
    dict.Set("color", ::proto_extras::ToNumericTypeForValue(message.color()));
  }
  return base::Value(std::move(dict));
}
void MaybeToValue(const std::optional<ImageInfo>& opt_message,
                    std::string_view name,
                    base::DictValue& output_dictionary) {
  if (!opt_message.has_value()) {
    return;
  }
  output_dictionary.Set(name, ToValue(*opt_message));
}
base::Value ToValue(const ImageInfo& message) {
  base::DictValue dict;
  ::proto_extras::SerializeUnknownFields(message, dict);
  if (message.has_image_caption()) {
    dict.Set("image_caption", (message.image_caption()));
  }
  if (message.has_security_origin()) {
    dict.Set("security_origin", ::optimization_guide::proto::ToValue(message.security_origin()));
  }
  if (message.has_url()) {
    dict.Set("url", (message.url()));
  }
  return base::Value(std::move(dict));
}
void MaybeToValue(const std::optional<SecurityOrigin>& opt_message,
                    std::string_view name,
                    base::DictValue& output_dictionary) {
  if (!opt_message.has_value()) {
    return;
  }
  output_dictionary.Set(name, ToValue(*opt_message));
}
base::Value ToValue(const SecurityOrigin& message) {
  base::DictValue dict;
  ::proto_extras::SerializeUnknownFields(message, dict);
  if (message.has_opaque()) {
    dict.Set("opaque", static_cast<bool>(message.opaque()));
  }
  if (message.has_value()) {
    dict.Set("value", (message.value()));
  }
  return base::Value(std::move(dict));
}
void MaybeToValue(const std::optional<SVGRootData>& opt_message,
                    std::string_view name,
                    base::DictValue& output_dictionary) {
  if (!opt_message.has_value()) {
    return;
  }
  output_dictionary.Set(name, ToValue(*opt_message));
}
base::Value ToValue(const SVGRootData& message) {
  base::DictValue dict;
  ::proto_extras::SerializeUnknownFields(message, dict);
  if (message.has_inner_text()) {
    dict.Set("inner_text", (message.inner_text()));
  }
  return base::Value(std::move(dict));
}
void MaybeToValue(const std::optional<CanvasData>& opt_message,
                    std::string_view name,
                    base::DictValue& output_dictionary) {
  if (!opt_message.has_value()) {
    return;
  }
  output_dictionary.Set(name, ToValue(*opt_message));
}
base::Value ToValue(const CanvasData& message) {
  base::DictValue dict;
  ::proto_extras::SerializeUnknownFields(message, dict);
  if (message.has_layout_width()) {
    dict.Set("layout_width", (message.layout_width()));
  }
  if (message.has_layout_height()) {
    dict.Set("layout_height", (message.layout_height()));
  }
  return base::Value(std::move(dict));
}
void MaybeToValue(const std::optional<VideoData>& opt_message,
                    std::string_view name,
                    base::DictValue& output_dictionary) {
  if (!opt_message.has_value()) {
    return;
  }
  output_dictionary.Set(name, ToValue(*opt_message));
}
base::Value ToValue(const VideoData& message) {
  base::DictValue dict;
  ::proto_extras::SerializeUnknownFields(message, dict);
  if (message.has_url()) {
    dict.Set("url", (message.url()));
  }
  if (message.has_security_origin()) {
    dict.Set("security_origin", ::optimization_guide::proto::ToValue(message.security_origin()));
  }
  return base::Value(std::move(dict));
}
void MaybeToValue(const std::optional<AnchorData>& opt_message,
                    std::string_view name,
                    base::DictValue& output_dictionary) {
  if (!opt_message.has_value()) {
    return;
  }
  output_dictionary.Set(name, ToValue(*opt_message));
}
base::Value ToValue(const AnchorData& message) {
  base::DictValue dict;
  ::proto_extras::SerializeUnknownFields(message, dict);
  if (message.has_url()) {
    dict.Set("url", (message.url()));
  }
  if (!message.rel().empty()) {
    base::ListValue list;
    for (const auto& value : message.rel()) {
      list.Append(::optimization_guide::proto::AnchorRel_Name(value));
    }
    dict.Set("rel", std::move(list));
  }
  return base::Value(std::move(dict));
}
void MaybeToValue(const std::optional<FormInfo>& opt_message,
                    std::string_view name,
                    base::DictValue& output_dictionary) {
  if (!opt_message.has_value()) {
    return;
  }
  output_dictionary.Set(name, ToValue(*opt_message));
}
base::Value ToValue(const FormInfo& message) {
  base::DictValue dict;
  ::proto_extras::SerializeUnknownFields(message, dict);
  if (message.has_form_name()) {
    dict.Set("form_name", (message.form_name()));
  }
  if (message.has_action_url()) {
    dict.Set("action_url", (message.action_url()));
  }
  return base::Value(std::move(dict));
}
void MaybeToValue(const std::optional<FormControlData>& opt_message,
                    std::string_view name,
                    base::DictValue& output_dictionary) {
  if (!opt_message.has_value()) {
    return;
  }
  output_dictionary.Set(name, ToValue(*opt_message));
}
base::Value ToValue(const FormControlData& message) {
  base::DictValue dict;
  ::proto_extras::SerializeUnknownFields(message, dict);
  if (message.has_field_name()) {
    dict.Set("field_name", (message.field_name()));
  }
  if (message.has_field_value()) {
    dict.Set("field_value", (message.field_value()));
  }
  if (message.has_form_control_type()) {
    dict.Set("form_control_type", ::optimization_guide::proto::FormControlType_Name(message.form_control_type()));
  }
  if (!message.select_options().empty()) {
    base::ListValue list;
    for (const auto& value : message.select_options()) {
      list.Append(::optimization_guide::proto::ToValue(value));
    }
    dict.Set("select_options", std::move(list));
  }
  if (message.has_placeholder()) {
    dict.Set("placeholder", (message.placeholder()));
  }
  if (message.has_is_checked()) {
    dict.Set("is_checked", static_cast<bool>(message.is_checked()));
  }
  if (message.has_is_required()) {
    dict.Set("is_required", static_cast<bool>(message.is_required()));
  }
  if (message.has_redaction_decision()) {
    dict.Set("redaction_decision", ::optimization_guide::proto::RedactionDecision_Name(message.redaction_decision()));
  }
  if (!message.coarse_autofill_field_type().empty()) {
    base::ListValue list;
    for (const auto& value : message.coarse_autofill_field_type()) {
      list.Append(::optimization_guide::proto::CoarseAutofillFieldType_Name(value));
    }
    dict.Set("coarse_autofill_field_type", std::move(list));
  }
  if (message.has_autofill_section_id()) {
    dict.Set("autofill_section_id", ::proto_extras::ToNumericTypeForValue(message.autofill_section_id()));
  }
  if (message.has_is_readonly()) {
    dict.Set("is_readonly", static_cast<bool>(message.is_readonly()));
  }
  return base::Value(std::move(dict));
}
void MaybeToValue(const std::optional<SelectOption>& opt_message,
                    std::string_view name,
                    base::DictValue& output_dictionary) {
  if (!opt_message.has_value()) {
    return;
  }
  output_dictionary.Set(name, ToValue(*opt_message));
}
base::Value ToValue(const SelectOption& message) {
  base::DictValue dict;
  ::proto_extras::SerializeUnknownFields(message, dict);
  if (message.has_value()) {
    dict.Set("value", (message.value()));
  }
  if (message.has_text()) {
    dict.Set("text", (message.text()));
  }
  if (message.has_is_selected()) {
    dict.Set("is_selected", static_cast<bool>(message.is_selected()));
  }
  if (message.has_is_disabled()) {
    dict.Set("is_disabled", static_cast<bool>(message.is_disabled()));
  }
  return base::Value(std::move(dict));
}
void MaybeToValue(const std::optional<TableData>& opt_message,
                    std::string_view name,
                    base::DictValue& output_dictionary) {
  if (!opt_message.has_value()) {
    return;
  }
  output_dictionary.Set(name, ToValue(*opt_message));
}
base::Value ToValue(const TableData& message) {
  base::DictValue dict;
  ::proto_extras::SerializeUnknownFields(message, dict);
  if (message.has_table_name()) {
    dict.Set("table_name", (message.table_name()));
  }
  return base::Value(std::move(dict));
}
void MaybeToValue(const std::optional<IframeData>& opt_message,
                    std::string_view name,
                    base::DictValue& output_dictionary) {
  if (!opt_message.has_value()) {
    return;
  }
  output_dictionary.Set(name, ToValue(*opt_message));
}
base::Value ToValue(const IframeData& message) {
  base::DictValue dict;
  ::proto_extras::SerializeUnknownFields(message, dict);
  if (message.has_frame_data()) {
    dict.Set("frame_data", ::optimization_guide::proto::ToValue(message.frame_data()));
  }
  if (message.has_redacted_frame_metadata()) {
    dict.Set("redacted_frame_metadata", ::optimization_guide::proto::ToValue(message.redacted_frame_metadata()));
  }
  return base::Value(std::move(dict));
}
void MaybeToValue(const std::optional<IframeData_RedactedFrameMetadata>& opt_message,
                    std::string_view name,
                    base::DictValue& output_dictionary) {
  if (!opt_message.has_value()) {
    return;
  }
  output_dictionary.Set(name, ToValue(*opt_message));
}
base::Value ToValue(const IframeData_RedactedFrameMetadata& message) {
  base::DictValue dict;
  ::proto_extras::SerializeUnknownFields(message, dict);
  if (message.has_reason()) {
    dict.Set("reason", ::optimization_guide::proto::IframeData_RedactedFrameMetadata_Reason_Name(message.reason()));
  }
  return base::Value(std::move(dict));
}
void MaybeToValue(const std::optional<FrameData>& opt_message,
                    std::string_view name,
                    base::DictValue& output_dictionary) {
  if (!opt_message.has_value()) {
    return;
  }
  output_dictionary.Set(name, ToValue(*opt_message));
}
base::Value ToValue(const FrameData& message) {
  base::DictValue dict;
  ::proto_extras::SerializeUnknownFields(message, dict);
  if (message.has_security_origin()) {
    dict.Set("security_origin", ::optimization_guide::proto::ToValue(message.security_origin()));
  }
  if (message.has_frame_interaction_info()) {
    dict.Set("frame_interaction_info", ::optimization_guide::proto::ToValue(message.frame_interaction_info()));
  }
  if (message.has_document_identifier()) {
    dict.Set("document_identifier", ::optimization_guide::proto::ToValue(message.document_identifier()));
  }
  if (message.has_url()) {
    dict.Set("url", (message.url()));
  }
  if (message.has_title()) {
    dict.Set("title", (message.title()));
  }
  if (message.has_paid_content_metadata()) {
    dict.Set("paid_content_metadata", ::optimization_guide::proto::ToValue(message.paid_content_metadata()));
  }
  if (message.has_media_data()) {
    dict.Set("media_data", ::optimization_guide::proto::ToValue(message.media_data()));
  }
  if (!message.script_tools().empty()) {
    base::ListValue list;
    for (const auto& value : message.script_tools()) {
      list.Append(::optimization_guide::proto::ToValue(value));
    }
    dict.Set("script_tools", std::move(list));
  }
  if (!message.script_tool_results().empty()) {
    base::ListValue list;
    for (const auto& value : message.script_tool_results()) {
      list.Append(::optimization_guide::proto::ToValue(value));
    }
    dict.Set("script_tool_results", std::move(list));
  }
  if (message.has_default_line_height_px()) {
    dict.Set("default_line_height_px", ::proto_extras::ToNumericTypeForValue(message.default_line_height_px()));
  }
  return base::Value(std::move(dict));
}
void MaybeToValue(const std::optional<FrameInteractionInfo>& opt_message,
                    std::string_view name,
                    base::DictValue& output_dictionary) {
  if (!opt_message.has_value()) {
    return;
  }
  output_dictionary.Set(name, ToValue(*opt_message));
}
base::Value ToValue(const FrameInteractionInfo& message) {
  base::DictValue dict;
  ::proto_extras::SerializeUnknownFields(message, dict);
  if (message.has_selection()) {
    dict.Set("selection", ::optimization_guide::proto::ToValue(message.selection()));
  }
  if (message.has_focused_node_id()) {
    dict.Set("focused_node_id", (message.focused_node_id()));
  }
  if (message.has_accessibility_focused_node_id()) {
    dict.Set("accessibility_focused_node_id", (message.accessibility_focused_node_id()));
  }
  return base::Value(std::move(dict));
}
void MaybeToValue(const std::optional<Selection>& opt_message,
                    std::string_view name,
                    base::DictValue& output_dictionary) {
  if (!opt_message.has_value()) {
    return;
  }
  output_dictionary.Set(name, ToValue(*opt_message));
}
base::Value ToValue(const Selection& message) {
  base::DictValue dict;
  ::proto_extras::SerializeUnknownFields(message, dict);
  if (message.has_start_node_id()) {
    dict.Set("start_node_id", (message.start_node_id()));
  }
  if (message.has_start_offset()) {
    dict.Set("start_offset", (message.start_offset()));
  }
  if (message.has_end_node_id()) {
    dict.Set("end_node_id", (message.end_node_id()));
  }
  if (message.has_end_offset()) {
    dict.Set("end_offset", (message.end_offset()));
  }
  if (message.has_selected_text()) {
    dict.Set("selected_text", (message.selected_text()));
  }
  return base::Value(std::move(dict));
}
void MaybeToValue(const std::optional<DocumentIdentifier>& opt_message,
                    std::string_view name,
                    base::DictValue& output_dictionary) {
  if (!opt_message.has_value()) {
    return;
  }
  output_dictionary.Set(name, ToValue(*opt_message));
}
base::Value ToValue(const DocumentIdentifier& message) {
  base::DictValue dict;
  ::proto_extras::SerializeUnknownFields(message, dict);
  if (message.has_serialized_token()) {
    dict.Set("serialized_token", (message.serialized_token()));
  }
  return base::Value(std::move(dict));
}
void MaybeToValue(const std::optional<PaidContentMetadata>& opt_message,
                    std::string_view name,
                    base::DictValue& output_dictionary) {
  if (!opt_message.has_value()) {
    return;
  }
  output_dictionary.Set(name, ToValue(*opt_message));
}
base::Value ToValue(const PaidContentMetadata& message) {
  base::DictValue dict;
  ::proto_extras::SerializeUnknownFields(message, dict);
  if (message.has_contains_paid_content()) {
    dict.Set("contains_paid_content", static_cast<bool>(message.contains_paid_content()));
  }
  return base::Value(std::move(dict));
}
void MaybeToValue(const std::optional<MediaData>& opt_message,
                    std::string_view name,
                    base::DictValue& output_dictionary) {
  if (!opt_message.has_value()) {
    return;
  }
  output_dictionary.Set(name, ToValue(*opt_message));
}
base::Value ToValue(const MediaData& message) {
  base::DictValue dict;
  ::proto_extras::SerializeUnknownFields(message, dict);
  if (message.has_media_data_type()) {
    dict.Set("media_data_type", ::optimization_guide::proto::MediaDataType_Name(message.media_data_type()));
  }
  if (!message.transcripts().empty()) {
    base::ListValue list;
    for (const auto& value : message.transcripts()) {
      list.Append(::optimization_guide::proto::ToValue(value));
    }
    dict.Set("transcripts", std::move(list));
  }
  if (message.has_duration_milliseconds()) {
    dict.Set("duration_milliseconds", ::proto_extras::ToNumericTypeForValue(message.duration_milliseconds()));
  }
  if (message.has_current_position_milliseconds()) {
    dict.Set("current_position_milliseconds", ::proto_extras::ToNumericTypeForValue(message.current_position_milliseconds()));
  }
  if (message.has_is_playing()) {
    dict.Set("is_playing", static_cast<bool>(message.is_playing()));
  }
  if (message.has_title()) {
    dict.Set("title", (message.title()));
  }
  if (message.has_artist()) {
    dict.Set("artist", (message.artist()));
  }
  if (message.has_album()) {
    dict.Set("album", (message.album()));
  }
  return base::Value(std::move(dict));
}
void MaybeToValue(const std::optional<MediaTranscript>& opt_message,
                    std::string_view name,
                    base::DictValue& output_dictionary) {
  if (!opt_message.has_value()) {
    return;
  }
  output_dictionary.Set(name, ToValue(*opt_message));
}
base::Value ToValue(const MediaTranscript& message) {
  base::DictValue dict;
  ::proto_extras::SerializeUnknownFields(message, dict);
  if (message.has_text()) {
    dict.Set("text", (message.text()));
  }
  if (message.has_start_timestamp_milliseconds()) {
    dict.Set("start_timestamp_milliseconds", ::proto_extras::ToNumericTypeForValue(message.start_timestamp_milliseconds()));
  }
  return base::Value(std::move(dict));
}
void MaybeToValue(const std::optional<ScriptTool>& opt_message,
                    std::string_view name,
                    base::DictValue& output_dictionary) {
  if (!opt_message.has_value()) {
    return;
  }
  output_dictionary.Set(name, ToValue(*opt_message));
}
base::Value ToValue(const ScriptTool& message) {
  base::DictValue dict;
  ::proto_extras::SerializeUnknownFields(message, dict);
  if (message.has_name()) {
    dict.Set("name", (message.name()));
  }
  if (message.has_description()) {
    dict.Set("description", (message.description()));
  }
  if (message.has_input_schema()) {
    dict.Set("input_schema", (message.input_schema()));
  }
  if (message.has_annotations()) {
    dict.Set("annotations", ::optimization_guide::proto::ToValue(message.annotations()));
  }
  return base::Value(std::move(dict));
}
void MaybeToValue(const std::optional<ScriptToolAnnotations>& opt_message,
                    std::string_view name,
                    base::DictValue& output_dictionary) {
  if (!opt_message.has_value()) {
    return;
  }
  output_dictionary.Set(name, ToValue(*opt_message));
}
base::Value ToValue(const ScriptToolAnnotations& message) {
  base::DictValue dict;
  ::proto_extras::SerializeUnknownFields(message, dict);
  if (message.has_read_only()) {
    dict.Set("read_only", static_cast<bool>(message.read_only()));
  }
  return base::Value(std::move(dict));
}
void MaybeToValue(const std::optional<ScriptToolResult>& opt_message,
                    std::string_view name,
                    base::DictValue& output_dictionary) {
  if (!opt_message.has_value()) {
    return;
  }
  output_dictionary.Set(name, ToValue(*opt_message));
}
base::Value ToValue(const ScriptToolResult& message) {
  base::DictValue dict;
  ::proto_extras::SerializeUnknownFields(message, dict);
  if (message.has_index_of_script_tool_action()) {
    dict.Set("index_of_script_tool_action", (message.index_of_script_tool_action()));
  }
  if (message.has_result()) {
    dict.Set("result", (message.result()));
  }
  if (message.has_tool_name()) {
    dict.Set("tool_name", (message.tool_name()));
  }
  if (message.has_input_arguments()) {
    dict.Set("input_arguments", (message.input_arguments()));
  }
  if (message.has_tool()) {
    dict.Set("tool", ::optimization_guide::proto::ToValue(message.tool()));
  }
  return base::Value(std::move(dict));
}
void MaybeToValue(const std::optional<TableRowData>& opt_message,
                    std::string_view name,
                    base::DictValue& output_dictionary) {
  if (!opt_message.has_value()) {
    return;
  }
  output_dictionary.Set(name, ToValue(*opt_message));
}
base::Value ToValue(const TableRowData& message) {
  base::DictValue dict;
  ::proto_extras::SerializeUnknownFields(message, dict);
  if (message.has_type()) {
    dict.Set("type", ::optimization_guide::proto::TableRowType_Name(message.type()));
  }
  return base::Value(std::move(dict));
}
void MaybeToValue(const std::optional<PageInteractionInfo>& opt_message,
                    std::string_view name,
                    base::DictValue& output_dictionary) {
  if (!opt_message.has_value()) {
    return;
  }
  output_dictionary.Set(name, ToValue(*opt_message));
}
base::Value ToValue(const PageInteractionInfo& message) {
  base::DictValue dict;
  ::proto_extras::SerializeUnknownFields(message, dict);
  if (message.has_focused_node_id()) {
    dict.Set("focused_node_id", (message.focused_node_id()));
  }
  if (message.has_accessibility_focused_node_id()) {
    dict.Set("accessibility_focused_node_id", (message.accessibility_focused_node_id()));
  }
  if (message.has_mouse_position()) {
    dict.Set("mouse_position", ::optimization_guide::proto::ToValue(message.mouse_position()));
  }
  if (message.has_focused_frame()) {
    dict.Set("focused_frame", ::optimization_guide::proto::ToValue(message.focused_frame()));
  }
  if (message.has_accessibility_focused_frame()) {
    dict.Set("accessibility_focused_frame", ::optimization_guide::proto::ToValue(message.accessibility_focused_frame()));
  }
  return base::Value(std::move(dict));
}
void MaybeToValue(const std::optional<Point>& opt_message,
                    std::string_view name,
                    base::DictValue& output_dictionary) {
  if (!opt_message.has_value()) {
    return;
  }
  output_dictionary.Set(name, ToValue(*opt_message));
}
base::Value ToValue(const Point& message) {
  base::DictValue dict;
  ::proto_extras::SerializeUnknownFields(message, dict);
  if (message.has_x()) {
    dict.Set("x", (message.x()));
  }
  if (message.has_y()) {
    dict.Set("y", (message.y()));
  }
  return base::Value(std::move(dict));
}
void MaybeToValue(const std::optional<PopupWindow>& opt_message,
                    std::string_view name,
                    base::DictValue& output_dictionary) {
  if (!opt_message.has_value()) {
    return;
  }
  output_dictionary.Set(name, ToValue(*opt_message));
}
base::Value ToValue(const PopupWindow& message) {
  base::DictValue dict;
  ::proto_extras::SerializeUnknownFields(message, dict);
  if (message.has_root_node()) {
    dict.Set("root_node", ::optimization_guide::proto::ToValue(message.root_node()));
  }
  if (message.has_visible_bounding_box()) {
    dict.Set("visible_bounding_box", ::optimization_guide::proto::ToValue(message.visible_bounding_box()));
  }
  if (message.has_opener_document_id()) {
    dict.Set("opener_document_id", ::optimization_guide::proto::ToValue(message.opener_document_id()));
  }
  if (message.has_opener_common_ancestor_dom_node_id()) {
    dict.Set("opener_common_ancestor_dom_node_id", (message.opener_common_ancestor_dom_node_id()));
  }
  return base::Value(std::move(dict));
}
void MaybeToValue(const std::optional<ProfileInformation>& opt_message,
                    std::string_view name,
                    base::DictValue& output_dictionary) {
  if (!opt_message.has_value()) {
    return;
  }
  output_dictionary.Set(name, ToValue(*opt_message));
}
base::Value ToValue(const ProfileInformation& message) {
  base::DictValue dict;
  ::proto_extras::SerializeUnknownFields(message, dict);
  if (message.has_autofill_information()) {
    dict.Set("autofill_information", ::optimization_guide::proto::ToValue(message.autofill_information()));
  }
  return base::Value(std::move(dict));
}
void MaybeToValue(const std::optional<AutofillInformation>& opt_message,
                    std::string_view name,
                    base::DictValue& output_dictionary) {
  if (!opt_message.has_value()) {
    return;
  }
  output_dictionary.Set(name, ToValue(*opt_message));
}
base::Value ToValue(const AutofillInformation& message) {
  base::DictValue dict;
  ::proto_extras::SerializeUnknownFields(message, dict);
  if (!message.fillable_data().empty()) {
    base::ListValue list;
    for (const auto& value : message.fillable_data()) {
      list.Append(::optimization_guide::proto::AutofillInformation_FillableData_Name(value));
    }
    dict.Set("fillable_data", std::move(list));
  }
  return base::Value(std::move(dict));
}
void MaybeToValue(const std::optional<GeminiInChromePageMetadata>& opt_message,
                    std::string_view name,
                    base::DictValue& output_dictionary) {
  if (!opt_message.has_value()) {
    return;
  }
  output_dictionary.Set(name, ToValue(*opt_message));
}
base::Value ToValue(const GeminiInChromePageMetadata& message) {
  base::DictValue dict;
  ::proto_extras::SerializeUnknownFields(message, dict);
  if (message.has_screenshot_info()) {
    dict.Set("screenshot_info", ::optimization_guide::proto::ToValue(message.screenshot_info()));
  }
  return base::Value(std::move(dict));
}
void MaybeToValue(const std::optional<ScreenshotInfo>& opt_message,
                    std::string_view name,
                    base::DictValue& output_dictionary) {
  if (!opt_message.has_value()) {
    return;
  }
  output_dictionary.Set(name, ToValue(*opt_message));
}
base::Value ToValue(const ScreenshotInfo& message) {
  base::DictValue dict;
  ::proto_extras::SerializeUnknownFields(message, dict);
  if (message.has_has_selection_region_in_screenshot()) {
    dict.Set("has_selection_region_in_screenshot", static_cast<bool>(message.has_selection_region_in_screenshot()));
  }
  if (!message.iframe_info().empty()) {
    base::ListValue list;
    for (const auto& value : message.iframe_info()) {
      list.Append(::optimization_guide::proto::ToValue(value));
    }
    dict.Set("iframe_info", std::move(list));
  }
  if (message.has_screenshot_size()) {
    dict.Set("screenshot_size", ::optimization_guide::proto::ToValue(message.screenshot_size()));
  }
  return base::Value(std::move(dict));
}
void MaybeToValue(const std::optional<IframeInfo>& opt_message,
                    std::string_view name,
                    base::DictValue& output_dictionary) {
  if (!opt_message.has_value()) {
    return;
  }
  output_dictionary.Set(name, ToValue(*opt_message));
}
base::Value ToValue(const IframeInfo& message) {
  base::DictValue dict;
  ::proto_extras::SerializeUnknownFields(message, dict);
  if (message.has_security_origin()) {
    dict.Set("security_origin", ::optimization_guide::proto::ToValue(message.security_origin()));
  }
  if (message.has_url()) {
    dict.Set("url", (message.url()));
  }
  if (message.has_bounding_box()) {
    dict.Set("bounding_box", ::optimization_guide::proto::ToValue(message.bounding_box()));
  }
  return base::Value(std::move(dict));
}
void MaybeToValue(const std::optional<AutofillGlobalId>& opt_message,
                    std::string_view name,
                    base::DictValue& output_dictionary) {
  if (!opt_message.has_value()) {
    return;
  }
  output_dictionary.Set(name, ToValue(*opt_message));
}
base::Value ToValue(const AutofillGlobalId& message) {
  base::DictValue dict;
  ::proto_extras::SerializeUnknownFields(message, dict);
  if (message.has_frame_token()) {
    dict.Set("frame_token", (message.frame_token()));
  }
  if (message.has_renderer_id()) {
    dict.Set("renderer_id", ::proto_extras::ToNumericTypeForValue(message.renderer_id()));
  }
  return base::Value(std::move(dict));
}
void MaybeToValue(const std::optional<FormData>& opt_message,
                    std::string_view name,
                    base::DictValue& output_dictionary) {
  if (!opt_message.has_value()) {
    return;
  }
  output_dictionary.Set(name, ToValue(*opt_message));
}
base::Value ToValue(const FormData& message) {
  base::DictValue dict;
  ::proto_extras::SerializeUnknownFields(message, dict);
  if (message.has_form_name()) {
    dict.Set("form_name", (message.form_name()));
  }
  if (!message.fields().empty()) {
    base::ListValue list;
    for (const auto& value : message.fields()) {
      list.Append(::optimization_guide::proto::ToValue(value));
    }
    dict.Set("fields", std::move(list));
  }
  if (message.has_global_id()) {
    dict.Set("global_id", ::optimization_guide::proto::ToValue(message.global_id()));
  }
  if (message.has_form_signature()) {
    dict.Set("form_signature", ::proto_extras::ToNumericTypeForValue(message.form_signature()));
  }
  if (message.has_action_url()) {
    dict.Set("action_url", (message.action_url()));
  }
  return base::Value(std::move(dict));
}
void MaybeToValue(const std::optional<FormFieldData>& opt_message,
                    std::string_view name,
                    base::DictValue& output_dictionary) {
  if (!opt_message.has_value()) {
    return;
  }
  output_dictionary.Set(name, ToValue(*opt_message));
}
base::Value ToValue(const FormFieldData& message) {
  base::DictValue dict;
  ::proto_extras::SerializeUnknownFields(message, dict);
  if (message.has_field_name()) {
    dict.Set("field_name", (message.field_name()));
  }
  if (message.has_field_label()) {
    dict.Set("field_label", (message.field_label()));
  }
  if (message.has_field_value()) {
    dict.Set("field_value", (message.field_value()));
  }
  if (message.has_is_visible()) {
    dict.Set("is_visible", static_cast<bool>(message.is_visible()));
  }
  if (message.has_is_focusable()) {
    dict.Set("is_focusable", static_cast<bool>(message.is_focusable()));
  }
  if (message.has_form_control_type()) {
    dict.Set("form_control_type", ::optimization_guide::proto::FormControlType_Name(message.form_control_type()));
  }
  if (!message.select_options().empty()) {
    base::ListValue list;
    for (const auto& value : message.select_options()) {
      list.Append(::optimization_guide::proto::ToValue(value));
    }
    dict.Set("select_options", std::move(list));
  }
  if (message.has_placeholder()) {
    dict.Set("placeholder", (message.placeholder()));
  }
  if (message.has_form_control_ax_node_id()) {
    dict.Set("form_control_ax_node_id", (message.form_control_ax_node_id()));
  }
  if (message.has_is_eligible()) {
    dict.Set("is_eligible", static_cast<bool>(message.is_eligible()));
  }
  if (message.has_global_id()) {
    dict.Set("global_id", ::optimization_guide::proto::ToValue(message.global_id()));
  }
  if (message.has_field_signature()) {
    dict.Set("field_signature", ::proto_extras::ToNumericTypeForValue(message.field_signature()));
  }
  if (message.has_aria_label()) {
    dict.Set("aria_label", (message.aria_label()));
  }
  if (message.has_aria_description()) {
    dict.Set("aria_description", (message.aria_description()));
  }
  return base::Value(std::move(dict));
}
void MaybeToValue(const std::optional<TableRow>& opt_message,
                    std::string_view name,
                    base::DictValue& output_dictionary) {
  if (!opt_message.has_value()) {
    return;
  }
  output_dictionary.Set(name, ToValue(*opt_message));
}
base::Value ToValue(const TableRow& message) {
  base::DictValue dict;
  ::proto_extras::SerializeUnknownFields(message, dict);
  if (!message.cells().empty()) {
    base::ListValue list;
    for (const auto& value : message.cells()) {
      list.Append(::optimization_guide::proto::ToValue(value));
    }
    dict.Set("cells", std::move(list));
  }
  return base::Value(std::move(dict));
}
void MaybeToValue(const std::optional<TabGroupMinimal>& opt_message,
                    std::string_view name,
                    base::DictValue& output_dictionary) {
  if (!opt_message.has_value()) {
    return;
  }
  output_dictionary.Set(name, ToValue(*opt_message));
}
base::Value ToValue(const TabGroupMinimal& message) {
  base::DictValue dict;
  ::proto_extras::SerializeUnknownFields(message, dict);
  if (message.has_label()) {
    dict.Set("label", (message.label()));
  }
  if (!message.tab_ids().empty()) {
    base::ListValue list;
    for (const auto& value : message.tab_ids()) {
      list.Append(::proto_extras::ToNumericTypeForValue(value));
    }
    dict.Set("tab_ids", std::move(list));
  }
  if (message.has_group_id()) {
    dict.Set("group_id", (message.group_id()));
  }
  if (message.has_emoji()) {
    dict.Set("emoji", (message.emoji()));
  }
  return base::Value(std::move(dict));
}
void MaybeToValue(const std::optional<TabGroup>& opt_message,
                    std::string_view name,
                    base::DictValue& output_dictionary) {
  if (!opt_message.has_value()) {
    return;
  }
  output_dictionary.Set(name, ToValue(*opt_message));
}
base::Value ToValue(const TabGroup& message) {
  base::DictValue dict;
  ::proto_extras::SerializeUnknownFields(message, dict);
  if (message.has_label()) {
    dict.Set("label", (message.label()));
  }
  if (!message.tabs().empty()) {
    base::ListValue list;
    for (const auto& value : message.tabs()) {
      list.Append(::optimization_guide::proto::ToValue(value));
    }
    dict.Set("tabs", std::move(list));
  }
  if (message.has_group_id()) {
    dict.Set("group_id", (message.group_id()));
  }
  return base::Value(std::move(dict));
}
void MaybeToValue(const std::optional<Tab>& opt_message,
                    std::string_view name,
                    base::DictValue& output_dictionary) {
  if (!opt_message.has_value()) {
    return;
  }
  output_dictionary.Set(name, ToValue(*opt_message));
}
base::Value ToValue(const Tab& message) {
  base::DictValue dict;
  ::proto_extras::SerializeUnknownFields(message, dict);
  if (message.has_tab_id()) {
    dict.Set("tab_id", ::proto_extras::ToNumericTypeForValue(message.tab_id()));
  }
  if (message.has_title()) {
    dict.Set("title", (message.title()));
  }
  if (message.has_url()) {
    dict.Set("url", (message.url()));
  }
  if (message.has_page_context()) {
    dict.Set("page_context", ::optimization_guide::proto::ToValue(message.page_context()));
  }
  if (message.has_last_active_timestamp_ms()) {
    dict.Set("last_active_timestamp_ms", ::proto_extras::ToNumericTypeForValue(message.last_active_timestamp_ms()));
  }
  if (message.has_last_foreground_duration_ms()) {
    dict.Set("last_foreground_duration_ms", ::proto_extras::ToNumericTypeForValue(message.last_foreground_duration_ms()));
  }
  return base::Value(std::move(dict));
}
void MaybeToValue(const std::optional<SiteEngagementEntry>& opt_message,
                    std::string_view name,
                    base::DictValue& output_dictionary) {
  if (!opt_message.has_value()) {
    return;
  }
  output_dictionary.Set(name, ToValue(*opt_message));
}
base::Value ToValue(const SiteEngagementEntry& message) {
  base::DictValue dict;
  ::proto_extras::SerializeUnknownFields(message, dict);
  if (message.has_url()) {
    dict.Set("url", (message.url()));
  }
  if (message.has_score()) {
    dict.Set("score", static_cast<double>(message.score()));
  }
  return base::Value(std::move(dict));
}
void MaybeToValue(const std::optional<SiteEngagement>& opt_message,
                    std::string_view name,
                    base::DictValue& output_dictionary) {
  if (!opt_message.has_value()) {
    return;
  }
  output_dictionary.Set(name, ToValue(*opt_message));
}
base::Value ToValue(const SiteEngagement& message) {
  base::DictValue dict;
  ::proto_extras::SerializeUnknownFields(message, dict);
  if (!message.entries().empty()) {
    base::ListValue list;
    for (const auto& value : message.entries()) {
      list.Append(::optimization_guide::proto::ToValue(value));
    }
    dict.Set("entries", std::move(list));
  }
  return base::Value(std::move(dict));
}
void MaybeToValue(const std::optional<Coordinate>& opt_message,
                    std::string_view name,
                    base::DictValue& output_dictionary) {
  if (!opt_message.has_value()) {
    return;
  }
  output_dictionary.Set(name, ToValue(*opt_message));
}
base::Value ToValue(const Coordinate& message) {
  base::DictValue dict;
  ::proto_extras::SerializeUnknownFields(message, dict);
  if (message.has_x()) {
    dict.Set("x", (message.x()));
  }
  if (message.has_y()) {
    dict.Set("y", (message.y()));
  }
  if (message.has_pixel_type()) {
    dict.Set("pixel_type", ::optimization_guide::proto::Coordinate_PixelType_Name(message.pixel_type()));
  }
  return base::Value(std::move(dict));
}
void MaybeToValue(const std::optional<TimeDuration>& opt_message,
                    std::string_view name,
                    base::DictValue& output_dictionary) {
  if (!opt_message.has_value()) {
    return;
  }
  output_dictionary.Set(name, ToValue(*opt_message));
}
base::Value ToValue(const TimeDuration& message) {
  base::DictValue dict;
  ::proto_extras::SerializeUnknownFields(message, dict);
  if (message.has_seconds()) {
    dict.Set("seconds", ::proto_extras::ToNumericTypeForValue(message.seconds()));
  }
  if (message.has_nanos()) {
    dict.Set("nanos", (message.nanos()));
  }
  return base::Value(std::move(dict));
}
void MaybeToValue(const std::optional<TimeZone>& opt_message,
                    std::string_view name,
                    base::DictValue& output_dictionary) {
  if (!opt_message.has_value()) {
    return;
  }
  output_dictionary.Set(name, ToValue(*opt_message));
}
base::Value ToValue(const TimeZone& message) {
  base::DictValue dict;
  ::proto_extras::SerializeUnknownFields(message, dict);
  if (message.has_id()) {
    dict.Set("id", (message.id()));
  }
  if (message.has_version()) {
    dict.Set("version", (message.version()));
  }
  return base::Value(std::move(dict));
}
void MaybeToValue(const std::optional<DateTime>& opt_message,
                    std::string_view name,
                    base::DictValue& output_dictionary) {
  if (!opt_message.has_value()) {
    return;
  }
  output_dictionary.Set(name, ToValue(*opt_message));
}
base::Value ToValue(const DateTime& message) {
  base::DictValue dict;
  ::proto_extras::SerializeUnknownFields(message, dict);
  if (message.has_utc_offset()) {
    dict.Set("utc_offset", ::optimization_guide::proto::ToValue(message.utc_offset()));
  }
  if (message.has_time_zone()) {
    dict.Set("time_zone", ::optimization_guide::proto::ToValue(message.time_zone()));
  }
  if (message.has_year()) {
    dict.Set("year", (message.year()));
  }
  if (message.has_month()) {
    dict.Set("month", (message.month()));
  }
  if (message.has_day()) {
    dict.Set("day", (message.day()));
  }
  if (message.has_hours()) {
    dict.Set("hours", (message.hours()));
  }
  if (message.has_minutes()) {
    dict.Set("minutes", (message.minutes()));
  }
  if (message.has_seconds()) {
    dict.Set("seconds", (message.seconds()));
  }
  if (message.has_nanos()) {
    dict.Set("nanos", (message.nanos()));
  }
  return base::Value(std::move(dict));
}
void MaybeToValue(const std::optional<MetaTag>& opt_message,
                    std::string_view name,
                    base::DictValue& output_dictionary) {
  if (!opt_message.has_value()) {
    return;
  }
  output_dictionary.Set(name, ToValue(*opt_message));
}
base::Value ToValue(const MetaTag& message) {
  base::DictValue dict;
  ::proto_extras::SerializeUnknownFields(message, dict);
  if (message.has_name()) {
    dict.Set("name", (message.name()));
  }
  if (message.has_content()) {
    dict.Set("content", (message.content()));
  }
  return base::Value(std::move(dict));
}
void MaybeToValue(const std::optional<FrameMetadata>& opt_message,
                    std::string_view name,
                    base::DictValue& output_dictionary) {
  if (!opt_message.has_value()) {
    return;
  }
  output_dictionary.Set(name, ToValue(*opt_message));
}
base::Value ToValue(const FrameMetadata& message) {
  base::DictValue dict;
  ::proto_extras::SerializeUnknownFields(message, dict);
  if (message.has_url()) {
    dict.Set("url", (message.url()));
  }
  if (!message.meta_tags().empty()) {
    base::ListValue list;
    for (const auto& value : message.meta_tags()) {
      list.Append(::optimization_guide::proto::ToValue(value));
    }
    dict.Set("meta_tags", std::move(list));
  }
  if (message.has_has_media_transcripts()) {
    dict.Set("has_media_transcripts", static_cast<bool>(message.has_media_transcripts()));
  }
  return base::Value(std::move(dict));
}
void MaybeToValue(const std::optional<PageMetadata>& opt_message,
                    std::string_view name,
                    base::DictValue& output_dictionary) {
  if (!opt_message.has_value()) {
    return;
  }
  output_dictionary.Set(name, ToValue(*opt_message));
}
base::Value ToValue(const PageMetadata& message) {
  base::DictValue dict;
  ::proto_extras::SerializeUnknownFields(message, dict);
  if (!message.frame_metadata().empty()) {
    base::ListValue list;
    for (const auto& value : message.frame_metadata()) {
      list.Append(::optimization_guide::proto::ToValue(value));
    }
    dict.Set("frame_metadata", std::move(list));
  }
  return base::Value(std::move(dict));
}
void MaybeToValue(const std::optional<DocumentSelection>& opt_message,
                    std::string_view name,
                    base::DictValue& output_dictionary) {
  if (!opt_message.has_value()) {
    return;
  }
  output_dictionary.Set(name, ToValue(*opt_message));
}
base::Value ToValue(const DocumentSelection& message) {
  base::DictValue dict;
  ::proto_extras::SerializeUnknownFields(message, dict);
  if (message.has_document_identifier()) {
    dict.Set("document_identifier", ::optimization_guide::proto::ToValue(message.document_identifier()));
  }
  if (message.has_selection()) {
    dict.Set("selection", ::optimization_guide::proto::ToValue(message.selection()));
  }
  return base::Value(std::move(dict));
}
void MaybeToValue(const std::optional<AgentContainerConfig>& opt_message,
                    std::string_view name,
                    base::DictValue& output_dictionary) {
  if (!opt_message.has_value()) {
    return;
  }
  output_dictionary.Set(name, ToValue(*opt_message));
}
base::Value ToValue(const AgentContainerConfig& message) {
  base::DictValue dict;
  ::proto_extras::SerializeUnknownFields(message, dict);
  if (!message.location_rules().empty()) {
    base::ListValue list;
    for (const auto& value : message.location_rules()) {
      list.Append(::optimization_guide::proto::ToValue(value));
    }
    dict.Set("location_rules", std::move(list));
  }
  return base::Value(std::move(dict));
}
void MaybeToValue(const std::optional<LocationRule>& opt_message,
                    std::string_view name,
                    base::DictValue& output_dictionary) {
  if (!opt_message.has_value()) {
    return;
  }
  output_dictionary.Set(name, ToValue(*opt_message));
}
base::Value ToValue(const LocationRule& message) {
  base::DictValue dict;
  ::proto_extras::SerializeUnknownFields(message, dict);
  if (message.has_location()) {
    dict.Set("location", ::optimization_guide::proto::ToValue(message.location()));
  }
  if (message.has_metadata()) {
    dict.Set("metadata", ::optimization_guide::proto::ToValue(message.metadata()));
  }
  if (!message.navigation_sources().empty()) {
    base::ListValue list;
    for (const auto& value : message.navigation_sources()) {
      list.Append(::optimization_guide::proto::ToValue(value));
    }
    dict.Set("navigation_sources", std::move(list));
  }
  return base::Value(std::move(dict));
}
void MaybeToValue(const std::optional<Location>& opt_message,
                    std::string_view name,
                    base::DictValue& output_dictionary) {
  if (!opt_message.has_value()) {
    return;
  }
  output_dictionary.Set(name, ToValue(*opt_message));
}
base::Value ToValue(const Location& message) {
  base::DictValue dict;
  ::proto_extras::SerializeUnknownFields(message, dict);
  if (message.has_origin()) {
    dict.Set("origin", ::optimization_guide::proto::ToValue(message.origin()));
  }
  if (message.has_site()) {
    dict.Set("site", ::optimization_guide::proto::ToValue(message.site()));
  }
  if (message.has_wildcard()) {
    dict.Set("wildcard", ::optimization_guide::proto::ToValue(message.wildcard()));
  }
  return base::Value(std::move(dict));
}
void MaybeToValue(const std::optional<Origin>& opt_message,
                    std::string_view name,
                    base::DictValue& output_dictionary) {
  if (!opt_message.has_value()) {
    return;
  }
  output_dictionary.Set(name, ToValue(*opt_message));
}
base::Value ToValue(const Origin& message) {
  base::DictValue dict;
  ::proto_extras::SerializeUnknownFields(message, dict);
  if (message.has_protocol()) {
    dict.Set("protocol", ::optimization_guide::proto::Protocol_Name(message.protocol()));
  }
  if (message.has_host()) {
    dict.Set("host", (message.host()));
  }
  if (message.has_port()) {
    dict.Set("port", (message.port()));
  }
  return base::Value(std::move(dict));
}
void MaybeToValue(const std::optional<Site>& opt_message,
                    std::string_view name,
                    base::DictValue& output_dictionary) {
  if (!opt_message.has_value()) {
    return;
  }
  output_dictionary.Set(name, ToValue(*opt_message));
}
base::Value ToValue(const Site& message) {
  base::DictValue dict;
  ::proto_extras::SerializeUnknownFields(message, dict);
  if (message.has_protocol()) {
    dict.Set("protocol", ::optimization_guide::proto::Protocol_Name(message.protocol()));
  }
  if (message.has_domain()) {
    dict.Set("domain", (message.domain()));
  }
  return base::Value(std::move(dict));
}
void MaybeToValue(const std::optional<AnySite>& opt_message,
                    std::string_view name,
                    base::DictValue& output_dictionary) {
  if (!opt_message.has_value()) {
    return;
  }
  output_dictionary.Set(name, ToValue(*opt_message));
}
base::Value ToValue(const AnySite& message) {
  base::DictValue dict;
  ::proto_extras::SerializeUnknownFields(message, dict);
  return base::Value(std::move(dict));
}
void MaybeToValue(const std::optional<RuleMetadata>& opt_message,
                    std::string_view name,
                    base::DictValue& output_dictionary) {
  if (!opt_message.has_value()) {
    return;
  }
  output_dictionary.Set(name, ToValue(*opt_message));
}
base::Value ToValue(const RuleMetadata& message) {
  base::DictValue dict;
  ::proto_extras::SerializeUnknownFields(message, dict);
  if (!message.accessible_resources().empty()) {
    base::ListValue list;
    for (const auto& value : message.accessible_resources()) {
      list.Append(::optimization_guide::proto::RuleMetadata_AgentResource_Name(value));
    }
    dict.Set("accessible_resources", std::move(list));
  }
  if (!message.capabilities().empty()) {
    base::ListValue list;
    for (const auto& value : message.capabilities()) {
      list.Append(::optimization_guide::proto::RuleMetadata_ActuationCapability_Name(value));
    }
    dict.Set("capabilities", std::move(list));
  }
  return base::Value(std::move(dict));
}
void MaybeToValue(const std::optional<NavigationSource>& opt_message,
                    std::string_view name,
                    base::DictValue& output_dictionary) {
  if (!opt_message.has_value()) {
    return;
  }
  output_dictionary.Set(name, ToValue(*opt_message));
}
base::Value ToValue(const NavigationSource& message) {
  base::DictValue dict;
  ::proto_extras::SerializeUnknownFields(message, dict);
  if (message.has_source()) {
    dict.Set("source", ::optimization_guide::proto::ToValue(message.source()));
  }
  return base::Value(std::move(dict));
}
}  // namespace proto
}  // namespace optimization_guide

