chromium/chrome/browser/search/background/ntp_background.proto

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

// Protocol buffer messages to get image information from the Backdrop
// service, including collection names, image urls and descriptions.

syntax = "proto2";

package ntp.background;

option optimize_for = LITE_RUNTIME;

// Information about the creator or owner of an image.
message Attribution {
  // A localized description of the attribution of an image e.g.
  // "Photo by John Doe" or "Geschrieben von John".
  optional string text = 1;
}

message Image {
  // A unique ID for the image.
  optional fixed64 asset_id = 1;

  // The image URL.
  optional string image_url = 2;

  // A URL that can be accessed to find out more information about the image.
  // For example, a link to more information about an artist or photographer or
  // to a Google+ post.
  optional string action_url = 3;

  // An attribution list for the image.
  repeated Attribution attribution = 4;
}

// A logical grouping of images e.g. landscapes or space photography.
message Collection {
  // The unique id for the collection.
  optional string collection_id = 1;

  // A localized description of the collection e.g. "Landscapes" or "Kunst".
  optional string collection_name = 2;

  // A list of representative images for the collection. Currently only a single
  // image will be returned.
  repeated Image preview = 3;
}

message GetCollectionsRequest {
  // The language that should be used for content. e.g. "en-US"
  optional string language = 1;

  // The approximate permanent location of the user. e.g. "us".
  optional string region = 2;

  // Label (e.g. "chrome_desktop_ntp") used to return exclusive content or
  // filter unwanted collections from the corpus.
  repeated string filtering_label = 3;
}

message GetCollectionsResponse {
  // A list of every available collection for the given language and region.
  repeated Collection collections = 1;
}

message GetImagesInCollectionRequest {
  // Deprecated or unused tag numbers
  reserved 4;

  // The id of the collection being requested.
  optional string collection_id = 1;

  // The language that should be used for content. e.g. "en-US"
  optional string language = 2;

  // The approximate permanent location of the user e.g. "us".
  optional string region = 3;
}

message GetImagesInCollectionResponse {
  // A list of all the images in the requested collection, filtered by language
  // and region.
  repeated Image images = 1;
}

message GetImageFromCollectionRequest {
  // Deprecated or unused tag numbers
  reserved 4;

  // The ids of the collections being requested.
  repeated string collection_ids = 1;

  // An opaque token that is used to prevent duplicate images being returned.
  optional string resume_token = 2;

  // The language that should be used for content. e.g. "en-US"
  optional string language = 3;
}

message GetImageFromCollectionResponse {
  // The next image selected from the given collection.
  optional Image image = 1;

  // An opaque token that should be passed in subsequent calls and is used to
  // prevent duplicate images from being returned.
  optional string resume_token = 2;
}