1// Copyright 2018 The Chromium Authors. All rights reserved.
2// Use of this source code is governed by a BSD-style license that can be
3// found in the LICENSE file.
4
5module downloads.mojom;
6
7struct Data {
8  bool file_externally_removed;
9  bool otr;
10  bool resume;
11  bool retry;
12  int32 percent;
13  int32 started;
14  int32 total;
15  string by_ext_id;
16  string by_ext_name;
17  string danger_type;
18  string date_string;
19  string file_name;
20  string file_path;
21  string file_url;
22  string id;
23  string last_reason_text;
24  string progress_status_text;
25  string since_string;
26  string state;
27  string url;
28};
29
30interface PageHandlerFactory {
31  CreatePageHandler(pending_remote<Page> page,
32                    pending_receiver<PageHandler> handler);
33};
34
35interface PageHandler {
36  GetDownloads(array<string> search_terms);
37  OpenFileRequiringGesture(string id);
38  Drag(string id);
39  SaveDangerousRequiringGesture(string id);
40  DiscardDangerous(string id);
41  RetryDownload(string id);
42  Show(string id);
43  Pause(string id);
44  Resume(string id);
45  Remove(string id);
46  Undo();
47  Cancel(string id);
48  ClearAll();
49  OpenDownloadsFolderRequiringGesture();
50
51  // Opens this download with the given |id| while it is being scanned by Safe
52  // Browsing. This completes the scan early. This requires a user gesture on
53  // the WebUI.
54  OpenDuringScanningRequiringGesture(string id);
55};
56
57interface Page {
58  RemoveItem(int32 index);
59  UpdateItem(int32 index, Data data);
60  InsertItems(int32 index, array<Data> items);
61  ClearAll();
62};
63