chromium/chrome/browser/web_applications/proto/web_app_share_target.proto

// Copyright 2020 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

syntax = "proto2";

option optimize_for = LITE_RUNTIME;

// TODO(http://b/307989065) Make this web_app.proto
package web_app;

// A proto representing a ShareTargetParamsFile
// https://w3c.github.io/web-share-target/level-2/#sharetargetfiles-and-its-members
message ShareTargetParamsFile {
  optional string name = 1;  // Required.
  repeated string accept = 2;
}

// A proto representing ShareTargetParams
// https://w3c.github.io/web-share-target/#dom-sharetargetparams
// Each field corresponds to key in ShareData. These are the query parameter
// keys to be used for the data supplied in a ShareData instance.
// ShareData: https://w3c.github.io/web-share#dom-sharedata
message ShareTargetParams {
  optional string title = 1;
  optional string text = 2;
  optional string url = 3;
  repeated ShareTargetParamsFile files = 4;
}

// A proto representing a ShareTarget.
// https://w3c.github.io/web-share-target/#dom-sharetarget
message ShareTarget {
  // Proto version of apps::ShareTarget::Method.
  // NEVER change these numbers or re-use old ones; only add new ones.
  enum Method {
    GET = 0;
    POST = 1;
  };

  // Proto version of apps::ShareTarget::Enctype.
  // NEVER change these numbers or re-use old ones; only add new ones.
  enum Enctype {
    FORM_URL_ENCODED = 0;
    MULTIPART_FORM_DATA = 1;
  };

  // The URL to be resolved when sharing.
  optional string action = 1;             // Required.
  optional Method method = 2;             // Required.
  optional Enctype enctype = 3;           // Required.
  optional ShareTargetParams params = 4;  // Required.
}