summaryrefslogtreecommitdiffstats
path: root/chromium/ash/public/mojom/assistant_controller.mojom
blob: bb7e017860d923636f8094e31e63be9f029e150a (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
// 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.

module ash.mojom;

import "chromeos/services/assistant/public/mojom/assistant_notification.mojom";
import "mojo/public/mojom/base/time.mojom";
import "ui/gfx/geometry/mojom/geometry.mojom";

enum AssistantTimerState {
  kUnknown,
  // The timer is scheduled to fire at some future date.
  kScheduled,
  // The timer will not fire but is kept in the queue of scheduled events;
  // it can be resumed after which it will fire in |remaining_duration_ms|.
  kPaused,
  // The timer has fired. In the simplest case this means the timer has
  // begun ringing.
  kFired,
};

struct AssistantTimer {
  string timer_id;

  // The current state of this timer.
  AssistantTimerState state;

  // TODO(llin): Add more timer data.
};

// Assistant alarm/timer event type.
// Currently, the AlarmTimerManager maintains only one firing alarm/timer,
// the previous one will be dismissed if the second one firing.
enum AssistantAlarmTimerEventType {
  kTimer
  // TODO(llin): Add alarm event type.
};

union AlarmTimerData {
  AssistantTimer timer_data;
  // TODO(llin): Add alarm data.
};

// A composite struct that will hold exactly one alarm or timer.
struct AssistantAlarmTimerEvent {
  AssistantAlarmTimerEventType type;

  AlarmTimerData? data;
};

// Interface to the AssistantAlarmTimerController which is owned by the
// AssistantController. Currently used by the Assistant service to notify Ash
// of changes to the underlying alarm/timer state in LibAssistant.
interface AssistantAlarmTimerController {
  // Invoked when a timer has started sounding.
  OnTimerSoundingStarted();

  // Invoked when a timer has finished sounding.
  OnTimerSoundingFinished();

  // Invoked when an alarm/timer state changed. No alarm/timer is ringing if
  // |event| is nullptr.
  OnAlarmTimerStateChanged(AssistantAlarmTimerEvent? event);
};

// Interface to the AssistantNotificationController which is owned by the
// AssistantController. Currently used by the Assistant service to modify
// Assistant notification state in Ash in response to LibAssistant events.
interface AssistantNotificationController {
  // Requests that the specified |notification| be added or updated. If the
  // |client_id| for |notification| matches that of an existing notification,
  // an update will occur. Otherwise, a new notification will be added.
  AddOrUpdateNotification(
    chromeos.assistant.mojom.AssistantNotification notification);

  // Requests that the notification uniquely identified by |id| be removed. If
  // |from_server| is true the request to remove was initiated by the server.
  RemoveNotificationById(string id, bool from_server);

  // Requests that all notifications associated with the given |grouping_key|
  // be removed. If |from_server| is true the request to remove was initiated
  // by the server.
  RemoveNotificationByGroupingKey(string grouping_key, bool from_server);

  // Requests that all notifications be removed. If |from_server| is true the
  // request was initiated by the server.
  RemoveAllNotifications(bool from_server);

  // Changes the quiet mode state in the message center.
  SetQuietMode(bool enabled);
};

// Interface to the AssistantScreenContextController which is owned by the
// AssistantController. Currently used by the Assistant service to request
// screenshots.
interface AssistantScreenContextController {
  // Requests a screenshot of the region enclosed by |rect| and returns the
  // screenshot encoded in JPEG format. If |rect| is empty, it returns a
  // fullscreen screenshot.
  RequestScreenshot(gfx.mojom.Rect rect) => (array<uint8> screenshot);
};