| // 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 downloads.mojom; |
| |
| // This is the information associated with a download used for rendering in the |
| // UI. |
| struct Data { |
| bool file_externally_removed; |
| bool is_dangerous; |
| bool is_mixed_content; |
| // |otr| stands for off-the-record and is true when a download entry is |
| // created during an incognito or guest profile session. |
| bool otr; |
| bool resume; |
| bool retry; |
| int32 percent; |
| int32 started; |
| int32 total; |
| string by_ext_id; |
| string by_ext_name; |
| string danger_type; |
| string date_string; |
| string file_name; |
| string file_path; |
| string file_url; |
| string id; |
| string last_reason_text; |
| string progress_status_text; |
| string since_string; |
| // |state| indicates the current state of the download. A download data entry |
| // can be dangerous or mixed content which can be expressed as a state to |
| // indicate the download needs confirmation before initiating. After |
| // confirmation, the state will indicate the download is in progress, complete |
| // or cancelled. |
| string state; |
| string url; |
| }; |
| |
| interface PageHandlerFactory { |
| CreatePageHandler(pending_remote<Page> page, |
| pending_receiver<PageHandler> handler); |
| }; |
| |
| interface PageHandler { |
| GetDownloads(array<string> search_terms); |
| OpenFileRequiringGesture(string id); |
| Drag(string id); |
| SaveDangerousRequiringGesture(string id); |
| DiscardDangerous(string id); |
| RetryDownload(string id); |
| Show(string id); |
| Pause(string id); |
| Resume(string id); |
| Remove(string id); |
| Undo(); |
| Cancel(string id); |
| ClearAll(); |
| OpenDownloadsFolderRequiringGesture(); |
| |
| // Opens this download with the given |id| while it is being scanned by Safe |
| // Browsing. This completes the scan early. This requires a user gesture on |
| // the WebUI. |
| OpenDuringScanningRequiringGesture(string id); |
| }; |
| |
| interface Page { |
| RemoveItem(int32 index); |
| UpdateItem(int32 index, Data data); |
| InsertItems(int32 index, array<Data> items); |
| ClearAll(); |
| }; |