1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86
|
// Copyright 2023 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
module commerce.mojom;
import "components/commerce/core/mojom/shopping_service.mojom";
import "components/commerce/core/mojom/shared.mojom";
import "url/mojom/url.mojom";
// This defines a binary detail (i.e., is syncing bookmarks) for shopping
// feature eligibility.
struct EligibilityDetail {
string name;
// Whether the feature is enabled.
bool value;
// The expected state of the feature, either enabled (true) or disabled
// (false).
bool expected_value;
};
// This contains information from the account checker (is syncing bookmarks, is
// anonymized URL data collection enabled, etc.) and commerce feature list to
// help determine whether a user is eligible for shopping features.
struct ShoppingEligibilityDetails {
string country;
string locale;
array<EligibilityDetail> details;
};
// Used by the WebUI to bootstrap bidirectional communication.
interface CommerceInternalsHandlerFactory {
// The WebUI calls this method when the page is first initialized.
CreateCommerceInternalsHandler(
pending_remote<CommerceInternalsPage> page,
pending_receiver<CommerceInternalsHandler> handler);
};
struct Subscription {
uint64 cluster_id;
array<commerce.shared.mojom.BookmarkProductInfo> product_infos;
};
// TODO(crbug.com/359684270) add more comments and investigate
// mojo_base.mojom.Time or mojo_base.mojom.JSTime for creation_time
// and update_time.
struct ProductSpecificationsSet {
string uuid;
string name;
string creation_time;
string update_time;
// Information about each item in the ProductSpecificationsSet
// such as URL and title.
array<shopping_service.mojom.UrlInfo> url_infos;
};
// Browser-side handler for requests from WebUI page.
interface CommerceInternalsHandler {
// Returns whether the user is eligible to use the shopping list feature.
GetIsShoppingListEligible() => (bool eligible);
// Resets the user preference for receiving price tracking emails so that the
// default value is used (e.g. no value is stored). This helps test UI flows
// that depend on that preference not being set.
ResetPriceTrackingEmailPref();
// Returns the product info for the provided URL if it exists.
GetProductInfoForUrl(url.mojom.Url url) =>
(commerce.shared.mojom.ProductInfo info);
// Returns the products the user has subscribed to.
GetSubscriptionDetails() =>
(array<Subscription> subscriptions);
// Return product specifications the user has synced.
GetProductSpecificationsDetails() =>
(array<ProductSpecificationsSet> product_specifications_set);
// Reset all statuses related to product specification feature. This includes
// removing all existing product specification sets of the current user.
ResetProductSpecifications();
// Returns the ShoppingEligibilityDetails.
GetShoppingEligibilityDetails() => (ShoppingEligibilityDetails details);
};
// WebUI-side handler for requests from the browser.
interface CommerceInternalsPage {
// A notification that the eligibility status for the shopping list feature
// changed.
OnShoppingListEligibilityChanged(bool eligible);
};
|