// 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. #ifndef COMPONENTS_WEBAPPS_BROWSER_INSTALLABLE_METRICS_SITE_QUALITY_METRICS_TASK_H_ #define COMPONENTS_WEBAPPS_BROWSER_INSTALLABLE_METRICS_SITE_QUALITY_METRICS_TASK_H_ #include <vector> #include "base/containers/flat_set.h" #include "base/functional/callback_forward.h" #include "base/memory/scoped_refptr.h" #include "base/memory/weak_ptr.h" #include "base/task/sequenced_task_runner.h" #include "base/time/time.h" #include "content/public/browser/storage_partition.h" #include "third_party/blink/public/mojom/quota/quota_types.mojom-forward.h" #include "url/gurl.h" namespace content { class WebContents; enum class ServiceWorkerCapability; class ServiceWorkerContext; class StoragePartition; } // namespace content namespace webapps { // This class is responsible for gathing metrics for the given site on the given // web contents to emit the "Site.Quality" UKM events. To stop collection, // simply destroy this object. // // Invariants: // - `WebContents` is alive during its lifetime of this class. // - `WebContents` is not navigated during the lifetime of this class and the // metrics gathered from it are valid for the `GetLastCommittedURL()` // retrieved on construction of this class. // - The default StoragePartition and the ServiceWorkerContext in use is alive // for the duration of this class. // // Browsertests are located in // chrome/browser/web_applications/ml_promotion_browsertest.cc struct SiteQualityMetrics { … }; // Returns the default favicon URL for the document, mimics behavior of // blink::IconURL::DefaultFavicon(). GURL GetDefaultFaviconUrl(const GURL& site_url); class SiteQualityMetricsTask { … }; } // namespace webapps #endif // COMPONENTS_WEBAPPS_BROWSER_INSTALLABLE_METRICS_SITE_QUALITY_METRICS_TASK_H_