summaryrefslogtreecommitdiffstats
path: root/sync/protocol/synced_notification_render.proto
blob: 47dd6c8133a42a73bb74a3b97daa8f5a15916e2b (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
// Copyright (c) 2012 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.
//

// Update proto_value_conversions{.h,.cc,_unittest.cc} if you change
// any fields in this file.

syntax = "proto2";

option optimize_for = LITE_RUNTIME;
option retain_unknown_fields = true;

package sync_pb;

// Data that is used directly by endpoints to render notifications in the case
// where no "native" app can handle the notification.
message SyncedNotificationRenderInfo {
  message Layout {
    enum LayoutType {
      TITLE_AND_SUBTEXT = 1;
      TITLE_AND_IMAGE = 2;
    }
    optional LayoutType layout_type = 1;

    message TitleAndSubtextData {
      optional string title = 1;
      // The icon to show on the left of the notification.
      optional SyncedNotificationIcon icon = 2;
      // Multiple lines of the sub-text.
      repeated string subtext = 3;
    }
    optional TitleAndSubtextData title_and_subtext_data = 3;

    message TitleAndImageData {
      optional string title = 1;
      optional SyncedNotificationImage image = 2;
    }
    optional TitleAndImageData title_and_image_data = 4;
  }
  optional Layout layout = 1;

  // An Action encapsulates an UI component that trigger certain programmable
  // actions.  Depending on the endpoint, this may show up as a html button,
  // "quick actions" in the Android notification drawer, a link, or even the
  // notification card itself (the "default" action case).
  message Action {
    // The description for the Action.
    optional string text = 1;

    // The icon to use for the Action.
    optional SyncedNotificationIcon icon = 2;

    // Specify whether the action should be a background action or
    // should open up a web page with the specified URL.
    optional bool is_background = 3;

    // The url to send users to when they trigger the action.
    optional string action_url = 4;

    // If post_data is populated, this indicates that action_url should be
    // contacted via a POST rather than a GET.
    optional string post_data = 5;
  }
  // All the actions that can be triggered from this (coalesced) notification.
  // This is sorted by importance so depending on the end point, the first N
  // actions should be used (and the first action is the "default" action).
  // For default actions, the icon and text params are ignored.
  repeated Action action = 2;
}

message SyncedNotificationImage {
  optional string url = 1;
  // This is somewhat made up - not sure what else apart from url do we need
  // about an image.
  optional string alt_text = 2;
  optional int32 preferred_width = 3;
  optional int32 preferred_height = 4;
}

message SyncedNotificationIcon {
  optional string url = 1;
}