| // Copyright 2019 The Chromium Authors |
| // Use of this source code is governed by a BSD-style license that can be |
| // found in the LICENSE file. |
| |
| module content_capture.mojom; |
| |
| import "components/content_capture/common/content_capture_data.mojom"; |
| |
| // This interface helps extract the data of the current page from the |
| // renderer, each ContentCaptureData represents the on-screen text |
| // content. The interface has one instance per RenderFrameHost in the |
| // browser process. All methods are called by renderer. |
| interface ContentCaptureReceiver { |
| // Invoked to notify that a batch of Content Capture has completed. |
| // Usually called immediately after all callings to DidCaptureContent, |
| // DidUpdateContent and DidRemoveContent within a frame update. |
| // This notifies the downstream recipient the end of a batch content capture |
| // events, usually correspond to a frame update. The downstream may leverage |
| // signal as the opportunity to start processing the previously received |
| // events. |
| // The example calling sequence is shown below: |
| // browser -> renderer: ContentCaptureSender::StartCapture |
| // browser <- renderer: ContentCaptureReceiver::DidCaptureContent |
| // browser <- renderer: ContentCaptureReceiver::DidUpdateContent |
| // browser <- renderer: ContentCaptureReceiver::DidUpdateContent |
| // ... |
| // browser <- renderer: ContentCaptureReceiver::DidRemoveContent |
| // ... (these 3 callbacks are randomly called case by case) |
| // browser <- renderer: ContentCaptureReceiver::DidCompleteBatchCaptureContent |
| // browser -> renderer: ContentCaptureSender::StopCapture |
| DidCompleteBatchCaptureContent(); |
| |
| // Invoked when the |data| is captured, |first_data| indicates if |
| // this is first data from the document. |
| DidCaptureContent(ContentCaptureData data, bool first_data); |
| |
| // Invoked to notify that the |data| which has already been captured is |
| // updated, if |data| hasn't previously been captured, it will simply be |
| // ignored. |
| DidUpdateContent(ContentCaptureData data); |
| |
| // Invoked to notify that a list of content |ids| has been removed. |
| DidRemoveContent(array<int64> ids); |
| }; |
| |
| // This interface has one instance per RenderFrame in renderer process. |
| interface ContentCaptureSender { |
| // Invoked to start/stop ContentCapture, it is stopped by default. |
| StartCapture(); |
| StopCapture(); |
| }; |