summaryrefslogtreecommitdiff
path: root/chromium/components/content_capture
diff options
context:
space:
mode:
Diffstat (limited to 'chromium/components/content_capture')
-rw-r--r--chromium/components/content_capture/android/java/src/org/chromium/components/content_capture/ContentCaptureConsumer.java62
-rw-r--r--chromium/components/content_capture/android/java/src/org/chromium/components/content_capture/ContentCaptureConsumerImpl.java102
-rw-r--r--chromium/components/content_capture/android/java/src/org/chromium/components/content_capture/ContentCaptureController.java84
-rw-r--r--chromium/components/content_capture/android/java/src/org/chromium/components/content_capture/ContentCaptureControllerImpl.java122
-rw-r--r--chromium/components/content_capture/android/java/src/org/chromium/components/content_capture/ContentCaptureData.java86
-rw-r--r--chromium/components/content_capture/android/java/src/org/chromium/components/content_capture/ContentCaptureFeatures.java32
-rw-r--r--chromium/components/content_capture/android/java/src/org/chromium/components/content_capture/ContentCaptureReceiverManager.java111
-rw-r--r--chromium/components/content_capture/android/java/src/org/chromium/components/content_capture/ContentCapturedTask.java25
-rw-r--r--chromium/components/content_capture/android/java/src/org/chromium/components/content_capture/ContentRemovedTask.java34
-rw-r--r--chromium/components/content_capture/android/java/src/org/chromium/components/content_capture/ContentUpdateTask.java34
-rw-r--r--chromium/components/content_capture/android/java/src/org/chromium/components/content_capture/ExperimentContentCaptureConsumer.java48
-rw-r--r--chromium/components/content_capture/android/java/src/org/chromium/components/content_capture/FrameSession.java20
-rw-r--r--chromium/components/content_capture/android/java/src/org/chromium/components/content_capture/NotificationTask.java94
-rw-r--r--chromium/components/content_capture/android/java/src/org/chromium/components/content_capture/PlatformSession.java89
-rw-r--r--chromium/components/content_capture/android/java/src/org/chromium/components/content_capture/ProcessContentCaptureDataTask.java74
-rw-r--r--chromium/components/content_capture/android/java/src/org/chromium/components/content_capture/SessionRemovedTask.java42
-rw-r--r--chromium/components/content_capture/browser/content_capture_receiver_test.cc3
-rw-r--r--chromium/components/content_capture/common/BUILD.gn18
-rw-r--r--chromium/components/content_capture/common/OWNERS2
-rw-r--r--chromium/components/content_capture/common/content_capture.typemap20
-rw-r--r--chromium/components/content_capture/common/content_capture_features.cc2
-rw-r--r--chromium/components/content_capture/common/content_capture_mojom_traits.h2
22 files changed, 21 insertions, 1085 deletions
diff --git a/chromium/components/content_capture/android/java/src/org/chromium/components/content_capture/ContentCaptureConsumer.java b/chromium/components/content_capture/android/java/src/org/chromium/components/content_capture/ContentCaptureConsumer.java
deleted file mode 100644
index 5a8f9e096fc..00000000000
--- a/chromium/components/content_capture/android/java/src/org/chromium/components/content_capture/ContentCaptureConsumer.java
+++ /dev/null
@@ -1,62 +0,0 @@
-// 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.components.content_capture;
-
-import org.chromium.content_public.browser.WebContents;
-
-/**
- * This abstract class is for consumer to consume the captured content. This object is used by
- * multiple objects and typically released by the last RFH in the WebContents.
- */
-public abstract class ContentCaptureConsumer {
- private ContentCaptureReceiverManager mManager;
- public ContentCaptureConsumer(WebContents webContents) {
- onWebContentsChanged(webContents);
- }
-
- /**
- * Invoked when the content is captured from a frame.
- * @param parentFrame is the parent of the frame from that the content captured.
- * @param contentCaptureData is the captured content tree, its root is the frame.
- */
- public abstract void onContentCaptured(
- FrameSession parentFrame, ContentCaptureData contentCaptureData);
-
- /**
- * Invoked when the content is updated in a frame.
- * @param parentFrame is the parent of the frame from that the content captured.
- * @param contentCaptureData is the captured content tree, its root is the frame.
- */
- public void onContentUpdated(FrameSession parentFrame, ContentCaptureData contentCaptureData) {}
-
- /**
- * Invoked when the session is removed
- * @param session is the removed frame.
- */
- public abstract void onSessionRemoved(FrameSession session);
-
- /**
- * Invoked when the content is removed from a frame
- * @param session defines the frame from that the content removed
- * @param removedIds are array of removed content id.
- */
- public abstract void onContentRemoved(FrameSession session, long[] removedIds);
-
- public void onWebContentsChanged(WebContents current) {
- if (!ContentCaptureFeatures.isEnabled()) return;
- // Not reset previous mManager's ContentCaptureConsumer, because it will be used to notify
- // of the removal of session.
- if (current != null) {
- mManager = ContentCaptureReceiverManager.createOrGet(current);
- mManager.addContentCaptureConsumer(this);
- } else {
- mManager = null;
- }
- }
-
- protected boolean shouldCapture(String[] urls) {
- return true;
- }
-}
diff --git a/chromium/components/content_capture/android/java/src/org/chromium/components/content_capture/ContentCaptureConsumerImpl.java b/chromium/components/content_capture/android/java/src/org/chromium/components/content_capture/ContentCaptureConsumerImpl.java
deleted file mode 100644
index 9f897464e00..00000000000
--- a/chromium/components/content_capture/android/java/src/org/chromium/components/content_capture/ContentCaptureConsumerImpl.java
+++ /dev/null
@@ -1,102 +0,0 @@
-// 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.components.content_capture;
-
-import android.annotation.TargetApi;
-import android.content.Context;
-import android.os.Build;
-import android.view.View;
-import android.view.ViewStructure;
-
-import org.chromium.base.annotations.VerifiesOnQ;
-import org.chromium.base.task.AsyncTask;
-import org.chromium.content_public.browser.WebContents;
-
-/**
- * This class receive captured content and send it to framework in non-UI
- * thread.
- */
-@VerifiesOnQ
-@TargetApi(Build.VERSION_CODES.Q)
-public class ContentCaptureConsumerImpl extends ContentCaptureConsumer {
- private PlatformSession mPlatformSession;
- private final View mView;
-
- /**
- * This method is used when ViewStructure is available.
- *
- * @Return ContentCaptureConsumer or null if ContentCapture service isn't
- * available, disabled or isn't AiAi service.
- */
- public static ContentCaptureConsumer create(
- Context context, View view, ViewStructure structure, WebContents webContents) {
- if (ContentCaptureController.getInstance() == null) {
- ContentCaptureControllerImpl.init(context.getApplicationContext());
- }
-
- if (!ContentCaptureController.getInstance().shouldStartCapture()) return null;
- return new ContentCaptureConsumerImpl(view, structure, webContents);
- }
-
- /**
- * This method is used when ViewStructure isn't available and needs to be
- * created.
- */
- public static ContentCaptureConsumer create(
- Context context, View view, WebContents webContents) {
- return create(context, view, null, webContents);
- }
-
- private ContentCaptureConsumerImpl(
- View view, ViewStructure viewStructure, WebContents webContents) {
- super(webContents);
- mView = view;
- if (viewStructure != null) {
- mPlatformSession = new PlatformSession(
- view.getContentCaptureSession(), viewStructure.getAutofillId());
- }
- }
-
- @Override
- public void onContentCaptured(FrameSession parentFrame, ContentCaptureData contentCaptureData) {
- if (mPlatformSession == null) {
- mPlatformSession = PlatformSession.fromView(mView);
- if (mPlatformSession == null) return;
- }
- new ContentCapturedTask(parentFrame, contentCaptureData, mPlatformSession)
- .executeOnExecutor(AsyncTask.SERIAL_EXECUTOR);
- }
-
- @Override
- public void onContentUpdated(FrameSession parentFrame, ContentCaptureData contentCaptureData) {
- if (mPlatformSession == null) return;
- new ContentUpdateTask(parentFrame, contentCaptureData, mPlatformSession)
- .executeOnExecutor(AsyncTask.SERIAL_EXECUTOR);
- }
-
- @Override
- public void onSessionRemoved(FrameSession frame) {
- if (frame.isEmpty() || mPlatformSession == null) return;
- new SessionRemovedTask(frame, mPlatformSession)
- .executeOnExecutor(AsyncTask.SERIAL_EXECUTOR);
- }
-
- @Override
- public void onContentRemoved(FrameSession frame, long[] removedIds) {
- if (frame.isEmpty() || mPlatformSession == null) return;
- new ContentRemovedTask(frame, removedIds, mPlatformSession)
- .executeOnExecutor(AsyncTask.SERIAL_EXECUTOR);
- }
-
- @Override
- protected boolean shouldCapture(String[] urls) {
- // No need to check if the experiment is disabled, because it was done when the navigation
- // committed, refer to ContentCaptureReceiverManager::ReadyToCommitNavigation().
- if (!ContentCaptureFeatures.shouldTriggerContentCaptureForExperiment()) return true;
- ContentCaptureController controller = ContentCaptureController.getInstance();
- if (controller == null) return false;
- return controller.shouldCapture(urls);
- }
-}
diff --git a/chromium/components/content_capture/android/java/src/org/chromium/components/content_capture/ContentCaptureController.java b/chromium/components/content_capture/android/java/src/org/chromium/components/content_capture/ContentCaptureController.java
deleted file mode 100644
index 93259117971..00000000000
--- a/chromium/components/content_capture/android/java/src/org/chromium/components/content_capture/ContentCaptureController.java
+++ /dev/null
@@ -1,84 +0,0 @@
-// 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.components.content_capture;
-
-import org.chromium.base.annotations.CalledByNative;
-import org.chromium.base.annotations.JNINamespace;
-import org.chromium.base.annotations.NativeMethods;
-
-/**
- * The abstract class to provide the allowlist and the runtime control of if ContentCapture should
- * start.
- */
-@JNINamespace("content_capture")
-public abstract class ContentCaptureController {
- /**
- * The singleton instance of ContentCaptureController, shall be set by subclass.
- */
- protected static ContentCaptureController sContentCaptureController;
-
- private long mNativeContentCaptureController;
-
- public static ContentCaptureController getInstance() {
- return sContentCaptureController;
- }
-
- protected ContentCaptureController() {
- mNativeContentCaptureController = ContentCaptureControllerJni.get().init(this);
- }
-
- /**
- * @return if ContentCapture should be started for this app at all.
- */
- 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) {}
-
- /**
- * @param urls the urls need to check.
- * @return if the content of all urls should be captured.
- */
- public boolean shouldCapture(String[] urls) {
- return ContentCaptureControllerJni.get().shouldCapture(
- mNativeContentCaptureController, ContentCaptureController.this, urls);
- }
-
- /**
- * Invoked by native side to pull the allowlist, the subclass should implement this and set
- * the allowlist by call setAllowlist.
- */
- @CalledByNative
- protected abstract void pullAllowlist();
-
- /**
- * Invoked by subclass to set the allowlist to native side. No allowlist (allowlist == null)
- * indicates everything is allowed, empty allowlist (allowlist.length == 0) indicates
- * nothing is allowed.
- *
- * @param allowlist the array of allowlist, it could be the hostname or the regex.
- * @param isRegex to indicate that the corresponding allowlist is the regex or not.
- */
- protected void setAllowlist(String[] allowlist, boolean[] isRegex) {
- ContentCaptureControllerJni.get().setAllowlist(
- mNativeContentCaptureController, ContentCaptureController.this, allowlist, isRegex);
- }
-
- @NativeMethods
- interface Natives {
- long init(Object contentCaptureController);
- void setAllowlist(long nativeContentCaptureController, ContentCaptureController caller,
- String[] allowlist, boolean[] isRegex);
- boolean shouldCapture(long nativeContentCaptureController, ContentCaptureController caller,
- String[] urls);
- }
-}
diff --git a/chromium/components/content_capture/android/java/src/org/chromium/components/content_capture/ContentCaptureControllerImpl.java b/chromium/components/content_capture/android/java/src/org/chromium/components/content_capture/ContentCaptureControllerImpl.java
deleted file mode 100644
index fad4cd5d5ff..00000000000
--- a/chromium/components/content_capture/android/java/src/org/chromium/components/content_capture/ContentCaptureControllerImpl.java
+++ /dev/null
@@ -1,122 +0,0 @@
-// 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.components.content_capture;
-
-import android.annotation.TargetApi;
-import android.content.ComponentName;
-import android.content.Context;
-import android.content.LocusId;
-import android.os.Build;
-import android.view.contentcapture.ContentCaptureCondition;
-import android.view.contentcapture.ContentCaptureManager;
-import android.view.contentcapture.DataRemovalRequest;
-
-import org.chromium.base.BuildInfo;
-import org.chromium.base.Log;
-import org.chromium.base.annotations.VerifiesOnQ;
-
-import java.util.Set;
-
-/**
- * The implementation of ContentCaptureController to verify ContentCaptureService
- * is Aiai and signed by right certificate, this class also read allowlist from
- * framework and set to native side.
- */
-// TODO(crbug.com/965566): Write junit tests for this when junit supports q.
-@VerifiesOnQ
-@TargetApi(Build.VERSION_CODES.Q)
-public class ContentCaptureControllerImpl extends ContentCaptureController {
- private static final String TAG = "ContentCapture";
-
- private static final String AIAI_PACKAGE_NAME = "com.google.android.as";
-
- private boolean mShouldStartCapture;
- private ContentCaptureManager mContentCaptureManager;
-
- public static void init(Context context) {
- sContentCaptureController = new ContentCaptureControllerImpl(context);
- }
-
- public ContentCaptureControllerImpl(Context context) {
- mContentCaptureManager = context.getSystemService(ContentCaptureManager.class);
- verifyService();
- }
-
- @Override
- public boolean shouldStartCapture() {
- return mShouldStartCapture;
- }
-
- private void verifyService() {
- if (mContentCaptureManager == null) {
- log("ContentCaptureManager isn't available.");
- return;
- }
-
- ComponentName componentName = mContentCaptureManager.getServiceComponentName();
- if (componentName == null) {
- log("Service isn't available.");
- return;
- }
-
- mShouldStartCapture = AIAI_PACKAGE_NAME.equals(componentName.getPackageName());
- if (!mShouldStartCapture) {
- log("Package doesn't match, current one is "
- + mContentCaptureManager.getServiceComponentName().getPackageName());
- // Disable the ContentCapture if there is no testing flag.
- if (!BuildInfo.isDebugAndroid() && !ContentCaptureFeatures.isDumpForTestingEnabled()) {
- return;
- }
- }
-
- mShouldStartCapture = mContentCaptureManager.isContentCaptureEnabled();
- if (!mShouldStartCapture) {
- log("ContentCapture disabled.");
- }
- }
-
- @Override
- protected void pullAllowlist() {
- Set<ContentCaptureCondition> conditions =
- mContentCaptureManager.getContentCaptureConditions();
- String[] allowlist = null;
- boolean[] isRegEx = null;
- if (conditions != null) {
- allowlist = new String[conditions.size()];
- isRegEx = new boolean[conditions.size()];
- int index = 0;
- for (ContentCaptureCondition c : conditions) {
- allowlist[index] = c.getLocusId().getId();
- isRegEx[index] = (c.getFlags() & ContentCaptureCondition.FLAG_IS_REGEX) != 0;
- index++;
- }
- }
- setAllowlist(allowlist, isRegEx);
- }
-
- private void log(String msg) {
- if (!ContentCaptureFeatures.isDumpForTestingEnabled()) return;
- Log.i(TAG, msg);
- }
-
- @Override
- public void clearAllContentCaptureData() {
- if (mContentCaptureManager == null) return;
-
- mContentCaptureManager.removeData(new DataRemovalRequest.Builder().forEverything().build());
- }
-
- @Override
- public void clearContentCaptureDataForURLs(String[] urlsToDelete) {
- if (mContentCaptureManager == null) return;
-
- DataRemovalRequest.Builder builder = new DataRemovalRequest.Builder();
- for (String url : urlsToDelete) {
- builder = builder.addLocusId(
- new LocusId(url), /* Signals that we aren't using extra flags */ 0);
- }
- mContentCaptureManager.removeData(builder.build());
- }
-}
diff --git a/chromium/components/content_capture/android/java/src/org/chromium/components/content_capture/ContentCaptureData.java b/chromium/components/content_capture/android/java/src/org/chromium/components/content_capture/ContentCaptureData.java
deleted file mode 100644
index ec468261f7d..00000000000
--- a/chromium/components/content_capture/android/java/src/org/chromium/components/content_capture/ContentCaptureData.java
+++ /dev/null
@@ -1,86 +0,0 @@
-// 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.components.content_capture;
-
-import android.graphics.Rect;
-
-import androidx.annotation.VisibleForTesting;
-
-import org.chromium.base.annotations.CalledByNative;
-
-import java.util.ArrayList;
-import java.util.List;
-
-/**
- * The class is Java's representative of components/content_capture/common/content_capture_data.h
- */
-public class ContentCaptureData {
- private long mId;
- private String mValue;
- private Rect mBounds;
- private ArrayList<ContentCaptureData> mChildren;
-
- @CalledByNative
- @VisibleForTesting
- public static ContentCaptureData createContentCaptureData(
- Object parent, long id, String value, int x, int y, int width, int height) {
- ContentCaptureData data = new ContentCaptureData(id, value, x, y, width, height);
- if (parent != null) {
- ((ContentCaptureData) parent).addChild(data);
- }
- return data;
- }
-
- private ContentCaptureData(long id, String value, int x, int y, int width, int height) {
- mId = id;
- mValue = value;
- mBounds = new Rect(x, y, x + width, y + height);
- }
-
- public String getValue() {
- return mValue;
- }
-
- public Rect getBounds() {
- return mBounds;
- }
-
- public List<ContentCaptureData> getChildren() {
- return mChildren;
- }
-
- public boolean hasChildren() {
- return mChildren != null && !mChildren.isEmpty();
- }
-
- public long getId() {
- return mId;
- }
-
- private void addChild(ContentCaptureData data) {
- if (mChildren == null) mChildren = new ArrayList<ContentCaptureData>();
- mChildren.add(data);
- }
-
- @Override
- public String toString() {
- StringBuilder sb = new StringBuilder();
- sb.append("id:");
- sb.append(mId);
- sb.append(" value:");
- sb.append(mValue);
- sb.append(" bounds:");
- sb.append(mBounds);
- sb.append('\n');
- if (hasChildren()) {
- sb.append("children:");
- sb.append(mChildren.size());
- for (ContentCaptureData child : mChildren) {
- sb.append(child.toString());
- }
- }
- return sb.toString();
- }
-}
diff --git a/chromium/components/content_capture/android/java/src/org/chromium/components/content_capture/ContentCaptureFeatures.java b/chromium/components/content_capture/android/java/src/org/chromium/components/content_capture/ContentCaptureFeatures.java
deleted file mode 100644
index 1e4624a1067..00000000000
--- a/chromium/components/content_capture/android/java/src/org/chromium/components/content_capture/ContentCaptureFeatures.java
+++ /dev/null
@@ -1,32 +0,0 @@
-// 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.components.content_capture;
-
-import org.chromium.base.CommandLine;
-import org.chromium.base.annotations.NativeMethods;
-
-/**
- * The class to get if feature is enabled from native.
- */
-public class ContentCaptureFeatures {
- private static final String FLAG = "dump-captured-content-to-logcat-for-testing";
-
- public static boolean isEnabled() {
- return ContentCaptureFeaturesJni.get().isEnabled();
- }
-
- public static boolean isDumpForTestingEnabled() {
- return CommandLine.getInstance().hasSwitch(FLAG);
- }
-
- public static boolean shouldTriggerContentCaptureForExperiment() {
- return ContentCaptureFeaturesJni.get().shouldTriggerContentCaptureForExperiment();
- }
-
- @NativeMethods
- interface Natives {
- boolean isEnabled();
- boolean shouldTriggerContentCaptureForExperiment();
- }
-}
diff --git a/chromium/components/content_capture/android/java/src/org/chromium/components/content_capture/ContentCaptureReceiverManager.java b/chromium/components/content_capture/android/java/src/org/chromium/components/content_capture/ContentCaptureReceiverManager.java
deleted file mode 100644
index 045f4700b1b..00000000000
--- a/chromium/components/content_capture/android/java/src/org/chromium/components/content_capture/ContentCaptureReceiverManager.java
+++ /dev/null
@@ -1,111 +0,0 @@
-// 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.components.content_capture;
-
-import org.chromium.base.Log;
-import org.chromium.base.annotations.CalledByNative;
-import org.chromium.base.annotations.NativeMethods;
-import org.chromium.content_public.browser.WebContents;
-
-import java.util.ArrayList;
-import java.util.Arrays;
-
-/**
- * This class receives captured content from native and forwards to ContetnCaptureConsumer.
- */
-public class ContentCaptureReceiverManager {
- private static final String TAG = "ContentCapture";
- private static Boolean sDump;
-
- private ArrayList<ContentCaptureConsumer> mContentCaptureConsumers =
- new ArrayList<ContentCaptureConsumer>();
-
- public static ContentCaptureReceiverManager createOrGet(WebContents webContents) {
- return ContentCaptureReceiverManagerJni.get().createOrGet(webContents);
- }
-
- @CalledByNative
- private ContentCaptureReceiverManager() {
- if (sDump == null) sDump = ContentCaptureFeatures.isDumpForTestingEnabled();
- }
-
- public void addContentCaptureConsumer(ContentCaptureConsumer consumer) {
- mContentCaptureConsumers.add(consumer);
- }
-
- @CalledByNative
- private void didCaptureContent(Object[] session, ContentCaptureData data) {
- FrameSession frameSession = toFrameSession(session);
- String[] urls = buildUrls(frameSession, data);
- for (ContentCaptureConsumer consumer : mContentCaptureConsumers) {
- if (consumer.shouldCapture(urls)) {
- consumer.onContentCaptured(frameSession, data);
- }
- }
- if (sDump.booleanValue()) Log.i(TAG, "Captured Content: %s", data);
- }
-
- @CalledByNative
- private void didUpdateContent(Object[] session, ContentCaptureData data) {
- FrameSession frameSession = toFrameSession(session);
- String[] urls = buildUrls(frameSession, data);
- for (ContentCaptureConsumer consumer : mContentCaptureConsumers) {
- if (consumer.shouldCapture(urls)) {
- consumer.onContentUpdated(frameSession, data);
- }
- }
- if (sDump.booleanValue()) Log.i(TAG, "Updated Content: %s", data);
- }
-
- @CalledByNative
- private void didRemoveContent(Object[] session, long[] data) {
- FrameSession frameSession = toFrameSession(session);
- String[] urls = buildUrls(frameSession, null);
- for (ContentCaptureConsumer consumer : mContentCaptureConsumers) {
- if (consumer.shouldCapture(urls)) {
- consumer.onContentRemoved(frameSession, data);
- }
- }
- if (sDump.booleanValue()) {
- Log.i(TAG, "Removed Content: %s", frameSession.get(0) + " " + Arrays.toString(data));
- }
- }
-
- @CalledByNative
- private void didRemoveSession(Object[] session) {
- FrameSession frameSession = toFrameSession(session);
- String[] urls = buildUrls(frameSession, null);
- for (ContentCaptureConsumer consumer : mContentCaptureConsumers) {
- if (consumer.shouldCapture(urls)) {
- consumer.onSessionRemoved(frameSession);
- }
- }
- if (sDump.booleanValue()) Log.i(TAG, "Removed Session: %s", frameSession.get(0));
- }
-
- private FrameSession toFrameSession(Object[] session) {
- FrameSession frameSession = new FrameSession(session.length);
- for (Object s : session) frameSession.add((ContentCaptureData) s);
- return frameSession;
- }
-
- private String[] buildUrls(FrameSession session, ContentCaptureData data) {
- ArrayList<String> urls = new ArrayList<String>();
- if (session != null) {
- for (ContentCaptureData d : session) {
- urls.add(d.getValue());
- }
- }
- if (data != null) urls.add(data.getValue());
- String[] result = new String[urls.size()];
- urls.toArray(result);
- return result;
- }
-
- @NativeMethods
- interface Natives {
- ContentCaptureReceiverManager createOrGet(WebContents webContents);
- }
-}
diff --git a/chromium/components/content_capture/android/java/src/org/chromium/components/content_capture/ContentCapturedTask.java b/chromium/components/content_capture/android/java/src/org/chromium/components/content_capture/ContentCapturedTask.java
deleted file mode 100644
index 5ec5639d1c8..00000000000
--- a/chromium/components/content_capture/android/java/src/org/chromium/components/content_capture/ContentCapturedTask.java
+++ /dev/null
@@ -1,25 +0,0 @@
-// 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.components.content_capture;
-
-import android.view.autofill.AutofillId;
-
-import org.chromium.components.content_capture.PlatformSession.PlatformSessionData;
-
-/**
- * The task to notify platform of the captured content
- */
-class ContentCapturedTask extends ProcessContentCaptureDataTask {
- public ContentCapturedTask(FrameSession session, ContentCaptureData contentCaptureData,
- PlatformSession platformSession) {
- super(session, contentCaptureData, platformSession);
- }
-
- @Override
- protected AutofillId notifyPlatform(
- PlatformSessionData parentPlatformSessionData, ContentCaptureData data) {
- return notifyViewAppeared(parentPlatformSessionData, data);
- }
-}
diff --git a/chromium/components/content_capture/android/java/src/org/chromium/components/content_capture/ContentRemovedTask.java b/chromium/components/content_capture/android/java/src/org/chromium/components/content_capture/ContentRemovedTask.java
deleted file mode 100644
index e8ae11f1537..00000000000
--- a/chromium/components/content_capture/android/java/src/org/chromium/components/content_capture/ContentRemovedTask.java
+++ /dev/null
@@ -1,34 +0,0 @@
-// 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.components.content_capture;
-
-import org.chromium.components.content_capture.PlatformSession.PlatformSessionData;
-
-/**
- * The task to remove the captured content from the platform.
- */
-class ContentRemovedTask extends NotificationTask {
- private final long[] mRemovedIds;
-
- public ContentRemovedTask(
- FrameSession session, long[] removedIds, PlatformSession platformSession) {
- super(session, platformSession);
- mRemovedIds = removedIds;
- }
-
- @Override
- protected Boolean doInBackground() {
- removeContent();
- return true;
- }
-
- private void removeContent() {
- log("ContentRemovedTask.removeContent");
- PlatformSessionData platformSessionData = buildCurrentSession();
- if (platformSessionData == null) return;
- platformSessionData.contentCaptureSession.notifyViewsDisappeared(
- mPlatformSession.getRootPlatformSessionData().autofillId, mRemovedIds);
- }
-}
diff --git a/chromium/components/content_capture/android/java/src/org/chromium/components/content_capture/ContentUpdateTask.java b/chromium/components/content_capture/android/java/src/org/chromium/components/content_capture/ContentUpdateTask.java
deleted file mode 100644
index 3b4a117fa11..00000000000
--- a/chromium/components/content_capture/android/java/src/org/chromium/components/content_capture/ContentUpdateTask.java
+++ /dev/null
@@ -1,34 +0,0 @@
-// 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.components.content_capture;
-
-import android.view.autofill.AutofillId;
-
-import org.chromium.components.content_capture.PlatformSession.PlatformSessionData;
-
-/**
- * The task to update the captured content in platform.
- */
-class ContentUpdateTask extends ProcessContentCaptureDataTask {
- public ContentUpdateTask(FrameSession session, ContentCaptureData contentCaptureData,
- PlatformSession platformSession) {
- super(session, contentCaptureData, platformSession);
- }
-
- @Override
- protected AutofillId notifyPlatform(
- PlatformSessionData parentPlatformSessionData, ContentCaptureData data) {
- return notifyViewTextChanged(parentPlatformSessionData, data);
- }
-
- private AutofillId notifyViewTextChanged(
- PlatformSessionData parentPlatformSessionData, ContentCaptureData data) {
- AutofillId autofillId = parentPlatformSessionData.contentCaptureSession.newAutofillId(
- mPlatformSession.getRootPlatformSessionData().autofillId, data.getId());
- parentPlatformSessionData.contentCaptureSession.notifyViewTextChanged(
- autofillId, data.getValue());
- return autofillId;
- }
-}
diff --git a/chromium/components/content_capture/android/java/src/org/chromium/components/content_capture/ExperimentContentCaptureConsumer.java b/chromium/components/content_capture/android/java/src/org/chromium/components/content_capture/ExperimentContentCaptureConsumer.java
deleted file mode 100644
index 9823b568c53..00000000000
--- a/chromium/components/content_capture/android/java/src/org/chromium/components/content_capture/ExperimentContentCaptureConsumer.java
+++ /dev/null
@@ -1,48 +0,0 @@
-// Copyright 2020 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.components.content_capture;
-
-import org.chromium.base.Log;
-import org.chromium.content_public.browser.WebContents;
-
-/**
- * This class is used to trigger ContentCapture unconditionally for the experiment. It doesn't
- * consume any content, but is necessary to keep capturing content.
- */
-public class ExperimentContentCaptureConsumer extends ContentCaptureConsumer {
- private static final String TAG = "ContentCapture";
- private static boolean sDump;
-
- public static ContentCaptureConsumer create(WebContents webContents) {
- if (ContentCaptureFeatures.shouldTriggerContentCaptureForExperiment()) {
- return new ExperimentContentCaptureConsumer(webContents);
- }
- return null;
- }
-
- private ExperimentContentCaptureConsumer(WebContents webContents) {
- super(webContents);
- }
-
- @Override
- public void onContentCaptured(FrameSession parentFrame, ContentCaptureData contentCaptureData) {
- if (sDump) Log.d(TAG, "onContentCaptured " + contentCaptureData.toString());
- }
-
- @Override
- public void onSessionRemoved(FrameSession session) {
- if (sDump) Log.d(TAG, "onSessionRemoved");
- }
-
- @Override
- public void onContentRemoved(FrameSession session, long[] removedIds) {
- if (sDump) Log.d(TAG, "onContentRemoved");
- }
-
- @Override
- public void onContentUpdated(FrameSession parentFrame, ContentCaptureData contentCaptureData) {
- if (sDump) Log.d(TAG, "onContentUpdated");
- }
-}
diff --git a/chromium/components/content_capture/android/java/src/org/chromium/components/content_capture/FrameSession.java b/chromium/components/content_capture/android/java/src/org/chromium/components/content_capture/FrameSession.java
deleted file mode 100644
index b7597cdc0c5..00000000000
--- a/chromium/components/content_capture/android/java/src/org/chromium/components/content_capture/FrameSession.java
+++ /dev/null
@@ -1,20 +0,0 @@
-// 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.components.content_capture;
-
-import java.util.ArrayList;
-
-/**
- * This class is used to specify the frame's session by a list of Frame ContentCaptureData from the
- * interested frame to root.
- */
-public class FrameSession extends ArrayList<ContentCaptureData> {
- /**
- * @param length is reserved frame list length.
- */
- public FrameSession(int length) {
- super(length);
- }
-}
diff --git a/chromium/components/content_capture/android/java/src/org/chromium/components/content_capture/NotificationTask.java b/chromium/components/content_capture/android/java/src/org/chromium/components/content_capture/NotificationTask.java
deleted file mode 100644
index 7991e954f63..00000000000
--- a/chromium/components/content_capture/android/java/src/org/chromium/components/content_capture/NotificationTask.java
+++ /dev/null
@@ -1,94 +0,0 @@
-// 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.components.content_capture;
-
-import android.annotation.TargetApi;
-import android.content.LocusId;
-import android.graphics.Rect;
-import android.os.Build;
-import android.text.TextUtils;
-import android.view.ViewStructure;
-import android.view.autofill.AutofillId;
-import android.view.contentcapture.ContentCaptureContext;
-import android.view.contentcapture.ContentCaptureSession;
-
-import org.chromium.base.Log;
-import org.chromium.base.annotations.VerifiesOnQ;
-import org.chromium.base.task.AsyncTask;
-import org.chromium.components.content_capture.PlatformSession.PlatformSessionData;
-
-/**
- * The background task to talk to the ContentCapture Service.
- */
-@VerifiesOnQ
-@TargetApi(Build.VERSION_CODES.Q)
-abstract class NotificationTask extends AsyncTask<Boolean> {
- private static final String TAG = "ContentCapture";
- private static Boolean sDump;
-
- protected final FrameSession mSession;
- protected final PlatformSession mPlatformSession;
-
- public NotificationTask(FrameSession session, PlatformSession platformSession) {
- mSession = session;
- mPlatformSession = platformSession;
- if (sDump == null) sDump = ContentCaptureFeatures.isDumpForTestingEnabled();
- }
-
- // Build up FrameIdToPlatformSessionData map of mSession, and return the current
- // session the task should run against.
- public PlatformSessionData buildCurrentSession() {
- if (mSession == null || mSession.isEmpty()) {
- return mPlatformSession.getRootPlatformSessionData();
- }
- // Build the session from root.
- PlatformSessionData platformSessionData = mPlatformSession.getRootPlatformSessionData();
- for (int i = mSession.size() - 1; i >= 0; i--) {
- platformSessionData = createOrGetSession(platformSessionData, mSession.get(i));
- if (platformSessionData == null) break;
- }
- return platformSessionData;
- }
-
- protected AutofillId notifyViewAppeared(
- PlatformSessionData parentPlatformSessionData, ContentCaptureData data) {
- ViewStructure viewStructure =
- parentPlatformSessionData.contentCaptureSession.newVirtualViewStructure(
- parentPlatformSessionData.autofillId, data.getId());
-
- if (!data.hasChildren()) viewStructure.setText(data.getValue());
- Rect rect = data.getBounds();
- // Always set scroll as (0, 0).
- viewStructure.setDimens(rect.left, rect.top, 0, 0, rect.width(), rect.height());
- parentPlatformSessionData.contentCaptureSession.notifyViewAppeared(viewStructure);
- return viewStructure.getAutofillId();
- }
-
- public PlatformSessionData createOrGetSession(
- PlatformSessionData parentPlatformSessionData, ContentCaptureData frame) {
- PlatformSessionData platformSessionData =
- mPlatformSession.getFrameIdToPlatformSessionData().get(frame.getId());
- if (platformSessionData == null && !TextUtils.isEmpty(frame.getValue())) {
- ContentCaptureSession session =
- parentPlatformSessionData.contentCaptureSession.createContentCaptureSession(
- new ContentCaptureContext.Builder(new LocusId(frame.getValue()))
- .build());
- AutofillId autofillId = parentPlatformSessionData.contentCaptureSession.newAutofillId(
- mPlatformSession.getRootPlatformSessionData().autofillId, frame.getId());
- autofillId = notifyViewAppeared(parentPlatformSessionData, frame);
- platformSessionData = new PlatformSessionData(session, autofillId);
- mPlatformSession.getFrameIdToPlatformSessionData().put(
- frame.getId(), platformSessionData);
- }
- return platformSessionData;
- }
-
- protected void log(String message) {
- if (sDump.booleanValue()) Log.i(TAG, message);
- }
-
- @Override
- protected void onPostExecute(Boolean result) {}
-}
diff --git a/chromium/components/content_capture/android/java/src/org/chromium/components/content_capture/PlatformSession.java b/chromium/components/content_capture/android/java/src/org/chromium/components/content_capture/PlatformSession.java
deleted file mode 100644
index 295125276d3..00000000000
--- a/chromium/components/content_capture/android/java/src/org/chromium/components/content_capture/PlatformSession.java
+++ /dev/null
@@ -1,89 +0,0 @@
-// 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.components.content_capture;
-
-import android.annotation.TargetApi;
-import android.os.Build;
-import android.view.View;
-import android.view.ViewStructure;
-import android.view.autofill.AutofillId;
-import android.view.contentcapture.ContentCaptureSession;
-import android.widget.Checkable;
-
-import org.chromium.base.annotations.VerifiesOnQ;
-
-import java.util.HashMap;
-
-/**
- * The class to manage the platform session.
- */
-@VerifiesOnQ
-@TargetApi(Build.VERSION_CODES.Q)
-class PlatformSession {
- /**
- * PlatformSessionData wraps the ContentCaptureSession and its corresponding
- * AutofillId. The AutofillId should be consistent with Android Autofill's
- * AutofillId, so the service can use content capture as the heuristic for
- * autofill.
- */
- public static final class PlatformSessionData {
- public final ContentCaptureSession contentCaptureSession;
- public final AutofillId autofillId;
-
- public PlatformSessionData(ContentCaptureSession session, AutofillId id) {
- contentCaptureSession = session;
- autofillId = id;
- }
- }
-
- private PlatformSessionData mRootPlatformSessionData;
- private HashMap<Long, PlatformSessionData> mFrameIdToPlatformSessionData;
-
- public static PlatformSession fromView(View view) {
- ContentCaptureSession session = view.getContentCaptureSession();
- if (session == null) return null;
- ViewStructure structure = session.newViewStructure(view);
- AutofillId autofillId = structure.getAutofillId();
- if (autofillId == null) return null;
- // Simulate the logical in View.onProvideStructure()
- structure.setDimens(view.getLeft(), view.getTop(), 0, 0, view.getRight() - view.getLeft(),
- view.getBottom() - view.getTop());
- structure.setVisibility(view.getVisibility());
- structure.setEnabled(view.isEnabled());
- structure.setClickable(view.isClickable());
- structure.setFocusable(view.isFocusable());
- structure.setFocused(view.isFocused());
- structure.setAccessibilityFocused(view.isAccessibilityFocused());
- structure.setSelected(view.isSelected());
- structure.setActivated(view.isActivated());
- structure.setLongClickable(view.isLongClickable());
- if (view instanceof Checkable) {
- structure.setCheckable(true);
- if (((Checkable) view).isChecked()) structure.setChecked(true);
- }
- if (view.isOpaque()) structure.setOpaque(true);
- if (view.isContextClickable()) structure.setContextClickable(true);
- CharSequence className = view.getAccessibilityClassName();
- if (className != null) structure.setClassName(className.toString());
- structure.setContentDescription(view.getContentDescription());
-
- return new PlatformSession(session, autofillId);
- }
-
- public PlatformSession(ContentCaptureSession session, AutofillId id) {
- mRootPlatformSessionData = new PlatformSessionData(session, id);
- }
-
- public HashMap<Long, PlatformSessionData> getFrameIdToPlatformSessionData() {
- if (mFrameIdToPlatformSessionData == null) {
- mFrameIdToPlatformSessionData = new HashMap<Long, PlatformSessionData>();
- }
- return mFrameIdToPlatformSessionData;
- }
-
- public PlatformSessionData getRootPlatformSessionData() {
- return mRootPlatformSessionData;
- }
-}
diff --git a/chromium/components/content_capture/android/java/src/org/chromium/components/content_capture/ProcessContentCaptureDataTask.java b/chromium/components/content_capture/android/java/src/org/chromium/components/content_capture/ProcessContentCaptureDataTask.java
deleted file mode 100644
index 87ef26b0124..00000000000
--- a/chromium/components/content_capture/android/java/src/org/chromium/components/content_capture/ProcessContentCaptureDataTask.java
+++ /dev/null
@@ -1,74 +0,0 @@
-// 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.components.content_capture;
-
-import android.view.autofill.AutofillId;
-
-import org.chromium.components.content_capture.PlatformSession.PlatformSessionData;
-
-import java.util.List;
-
-/**
- * The base class to process the ContentCaptureData.
- */
-abstract class ProcessContentCaptureDataTask extends NotificationTask {
- private final ContentCaptureData mContentCaptureData;
- /**
- * @param session
- * @param contentCaptureData
- * @param platformSession
- */
- public ProcessContentCaptureDataTask(FrameSession session,
- ContentCaptureData contentCaptureData, PlatformSession platformSession) {
- super(session, platformSession);
- mContentCaptureData = contentCaptureData;
- }
-
- @Override
- protected Boolean doInBackground() {
- processContent();
- return true;
- }
-
- private void processContent() {
- log("ProcessContentTaskBase.processContent");
- PlatformSessionData platformSessionData = buildCurrentSession();
- if (platformSessionData == null) return;
- processCaptureData(platformSessionData, mContentCaptureData);
- }
-
- private boolean processCaptureData(
- PlatformSessionData parentPlatformSessionData, ContentCaptureData data) {
- if (data == null) return false;
- if (data.hasChildren()) {
- PlatformSessionData platformSessionData;
- if (data.getValue() != null) {
- // This is frame.
- platformSessionData = createOrGetSession(parentPlatformSessionData, data);
- if (platformSessionData == null) return false;
- } else {
- // This is scrollable area.
- AutofillId autofillId = notifyPlatform(parentPlatformSessionData, data);
- // To add children below scrollable area in frame, the ContentCaptureSession
- // of the scrollable area is the frame the scrollable area belong to, AutofillId
- // is scrollable area's AutofillId.
- if (autofillId == null) return false;
- platformSessionData = new PlatformSessionData(
- parentPlatformSessionData.contentCaptureSession, autofillId);
- }
- List<ContentCaptureData> children = data.getChildren();
- for (ContentCaptureData child : children) {
- if (!processCaptureData(platformSessionData, child)) return false;
- }
- return true;
- } else {
- // This is text.
- return null != notifyPlatform(parentPlatformSessionData, data);
- }
- }
-
- protected abstract AutofillId notifyPlatform(
- PlatformSessionData parentPlatformSessionData, ContentCaptureData data);
-}
diff --git a/chromium/components/content_capture/android/java/src/org/chromium/components/content_capture/SessionRemovedTask.java b/chromium/components/content_capture/android/java/src/org/chromium/components/content_capture/SessionRemovedTask.java
deleted file mode 100644
index 813fb31a18a..00000000000
--- a/chromium/components/content_capture/android/java/src/org/chromium/components/content_capture/SessionRemovedTask.java
+++ /dev/null
@@ -1,42 +0,0 @@
-// 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.components.content_capture;
-
-import org.chromium.components.content_capture.PlatformSession.PlatformSessionData;
-
-/**
- * The task to remove the platform session
- */
-class SessionRemovedTask extends NotificationTask {
- public SessionRemovedTask(FrameSession session, PlatformSession platformSession) {
- super(session, platformSession);
- }
-
- @Override
- protected Boolean doInBackground() {
- removeSession();
- return true;
- }
-
- private void removeSession() {
- log("SessionRemovedTask.removeSession");
- PlatformSessionData removedPlatformSessionData =
- mPlatformSession.getFrameIdToPlatformSessionData().remove(mSession.get(0).getId());
- if (removedPlatformSessionData == null) return;
- removedPlatformSessionData.contentCaptureSession.destroy();
- PlatformSessionData parentPlatformSessionData =
- mPlatformSession.getRootPlatformSessionData();
- // We need to notify the view disappeared through the removed session's parent,
- // if there are more than one session in mSession, the removed session is child
- // frame, otherwise, is main frame.
- if (mSession.size() > 2) {
- parentPlatformSessionData =
- mPlatformSession.getFrameIdToPlatformSessionData().get(mSession.get(1).getId());
- }
- if (parentPlatformSessionData == null) return;
- parentPlatformSessionData.contentCaptureSession.notifyViewDisappeared(
- removedPlatformSessionData.autofillId);
- }
-}
diff --git a/chromium/components/content_capture/browser/content_capture_receiver_test.cc b/chromium/components/content_capture/browser/content_capture_receiver_test.cc
index cefc77bf71e..298fc00aeb8 100644
--- a/chromium/components/content_capture/browser/content_capture_receiver_test.cc
+++ b/chromium/components/content_capture/browser/content_capture_receiver_test.cc
@@ -47,8 +47,7 @@ class FakeContentCaptureSender {
mojo::PendingAssociatedReceiver<mojom::ContentCaptureReceiver>
GetPendingAssociatedReceiver() {
- return content_capture_receiver_
- .BindNewEndpointAndPassDedicatedReceiverForTesting();
+ return content_capture_receiver_.BindNewEndpointAndPassDedicatedReceiver();
}
private:
diff --git a/chromium/components/content_capture/common/BUILD.gn b/chromium/components/content_capture/common/BUILD.gn
index 0c0e96d1cfb..cb6031999f4 100644
--- a/chromium/components/content_capture/common/BUILD.gn
+++ b/chromium/components/content_capture/common/BUILD.gn
@@ -35,6 +35,24 @@ mojom("mojo_types") {
"//mojo/public/mojom/base",
"//ui/gfx/geometry/mojom",
]
+
+ cpp_typemaps = [
+ {
+ types = [
+ {
+ mojom = "content_capture.mojom.ContentCaptureData"
+ cpp = "::content_capture::ContentCaptureData"
+ },
+ ]
+ traits_headers = [ "content_capture_mojom_traits.h" ]
+ traits_sources = [ "content_capture_mojom_traits.cc" ]
+ traits_public_deps = [
+ ":common",
+ "//base",
+ "//ui/gfx/geometry/mojom:mojom_traits",
+ ]
+ },
+ ]
}
mojom("mojo_test_types") {
diff --git a/chromium/components/content_capture/common/OWNERS b/chromium/components/content_capture/common/OWNERS
index ae29a36aac8..1feb5149750 100644
--- a/chromium/components/content_capture/common/OWNERS
+++ b/chromium/components/content_capture/common/OWNERS
@@ -2,5 +2,3 @@ per-file *.mojom=set noparent
per-file *.mojom=file://ipc/SECURITY_OWNERS
per-file *_mojom_traits*.*=set noparent
per-file *_mojom_traits*.*=file://ipc/SECURITY_OWNERS
-per-file *.typemap=set noparent
-per-file *.typemap=file://ipc/SECURITY_OWNERS
diff --git a/chromium/components/content_capture/common/content_capture.typemap b/chromium/components/content_capture/common/content_capture.typemap
deleted file mode 100644
index 7e52773f811..00000000000
--- a/chromium/components/content_capture/common/content_capture.typemap
+++ /dev/null
@@ -1,20 +0,0 @@
-# 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.
-
-mojom = "//components/content_capture/common/content_capture_data.mojom"
-public_headers =
- [ "//components/content_capture/common/content_capture_data.h" ]
-traits_headers =
- [ "//components/content_capture/common/content_capture_mojom_traits.h" ]
-sources = [
- "//components/content_capture/common/content_capture_mojom_traits.cc",
- "//components/content_capture/common/content_capture_mojom_traits.h",
-]
-deps = [
- "//base",
- "//components/content_capture/common:common",
- "//ui/gfx/geometry/mojom:mojom_traits",
-]
-
-type_mappings = [ "content_capture.mojom.ContentCaptureData=::content_capture::ContentCaptureData" ]
diff --git a/chromium/components/content_capture/common/content_capture_features.cc b/chromium/components/content_capture/common/content_capture_features.cc
index 58832c32788..3258e664620 100644
--- a/chromium/components/content_capture/common/content_capture_features.cc
+++ b/chromium/components/content_capture/common/content_capture_features.cc
@@ -16,7 +16,7 @@ const base::Feature kContentCapture{"ContentCapture",
base::FEATURE_ENABLED_BY_DEFAULT};
const base::Feature kContentCaptureTriggeringForExperiment{
- "ContentCaptureTriggeringForExperiment", base::FEATURE_ENABLED_BY_DEFAULT};
+ "ContentCaptureTriggeringForExperiment", base::FEATURE_DISABLED_BY_DEFAULT};
#else
const base::Feature kContentCapture{"ContentCapture",
base::FEATURE_DISABLED_BY_DEFAULT};
diff --git a/chromium/components/content_capture/common/content_capture_mojom_traits.h b/chromium/components/content_capture/common/content_capture_mojom_traits.h
index 16d9679542f..2fbce3ea7bc 100644
--- a/chromium/components/content_capture/common/content_capture_mojom_traits.h
+++ b/chromium/components/content_capture/common/content_capture_mojom_traits.h
@@ -8,7 +8,7 @@
#include <vector>
#include "components/content_capture/common/content_capture_data.h"
-#include "components/content_capture/common/content_capture_data.mojom.h"
+#include "components/content_capture/common/content_capture_data.mojom-shared.h"
#include "mojo/public/cpp/bindings/struct_traits.h"
#include "ui/gfx/geometry/rect_f.h"