chromium/chrome/browser/web_applications/proto/web_app_os_integration_state.proto

// Copyright 2022 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;

package web_app.proto;

// Store size and timestamp of an icon so that changes can be easily detected.
message ShortcutIconData {
  optional int32 icon_size = 1;
  optional int64 timestamp = 2;
}

message ShortcutDescription {
  optional string title = 1;
  optional string description = 2;
  repeated ShortcutIconData icon_data_any = 3;
}

message ProtocolsHandled {
  message Protocol {
    optional string protocol = 1;
    optional string url = 2;
  }
  repeated Protocol protocols = 1;
}

// Run on OS Login modes for web app.
// See chrome/browser/web_applications/web_app_constants.h
// for web_app::RunOnOsLoginMode definition, which this enum should be in sync
// with.
enum RunOnOsLoginMode {
  RUN_ON_OS_LOGIN_MODE_UNSPECIFIED = 0;
  NOT_RUN = 1;
  WINDOWED = 2;
  MINIMIZED = 3;
}

message RunOnOsLogin {
  optional RunOnOsLoginMode run_on_os_login_mode = 1;
}

message ShortcutMenuInfo {
  optional string shortcut_name = 1;
  optional string shortcut_launch_url = 2;
  repeated ShortcutIconData icon_data_any = 3;
  repeated ShortcutIconData icon_data_maskable = 4;
  repeated ShortcutIconData icon_data_monochrome = 5;
}

message ShortcutMenus {
  repeated ShortcutMenuInfo shortcut_menu_info = 1;
}

message OsUninstallRegistration {
  optional bool registered_with_os = 1;
  optional string display_name = 2;
}

message FileHandling {
  // A mapping between a MIME type and a set of file extensions for a file
  // handler "accept" entry. See chrome/browser/web_applications/web_app.h for
  // details.
  message FileHandler {
    message FileHandlerAccept {
      optional string mimetype = 1;
      repeated string file_extensions = 2;
    }
    optional string action = 1;
    repeated FileHandlerAccept accept = 2;
    optional string display_name = 3;
  }

  repeated FileHandler file_handlers = 1;
}

// Represents all OS integration. This is intended to be the 'final' OS
// integration state, after any logic that would filter/modify/disable any of
// the features. When stored in the database, this represents the expected OS
// integration state for this app.
message WebAppOsIntegrationState {
  reserved 2, 8;
  optional ShortcutDescription shortcut = 1;
  optional ProtocolsHandled protocols_handled = 3;
  optional RunOnOsLogin run_on_os_login = 4;
  optional OsUninstallRegistration uninstall_registration = 5;
  optional ShortcutMenus shortcut_menus = 6;
  optional FileHandling file_handling = 7;
  // Add data states for other OS integration hooks here.
  // New fields added to this message must also be added to:
  // OsStatesDebugValue() and GenerateRandomWebAppOsIntegrationState().
}