chromium/chrome/browser/companion/core/proto/companion_url_params.proto

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

syntax = "proto3";
option optimize_for = LITE_RUNTIME;

package companion.proto;

// Information passed to the server side to make a decision on whether or not to
// show various promos.
// Keep this file in sync with
// google3/lens/web/standalone/companion/proto/companion_url_params.proto

message Timestamp {
  // Represents seconds of UTC time since Unix epoch
  // 1970-01-01T00:00:00Z. Must be from 0001-01-01T00:00:00Z to
  // 9999-12-31T23:59:59Z inclusive.
  optional int64 seconds = 1;

  // Non-negative fractions of a second at nanosecond resolution. Negative
  // second values with fractions must still have non-negative nanos values
  // that count forward in time. Must be from 0 to 999,999,999
  // inclusive.
  optional int32 nanos = 2;
}

// Next ID: 8
message PromoState {
  // Number of times the user has denied various promo requests in past.
  int32 signin_promo_denial_count = 1;
  int32 msbb_promo_denial_count = 2;
  int32 exps_promo_denial_count = 3;
  int32 exps_promo_shown_count = 4;
  bool should_show_region_search_iph = 5;
  int32 pco_promo_denial_count = 6;
  int32 pco_promo_shown_count = 7;
}

// This proto file is shared between Chrome and Server side and used to pack the
// URL query params for the companion URL request.
// Next ID: 16
message CompanionUrlParams {
  reserved 4, 5;

  // URL of the main contents. Empty, if MSBB is off.
  string page_url = 1;

  // Whether *either* make searches and browsing better is *or* page content
  // sharing are enabled in the settings; since enabling either grants
  // permission to share the user's URLs with CSC.
  bool is_page_url_sharing_enabled = 2;

  // State for driving promo related decisions.
  PromoState promo_state = 3;

  // Whether user is already signed in.
  bool is_signed_in = 6;

  // Whether user is allowed to sign in.
  bool is_sign_in_allowed = 7;

  // Whether the Search Companion entrypoint is pinned to the toolbar.
  optional bool is_entrypoint_pinned_by_default = 8;

  // Whether link clicks in Search Companion open a new tab.
  optional bool links_open_in_new_tab = 9;

  // Whether visual query suggestions are enabled on Chrome.
  optional bool is_vqs_enabled_on_chrome = 10;

  // Whether the upload dialog file chooser is supported on Chrome.
  optional bool is_upload_dialog_supported = 11;

  // Whether the hard refresh protocol message is supported on Chrome.
  optional bool is_hard_refresh_supported = 12;

  // Whether page content sharing is enabled in the settings.
  bool is_page_content_sharing_enabled = 13;

  // The timestamp of the user requesting to open the companion for a query.
  optional Timestamp query_start_time = 14;

  // Whether the companion page content feature is enabled. The user preference
  // may be disabled though. The PCO promo should only be shown if this is true,
  // because asking the user to opt-in to a no-op seems bad. The PCO promo does
  // not necessarily have to be shown when this is true; e.g. maybe the user has
  // already opted-in.
  bool is_page_content_enabled = 15;
}