Chrome Release Bot (LUCI) 4762b62e7d Publish DEPS for 106.0.5249.13 1 year ago
..
fuzzer 4762b62e7d Publish DEPS for 106.0.5249.13 1 year ago
BUILD.gn 4762b62e7d Publish DEPS for 106.0.5249.13 1 year ago
README.md 4762b62e7d Publish DEPS for 106.0.5249.13 1 year ago
chrome_device_policy.proto 4762b62e7d Publish DEPS for 106.0.5249.13 1 year ago
chrome_extension_policy.proto 4762b62e7d Publish DEPS for 106.0.5249.13 1 year ago
device_management_backend.proto 4762b62e7d Publish DEPS for 106.0.5249.13 1 year ago
install_attributes.proto 4762b62e7d Publish DEPS for 106.0.5249.13 1 year ago
policy_common_definitions.proto 4762b62e7d Publish DEPS for 106.0.5249.13 1 year ago
policy_proto_export.h 4762b62e7d Publish DEPS for 106.0.5249.13 1 year ago
policy_signing_key.proto 4762b62e7d Publish DEPS for 106.0.5249.13 1 year ago
secure_connect.proto 4762b62e7d Publish DEPS for 106.0.5249.13 1 year ago

README.md

About //components/policy/proto

This directory contains proto definitions for communication with the device management server.

User policies

There are two protocol buffers defining the messages for user policies - chrome_settings.proto and cloud_policy.proto. Both files are auto-generated by the generate_policy_source.py script based on policy_templates.json as part of building Chrome.

The reason there are two files is a compromise between readability and performance.

  • chrome_settings.proto

This file lists all non-device policies including comments containing their detailed descriptions. Additionally every policy in this file has a distinct message type. For example, this is the message for the HomepageLocation policy:

  message HomepageLocationProto {
    optional PolicyOptions policy_options = 1;
    optional string HomepageLocation = 2;
  }
  • cloud_policy.proto

This file is generated for each target platform and it therefore contains only the policy messages that a certain platform supports. Additionally each field uses a generic type defined in policy_common_definitions.proto. For example this is the message for any string policy:

  message StringPolicyProto {
    optional PolicyOptions policy_options = 1;
    optional string value = 2;
  }

The client code for each platform uses the more compact cloud_policy.proto to parse the policy blobs it receives from the device management server. On the other hand, the device management server needs to know of all the policies that exist for all the platforms, therefore chrome_settings.proto is what the server code uses.

The two files are compatible and when the messages are serialized their binary content is equivalent. CloudPolicyProtoTest.VerifyProtobufEquivalence browser test makes sure that no regressions are introduced here.