Commit 374f4b52 authored by Brandon Wylie's avatar Brandon Wylie Committed by Commit Bot

Adding content capture observer and abstract clearing methods

* Adding abstract methods to ContentCaptureController for data clearing.
* Adding observer for content capture.
* Hooking up the observer to the HistoryDeletionBridge.

Bug: 954404
Change-Id: I80ef890d619914d3b4f9f7fe50fc192ac5f9a10d
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1623529
Commit-Queue: Brandon Wylie <wylieb@chromium.org>
Reviewed-by: default avatarTao Bai <michaelbai@chromium.org>
Reviewed-by: default avatarTed Choc <tedchoc@chromium.org>
Cr-Commit-Position: refs/heads/master@{#663966}
parent 3876bf6f
......@@ -292,6 +292,7 @@ chrome_java_sources = [
"java/src/org/chromium/chrome/browser/contacts_picker/PickerCategoryView.java",
"java/src/org/chromium/chrome/browser/contacts_picker/TopView.java",
"java/src/org/chromium/chrome/browser/content/ContentUtils.java",
"java/src/org/chromium/chrome/browser/content_capture/ContentCaptureHistoryDeletionObserver.java",
"java/src/org/chromium/chrome/browser/contextmenu/ChromeContextMenuItem.java",
"java/src/org/chromium/chrome/browser/contextmenu/ChromeContextMenuPopulator.java",
"java/src/org/chromium/chrome/browser/contextmenu/ContextMenuHelper.java",
......
// Copyright 2019 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.
package org.chromium.chrome.browser.content_capture;
import org.chromium.chrome.browser.history.HistoryDeletionBridge;
import org.chromium.chrome.browser.history.HistoryDeletionInfo;
import org.chromium.components.content_capture.ContentCaptureController;
/** History deletion observer that calls ContentCapture methods. */
public class ContentCaptureHistoryDeletionObserver implements HistoryDeletionBridge.Observer {
/** Observer method when a bit of history is deleted. */
@Override
public void onURLsDeleted(HistoryDeletionInfo historyDeletionInfo) {
ContentCaptureController contentCaptureController = ContentCaptureController.getInstance();
if (contentCaptureController == null) return;
if (historyDeletionInfo.isTimeRangeForAllTime()
|| (historyDeletionInfo.isTimeRangeValid()
&& historyDeletionInfo.getTimeRangeBegin()
!= historyDeletionInfo.getTimeRangeEnd())) {
contentCaptureController.clearAllContentCaptureData();
} else {
contentCaptureController.clearContentCaptureDataForURLs(
historyDeletionInfo.getDeletedURLs());
}
}
}
tedchoc@chromium.org
wylieb@chomium.org
file://components/content_capture/OWNERS
......@@ -44,11 +44,13 @@ import org.chromium.chrome.browser.DevToolsServer;
import org.chromium.chrome.browser.banners.AppBannerManager;
import org.chromium.chrome.browser.bookmarkswidget.BookmarkWidgetProvider;
import org.chromium.chrome.browser.contacts_picker.ContactsPickerDialog;
import org.chromium.chrome.browser.content_capture.ContentCaptureHistoryDeletionObserver;
import org.chromium.chrome.browser.crash.LogcatExtractionRunnable;
import org.chromium.chrome.browser.crash.MinidumpUploadService;
import org.chromium.chrome.browser.download.DownloadController;
import org.chromium.chrome.browser.download.DownloadManagerService;
import org.chromium.chrome.browser.firstrun.ForcedSigninProcessor;
import org.chromium.chrome.browser.history.HistoryDeletionBridge;
import org.chromium.chrome.browser.identity.UniqueIdentificationGeneratorFactory;
import org.chromium.chrome.browser.identity.UuidBasedUniqueIdentificationGenerator;
import org.chromium.chrome.browser.incognito.IncognitoTabLauncher;
......@@ -265,6 +267,8 @@ public class ProcessInitializationHandler {
});
SearchWidgetProvider.initialize();
HistoryDeletionBridge.getInstance().addObserver(
new ContentCaptureHistoryDeletionObserver());
}
/**
......
......@@ -33,6 +33,16 @@ public abstract class ContentCaptureController {
*/
public abstract boolean shouldStartCapture();
/**
* Clear all ContentCapture data associated with Chrome.
*/
public void clearAllContentCaptureData() {}
/**
* Clear ContentCapture data for specific URLs.
*/
public void clearContentCaptureDataForURLs(String[] urlsToDelete) {}
/**
* Invoked by native side to pull the whitelist, the subclass should implement this and set
* the whitelist by call setWhiteList.
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment