summaryrefslogtreecommitdiff
path: root/chromium/components/ntp_snippets/contextual/proto/get_pivots_response.proto
blob: 72b54f6bc16e625a3971cd3d80a874a8f508bffe (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
// Copyright 2018 The Chromium Authors. All rights reserved.
// 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 contextual_suggestions;

message GetPivotsResponse {
  // The suggested followups.
  optional Pivots pivots = 2;
}

// Container for all explore on content data.
message Pivots {
  // Items related to the user's context.
  repeated PivotItem item = 1;

  // The conditions under which auto-peek should be enabled.
  optional AutoPeekConditions auto_peek_conditions = 3;

  // The text to present to the user in the peek.
  optional PeekText peek_text = 4;
}

// One related response.
message PivotItem {
  oneof kind {
    PivotDocument document = 1;
    PivotCluster cluster = 6;
  }
}

// A document related to the source data.
message PivotDocument {
  // A link to the document.
  optional Url url = 1;

  // An image that may be shown next to the document.
  optional Image image = 2;

  // Title of this document.
  optional string title = 3;

  // Snippet summary of this document.
  optional string summary = 4;

  // Human-readable version of the source site's name (e.g. "CNN" instead of
  // "cnn.com").
  optional string site_name = 5;

  // A favicon image, usually related to the site.
  optional Image favicon_image = 6;
}

// A cluster of responses related to the source data. The cluster optionally has
// a label.
message PivotCluster {
  // Label for the cluster.
  optional ClusterLabel label = 1;

  // Ranked items that belong to this cluster.
  repeated PivotItem item = 2;

  // Number of items to show to the user before they expand.
  optional int32 num_items_to_display_pre_expansion = 3 [default = 1];
}

// The label for a cluster of followup items.
message ClusterLabel {
  // Label to display to the user.
  optional string label = 1;
}

message AutoPeekConditions {
  // A measure of confidence that auto-peek should be enabled for this response
  // in the range [0, 1].  In general, if the value is 1.0, auto-peek should be
  // enabled; if 0.0, it shouldn’t; and intermediate values are left to the
  // client to decide.
  optional float confidence = 1 [default = 1.0];

  // The percentage of the page that the user scrolls required for an auto
  // peek to occur. Value should be a decimal between 0 and 1.0.
  // 1.0 represents the entire page's length.
  optional float page_scroll_percentage = 2 [default = 0.0];

  // The minimum time (seconds) the user spends on the page required for
  // auto peek.
  optional float minimum_seconds_on_page = 3 [default = 0.0];

  // The maximum number of auto peeks that we can show for this page.
  // If set to 0, we will never auto peek. Service can set this to a very
  // large number to effectively have unlimited auto peeks.
  optional uint64 maximum_number_of_peeks = 4 [default = 0];
}

message PeekText {
  // Text to display to the user.
  optional string text = 1;
}

message Url {
  optional string raw_url = 1;
}

message Image {
  // The identity of this image.
  optional ImageId id = 1;

  // The underlying source data that encodes the image.
  optional ImageSource source_data = 2;
}

message ImageId {
  // The encrypted document ID of the image, which is a base64-encoded string
  // that can be used to generate image URLs of the form:
  //
  //     "http://www.google.com/images?q=tbn:<encrypted doc id>"
  //
  // For example, the image:
  //
  //     "http://www.google.com/images?q=tbn:e-AB_0zkH08qtM
  //
  // ... has an encrypted doc ID of "e-AB_0zkH08qtM".
  optional string encrypted_docid = 1;
}

// Represents the underlying encoding / source data for an image.
message ImageSource {
  // The raster image representation.
  optional RasterImage raster = 1;
}

// A representation of an image as a collection of pixels at a specific size.
message RasterImage {
  // A URL at which the image may be retrieved. The format of the image
  // is determined by the "Content-Type" of the HTTP response for the URL.
  optional Url url = 2;
}