Commit 77de8e2e authored by Sam Bowen's avatar Sam Bowen Committed by Commit Bot

Reland "Move entity and property mojo types to //components."

This is a reland of 38b34519

There are no changes in this reland. The fix is in:
https://crrev.com/i/2566200/3

This is part of a 2-sided patch which will be submitted just
before the above change.

Original change's description:
> Move entity and property mojo types to //components.
>
> We will use these types from both blink and //content and from code
> inside //components.
>
> This patch affects Clank downstream and will be submitted together with
> a patch in that repo to avoid breakage. Clank CL:
> https://crrev.com/i/2545991
>
> See discussion in design doc:
> https://docs.google.com/document/d/1ZA-1EMq4d40K5qfsZoeMIhJmZA6-AXaSibD3SsqZjfU/edit#
>
> Bug: 1044252
> Change-Id: Id658caa422bedbcb6d2275a8ccdd76f73bf955c8
> Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2051363
> Reviewed-by: Kinuko Yasuda <kinuko@chromium.org>
> Reviewed-by: Kentaro Hara <haraken@chromium.org>
> Reviewed-by: Becca Hughes <beccahughes@chromium.org>
> Commit-Queue: Sam Bowen <sgbowen@google.com>
> Cr-Commit-Position: refs/heads/master@{#741227}

TBR=beccahughes@google.com,haraken@chromium.org

Bug: 1044252
Change-Id: Ib37ff0cfa3913fa1c7c4dc7a956c8efff04b0b17
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2057740
Commit-Queue: Sam Bowen <sgbowen@google.com>
Reviewed-by: default avatarKinuko Yasuda <kinuko@chromium.org>
Cr-Commit-Position: refs/heads/master@{#742283}
parent ee7d3955
......@@ -315,6 +315,7 @@ android_library("chrome_java") {
"//components/permissions/android:java",
"//components/policy/android:policy_java",
"//components/safe_browsing/android:safe_browsing_java",
"//components/schema_org/common:mojom_java",
"//components/search_engines/android:java",
"//components/security_interstitials/content/android:java",
"//components/signin/core/browser/android:java",
......@@ -670,6 +671,7 @@ junit_binary("chrome_junit_tests") {
"//components/offline_items_collection/core:core_java",
"//components/payments/content/android:java",
"//components/payments/mojom:mojom_java",
"//components/schema_org/common:mojom_java",
"//components/signin/core/browser/android:java",
"//components/signin/core/browser/android:signin_java_test_support",
"//components/sync:sync_java_test_support",
......@@ -828,6 +830,7 @@ android_library("chrome_test_java") {
"//components/policy/android:policy_java",
"//components/policy/android:policy_java_test_support",
"//components/safe_browsing/android:safe_browsing_java",
"//components/schema_org/common:mojom_java",
"//components/search_engines/android:java",
"//components/security_interstitials/content/android:java",
"//components/signin/core/browser/android:java",
......
......@@ -19,9 +19,6 @@ import org.chromium.base.test.util.CommandLineFlags;
import org.chromium.base.test.util.Feature;
import org.chromium.base.test.util.Restriction;
import org.chromium.base.test.util.RetryOnFailure;
import org.chromium.blink.mojom.Entity;
import org.chromium.blink.mojom.Property;
import org.chromium.blink.mojom.Values;
import org.chromium.blink.mojom.WebPage;
import org.chromium.chrome.browser.firstrun.FirstRunStatus;
import org.chromium.chrome.browser.util.UrlConstants;
......@@ -30,14 +27,15 @@ import org.chromium.chrome.test.ChromeTabbedActivityTestRule;
import org.chromium.chrome.test.util.ChromeTabUtils;
import org.chromium.content_public.browser.test.util.TestThreadUtils;
import org.chromium.net.test.EmbeddedTestServer;
import org.chromium.schema_org.mojom.Entity;
import org.chromium.schema_org.mojom.Property;
import org.chromium.schema_org.mojom.Values;
import org.chromium.url.mojom.Url;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.TimeoutException;
/**
* Tests Copyless Paste AppIndexing using instrumented tests.
*/
/** Tests Copyless Paste AppIndexing using instrumented tests. */
@RunWith(ChromeJUnit4ClassRunner.class)
@CommandLineFlags.
Add({ChromeSwitches.DISABLE_FIRST_RUN_EXPERIENCE, "enable-features=CopylessPaste"})
......@@ -91,9 +89,7 @@ public class CopylessPasteTest {
}
}
/**
* Tests that CopylessPaste is disabled in Incognito tabs.
*/
/** Tests that CopylessPaste is disabled in Incognito tabs. */
@Test
@LargeTest
@Feature({"CopylessPaste"})
......@@ -107,9 +103,7 @@ public class CopylessPasteTest {
Assert.assertEquals(0, mCallbackHelper.getCallCount());
}
/**
* Tests that CopylessPaste skips invalid schemes.
*/
/** Tests that CopylessPaste skips invalid schemes. */
@Test
@LargeTest
@Feature({"CopylessPaste"})
......@@ -120,9 +114,7 @@ public class CopylessPasteTest {
Assert.assertEquals(0, mCallbackHelper.getCallCount());
}
/**
* Tests that CopylessPaste works on pages without desired metadata.
*/
/** Tests that CopylessPaste works on pages without desired metadata. */
@Test
@LargeTest
@RetryOnFailure
......@@ -133,9 +125,7 @@ public class CopylessPasteTest {
Assert.assertNull(mCallbackHelper.getWebPage());
}
/**
* Tests that CopylessPaste works end-to-end.
*/
/** Tests that CopylessPaste works end-to-end. */
@Test
@LargeTest
@RetryOnFailure
......@@ -165,9 +155,7 @@ public class CopylessPasteTest {
Assert.assertEquals(expected.serialize(), extracted.serialize());
}
/**
* Tests that CopylessPaste skips parsing visited pages.
*/
/** Tests that CopylessPaste skips parsing visited pages. */
@Test
@LargeTest
@RetryOnFailure
......
# 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.
import("//mojo/public/tools/bindings/mojom.gni")
mojom("mojom") {
generate_java = true
sources = [ "metadata.mojom" ]
public_deps = [ "//url/mojom:url_mojom_gurl" ]
}
per-file *.mojom=set noparent
per-file *.mojom=file://ipc/SECURITY_OWNERS
// 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.
module schema_org.mojom;
// Due to the restriction of AppIndexing, all elements should be of the
// same type. Non-array values are converted to arrays of one element.
union Values {
array<bool> bool_values;
array<int64> long_values;
array<string> string_values;
array<Entity> entity_values;
};
// Key-value pair for the attributes of an |Entity|.
struct Property {
string name;
Values values;
};
// Top-level metadata entry using schema.org vocabulary.
// Tree structure of entities is possible.
// Ref: https://developers.google.com/schemas/formats/json-ld
struct Entity {
string type; // Correspond to the "@type" key, defined in JSON-LD.
array<Property> properties;
};
......@@ -188,6 +188,7 @@ mojom("mojom_platform") {
":web_feature_mojo_bindings",
"//cc/mojom",
"//components/payments/mojom",
"//components/schema_org/common:mojom",
"//components/services/filesystem/public/mojom",
"//mojo/public/mojom/base",
"//services/device/public/mojom",
......@@ -265,6 +266,7 @@ mojom("android_mojo_bindings") {
}
public_deps = [
"//components/payments/mojom",
"//components/schema_org/common:mojom",
"//mojo/public/mojom/base",
"//services/media_session/public/mojom",
"//services/network/public/mojom",
......
......@@ -4,35 +4,13 @@
module blink.mojom;
import "components/schema_org/common/metadata.mojom";
import "url/mojom/url.mojom";
// Due to the restriction of AppIndexing, all elements should be of the
// same type. Non-array values are converted to arrays of one element.
union Values {
array<bool> bool_values;
array<int64> long_values;
array<string> string_values;
array<Entity> entity_values;
};
// Key-value pair for the attributes of an |Entity|.
struct Property {
string name;
Values values;
};
// Top-level metadata entry using schema.org vocabulary.
// Tree structure of entities is possible.
// Ref: https://developers.google.com/schemas/formats/json-ld
struct Entity {
string type; // Correspond to the "@type" key, defined in JSON-LD.
array<Property> properties;
};
struct WebPage {
url.mojom.Url url;
string title;
array<Entity> entities;
array<schema_org.mojom.Entity> entities;
};
// Null page denotes no results.
......
......@@ -460,6 +460,7 @@ jumbo_source_set("unit_tests") {
":modules",
":modules_testing",
"//build:chromecast_buildflags",
"//components/schema_org/common:mojom_blink",
"//media:test_support",
"//net:quic_test_tools",
"//services/device/public/cpp:test_support",
......
......@@ -12,5 +12,5 @@ blink_modules_sources("document_metadata") {
"document_metadata_server.h",
]
deps = []
deps = [ "//components/schema_org/common:mojom_blink" ]
}
include_rules = [
"+components/schema_org/common",
]
......@@ -9,6 +9,7 @@
#include <utility>
#include "base/metrics/histogram_functions.h"
#include "components/schema_org/common/metadata.mojom-blink.h"
#include "third_party/blink/public/mojom/document_metadata/document_metadata.mojom-blink.h"
#include "third_party/blink/renderer/core/dom/document.h"
#include "third_party/blink/renderer/core/dom/element_traversal.h"
......@@ -26,14 +27,14 @@ namespace blink {
namespace {
using mojom::blink::Entity;
using mojom::blink::EntityPtr;
using mojom::blink::Property;
using mojom::blink::PropertyPtr;
using mojom::blink::Values;
using mojom::blink::ValuesPtr;
using mojom::blink::WebPage;
using mojom::blink::WebPagePtr;
using schema_org::mojom::blink::Entity;
using schema_org::mojom::blink::EntityPtr;
using schema_org::mojom::blink::Property;
using schema_org::mojom::blink::PropertyPtr;
using schema_org::mojom::blink::Values;
using schema_org::mojom::blink::ValuesPtr;
// App Indexing enforces a max nesting depth of 5. Our top level message
// corresponds to the WebPage, so this only leaves 4 more levels. We will parse
......
......@@ -5,6 +5,7 @@
#ifndef THIRD_PARTY_BLINK_RENDERER_MODULES_DOCUMENT_METADATA_DOCUMENT_METADATA_EXTRACTOR_H_
#define THIRD_PARTY_BLINK_RENDERER_MODULES_DOCUMENT_METADATA_DOCUMENT_METADATA_EXTRACTOR_H_
#include "components/schema_org/common/metadata.mojom-blink-forward.h"
#include "third_party/blink/public/mojom/document_metadata/document_metadata.mojom-blink-forward.h"
#include "third_party/blink/renderer/modules/modules_export.h"
#include "third_party/blink/renderer/platform/wtf/allocator/allocator.h"
......
......@@ -7,6 +7,7 @@
#include <memory>
#include <utility>
#include "components/schema_org/common/metadata.mojom-blink.h"
#include "testing/gtest/include/gtest/gtest.h"
#include "third_party/blink/public/mojom/document_metadata/document_metadata.mojom-blink.h"
#include "third_party/blink/renderer/core/dom/element.h"
......@@ -18,14 +19,14 @@ namespace blink {
namespace {
using mojom::blink::Entity;
using mojom::blink::EntityPtr;
using mojom::blink::Property;
using mojom::blink::PropertyPtr;
using mojom::blink::Values;
using mojom::blink::ValuesPtr;
using mojom::blink::WebPage;
using mojom::blink::WebPagePtr;
using schema_org::mojom::blink::Entity;
using schema_org::mojom::blink::EntityPtr;
using schema_org::mojom::blink::Property;
using schema_org::mojom::blink::PropertyPtr;
using schema_org::mojom::blink::Values;
using schema_org::mojom::blink::ValuesPtr;
class DocumentMetadataExtractorTest : public PageTestBase {
public:
......
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