123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150 |
- // Copyright 2021 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 crosapi.mojom;
- import "mojo/public/mojom/base/file_path.mojom";
- import "mojo/public/mojom/base/time.mojom";
- // This mirrors `download::DownloadItem::DownloadState`, anything added or
- // removed here must also be added or removed there.
- [Stable, Extensible]
- enum DownloadState {
- [Default] kUnknown = 0,
- kInProgress,
- kComplete,
- kCancelled,
- kInterrupted
- };
- // This mirrors `download::DownloadDangerType`, anything added or removed here
- // must also be added or removed there.
- [Stable, Extensible]
- enum DownloadDangerType {
- [Default] kDownloadDangerTypeInvalid = -1,
- kDownloadDangerTypeNotDangerous = 0,
- kDownloadDangerTypeDangerousFile = 1,
- kDownloadDangerTypeDangerousUrl = 2,
- kDownloadDangerTypeDangerousContent = 3,
- kDownloadDangerTypeMaybeDangerousContent = 4,
- kDownloadDangerTypeUncommonContent = 5,
- kDownloadDangerTypeUserValidated = 6,
- kDownloadDangerTypeDangerousHost = 7,
- kDownloadDangerTypePotentiallyUnwanted = 8,
- kDownloadDangerTypeAllowlistedByPolicy = 9,
- kDownloadDangerTypeAsyncScanning = 10,
- kDownloadDangerTypeBlockedPasswordProtected = 11,
- kDownloadDangerTypeBlockedTooLarge = 12,
- kDownloadDangerTypeSensitiveContentWarning = 13,
- kDownloadDangerTypeSensitiveContentBlock = 14,
- kDownloadDangerTypeDeepScannedSafe = 15,
- kDownloadDangerTypeDeepScannedOpenedDangerous = 16,
- kDownloadDangerTypePromptForScanning = 17,
- kDownloadDangerTypeBlockedUnsupportedFiletype = 18,
- kDownloadDangerTypeDangerousAccountCompromise = 19,
- };
- // This mirrors `download::DownloadItem::MixedContentStatus`, anything added or
- // removed here must also be added or removed there.
- [Stable, Extensible]
- enum DownloadMixedContentStatus {
- [Default] kInvalid = -1,
- kUnknown = 0,
- kSafe = 1,
- kValidated = 2,
- kWarn = 3,
- kBlock = 4,
- kSilentBlock = 5,
- };
- // This mirrors `download::DownloadItem`. See:
- // https://source.chromium.org/chromium/chromium/src/+/main:components/download/public/common/download_item.h?q=download_item.h
- //
- // NOTE: Starting in Version 1, `has_field` is added for every new
- // non-nullable `field`. This is for backwards compatibility, so that older
- // clients know when values are present or are absent by default.
- //
- // Next MinVersion: 5
- // Next ID: 20
- [Stable, RenamedFrom="crosapi.mojom.DownloadEvent"]
- struct DownloadItem {
- DownloadState state@0;
- mojo_base.mojom.FilePath target_file_path@1;
- bool is_from_incognito_profile@2;
- [MinVersion=1] string? guid@3;
- [MinVersion=1] mojo_base.mojom.FilePath? full_path@4;
- [MinVersion=1] bool has_is_paused@5;
- [MinVersion=1] bool is_paused@6;
- [MinVersion=1] bool has_open_when_complete@7;
- [MinVersion=1] bool open_when_complete@8;
- [MinVersion=1] bool has_received_bytes@9;
- [MinVersion=1] int64 received_bytes@10;
- [MinVersion=1] bool has_total_bytes@11;
- [MinVersion=1] int64 total_bytes@12;
- [MinVersion=2] mojo_base.mojom.Time? start_time@13;
- [MinVersion=3] bool has_is_dangerous@14;
- [MinVersion=3] bool is_dangerous@15;
- [MinVersion=3] bool has_is_mixed_content@16;
- [MinVersion=3] bool is_mixed_content@17;
- [MinVersion=4] DownloadDangerType danger_type@18;
- [MinVersion=4] DownloadMixedContentStatus mixed_content_status@19;
- };
- // A client implemented in lacros-chrome for the DownloadController which is
- // implemented in ash-chrome.
- //
- // Next MinVersion: 2
- // Next ID: 6
- [Stable, Uuid="eccf720b-538a-4943-a6fd-d073639c4140"]
- interface DownloadControllerClient {
- // Returns all downloads, no matter the type or state, sorted chronologically
- // by start time. This method will ultimately invoke
- // `download::SimpleDownloadManager::GetAllDownloads()`.
- [MinVersion=1] GetAllDownloads@5() => (array<DownloadItem> downloads);
- // Pauses the download associated with the specified `download_guid`. This
- // method will ultimately invoke `download::DownloadItem::Pause()`.
- Pause@1(string download_guid);
- // Resumes the download associated with the specified `download_guid`. If
- // `user_resume` is set to `true`, it signifies that this invocation was
- // triggered by an explicit user action. This method will ultimately invoke
- // `download::DownloadItem::Resume()`.
- Resume@2(string download_guid, bool user_resume);
- // Cancels the download associated with the specified `download_guid`. If
- // `user_cancel` is set to `true`, it signifies that this invocation was
- // triggered by an explicit user action. This method will ultimately invoke
- // `download::DownloadItem::Cancel()`.
- Cancel@3(string download_guid, bool user_cancel);
- // Marks the download associated with the specified `download_guid` to be
- // `open_when_complete`. This method will ultimately invoke
- // `download::DownloadItem::SetOpenWhenComplete()`.
- SetOpenWhenComplete@4(string download_guid, bool open_when_complete);
- };
- // Allows lacros to pass download information to ash-chrome.
- // Implemented in ash-chrome.
- //
- // Next MinVersion: 2
- // Next ID: 4
- [Stable, Uuid="c3d8bd4b-1fc9-4529-aeb2-76770b0ad1c3"]
- interface DownloadController {
- // Binds the DownloadControllerClient interface, which allows the
- // DownloadController implemented in ash-chrome to communicate with its client
- // which is implemented in lacros-chrome.
- [MinVersion=1] BindClient@3(
- pending_remote<DownloadControllerClient> client);
- // Called when a download is created. Comes from `content::DownloadManager`,
- // and will only pass events once that's initialized.
- OnDownloadCreated@0(crosapi.mojom.DownloadItem download);
- // Called whenever a `download::DownloadItem` is updated.
- OnDownloadUpdated@1(crosapi.mojom.DownloadItem download);
- // Called when a `download::DownloadItem` is destroyed.
- OnDownloadDestroyed@2(crosapi.mojom.DownloadItem download);
- };
|