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 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197
|
// Copyright 2018 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
module downloads.mojom;
import "mojo/public/mojom/base/string16.mojom";
import "url/mojom/url.mojom";
// This is a subset of download::DownloadDangerType.
enum DangerType {
// This is the catch-all value for DownloadDangerTypes that are not relevant
// to the UI.
kNoApplicableDangerType,
kDangerousFile,
kDangerousUrl,
kDangerousContent,
kCookieTheft,
kUncommonContent,
kDangerousHost,
kPotentiallyUnwanted,
kAsyncScanning,
kAsyncLocalPasswordScanning,
kBlockedPasswordProtected,
kBlockedTooLarge,
kSensitiveContentWarning,
kSensitiveContentBlock,
kDeepScannedFailed,
kDeepScannedSafe,
kDeepScannedOpenedDangerous,
kBlockedScanFailed,
};
// This corresponds to DownloadUIModel::TailoredWarningType.
enum TailoredWarningType {
kNoApplicableTailoredWarningType,
kCookieTheft,
kSuspiciousArchive,
};
// Represents the state of a download in the UI.
enum State {
kInProgress,
kCancelled,
kComplete,
kPaused,
kDangerous,
kInterrupted,
kInsecure,
// See download::DownloadDangerType for more details on the scanning States.
kAsyncScanning,
kPromptForScanning,
kPromptForLocalPasswordScanning,
};
// This corresponds to safe_browsing::SafeBrowsingState.
enum SafeBrowsingState {
kNoSafeBrowsing,
kStandardProtection,
kEnhancedProtection,
};
// This is the information associated with a download used for rendering in the
// UI.
struct Data {
bool file_externally_removed;
bool is_dangerous;
[RenamedFrom=is_mixed_content]
bool is_insecure;
bool is_reviewable;
// |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;
int64 total;
string by_ext_id;
string by_ext_name;
DangerType danger_type;
TailoredWarningType tailored_warning_type;
string date_string;
string file_name;
string file_path;
string file_url;
string id;
string last_reason_text;
string progress_status_text;
string show_in_folder_text;
string since_string;
// |state| indicates the current state of the download. A download data entry
// can be dangerous or insecure 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.
State state;
// The referrer URL of the download item. Present if this field is populated
// with the referrer URL. Omitted if the URL is unknown.
url.mojom.Url? referrer_url;
// The display string for the referrer URL in the UI. May be truncated/elided
// from the original URL, and IDN domains may be converted to Unicode.
mojo_base.mojom.String16 display_referrer_url;
// The URL of the download item. Present if this field is populated with the
// original URL. Omitted if the URL should not be clickable on the downloads
// page, due to URL size limits requiring truncation.
url.mojom.Url? url;
// The display string for the URL in the UI. May be truncated/elided from the
// original URL, and IDN domains may be converted to Unicode.
mojo_base.mojom.String16 display_url;
// Safe Browsing protection level of the profile in which the item was
// downloaded. Used to determine whether to show a special warning message.
SafeBrowsingState safe_browsing_state;
// Whether the download had a Safe Browsing verdict. This is used to determine
// whether to call a file type warning "suspicious" or "unverified".
bool has_safe_browsing_verdict;
};
// The parameter "id" is the id of the current download
interface PageHandlerFactory {
CreatePageHandler(pending_remote<Page> page,
pending_receiver<PageHandler> handler);
};
// TODO(crbug.com/351865738): Consider combining methods that take an id
// into their own stateless interface.
interface PageHandler {
GetDownloads(array<string> search_terms);
OpenFileRequiringGesture(string id);
Drag(string id);
// Called when "Download suspicious file" is clicked from the
// chrome://downloads overflow menu, for suspicious/unverified files. Does not
// show a prompt.
SaveSuspiciousRequiringGesture(string id);
// Called when "Download dangerous file" is clicked from the
// chrome://downloads overflow menu to open the warning bypass dialog, for
// dangerous files. Only records the opening of the warning bypass dialog.
RecordOpenBypassWarningDialog(string id);
// Called when "Download dangerous file" is clicked from the
// chrome://downloads warning dialog, for dangerous files.
SaveDangerousFromDialogRequiringGesture(string id);
// Called when "Cancel" is clicked on the chrome://downloads warning bypass
// dialog, or the dialog is closed by dismissing it. Only records the event
// and potentially sends a report.
RecordCancelBypassWarningDialog(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();
// The two methods below are for the ESB Download Row Promo.
// Opens the chrome://settings/security page with a IPH Promotion
// on the ESB radio button.
OpenEsbSettings();
// Logs when the user actually sees the ESB Download Row Promo.
LogEsbPromotionRowViewed();
// 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);
// Opens a review dialog for the download with the given |id| after it has
// received a warning deep scanning verdict. This requires a user gesture on
// the WebUI.
ReviewDangerousRequiringGesture(string id);
// Performs deep scan for the download with the given |id|.
DeepScan(string id);
// Bypass deep scan for download with the given |id|. This requires a user
// gesture on the WebUI.
BypassDeepScanRequiringGesture(string id);
// Checks whether an ESB Promotion can be shown on this profile.
IsEligibleForEsbPromo() => (bool result);
};
interface Page {
RemoveItem(int32 index);
UpdateItem(int32 index, Data data);
InsertItems(int32 index, array<Data> items);
ClearAll();
};
|