Rename FrameServiceBase to DocumentServiceBase.
As a comment in the header correctly says, FrameServiceBase is used for implementing mojo-based services tied to a document lifetime. Rename it to DocumentServiceBase to make the lifetime expectations clear. Also this patch updates the comment in DocumentServiceBase to refer to "RenderFrameHost" instead of a "frame". R=alexmos@chromium.org BUG=1216208 Change-Id: I00796c02b637e6e407bad0a8c797f1ce3af71436 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2938442 Auto-Submit: Alexander Timin <altimin@chromium.org> Commit-Queue: Alex Moshchuk <alexmos@chromium.org> Reviewed-by: Alex Moshchuk <alexmos@chromium.org> Owners-Override: Alex Moshchuk <alexmos@chromium.org> Cr-Commit-Position: refs/heads/master@{#889336}
This commit is contained in:

committed by
Chromium LUCI CQ

parent
7d22a9b9b6
commit
a085dd45b3
chrome/browser
cart
device_api
device_service_impl.ccdevice_service_impl.hmanaged_configuration_service.ccmanaged_configuration_service.h
media
android
cdm_pref_service_impl.cccdm_pref_service_impl.houtput_protection_impl.ccoutput_protection_impl.hplatform_verification_impl.ccplatform_verification_impl.hnavigation_predictor
prefetch
prefetch_proxy
ui
web_applications
chromecast/browser
components/cdm/browser
content
browser
back_forward_cache_browsertest.cceye_dropper_chooser_impl.cceye_dropper_chooser_impl.h
federated_learning
hid
image_capture
interest_group
ad_auction_service_impl.ccad_auction_service_impl.hinterest_group_service_impl.ccinterest_group_service_impl.h
keyboard_lock
media
picture_in_picture
renderer_host
sms
speculation_rules
wake_lock
webauth
webid
public
test
fuchsia/engine/browser
@@ -16,7 +16,7 @@
|
|||||||
#include "chrome/browser/optimization_guide/optimization_guide_keyed_service_factory.h"
|
#include "chrome/browser/optimization_guide/optimization_guide_keyed_service_factory.h"
|
||||||
#include "chrome/browser/profiles/profile.h"
|
#include "chrome/browser/profiles/profile.h"
|
||||||
#include "components/search/ntp_features.h"
|
#include "components/search/ntp_features.h"
|
||||||
#include "content/public/browser/frame_service_base.h"
|
#include "content/public/browser/document_service_base.h"
|
||||||
#include "content/public/browser/web_contents.h"
|
#include "content/public/browser/web_contents.h"
|
||||||
#include "content/public/browser/web_contents_user_data.h"
|
#include "content/public/browser/web_contents_user_data.h"
|
||||||
#include "mojo/public/cpp/bindings/self_owned_receiver.h"
|
#include "mojo/public/cpp/bindings/self_owned_receiver.h"
|
||||||
@@ -82,13 +82,13 @@ void ConstructCartProto(cart_db::ChromeCartContentProto* proto,
|
|||||||
// Implementation of the Mojo CommerceHintObserver. This is called by the
|
// Implementation of the Mojo CommerceHintObserver. This is called by the
|
||||||
// renderer to notify the browser that a commerce hint happens.
|
// renderer to notify the browser that a commerce hint happens.
|
||||||
class CommerceHintObserverImpl
|
class CommerceHintObserverImpl
|
||||||
: public content::FrameServiceBase<mojom::CommerceHintObserver> {
|
: public content::DocumentServiceBase<mojom::CommerceHintObserver> {
|
||||||
public:
|
public:
|
||||||
explicit CommerceHintObserverImpl(
|
explicit CommerceHintObserverImpl(
|
||||||
content::RenderFrameHost* render_frame_host,
|
content::RenderFrameHost* render_frame_host,
|
||||||
mojo::PendingReceiver<mojom::CommerceHintObserver> receiver,
|
mojo::PendingReceiver<mojom::CommerceHintObserver> receiver,
|
||||||
base::WeakPtr<CommerceHintService> service)
|
base::WeakPtr<CommerceHintService> service)
|
||||||
: FrameServiceBase(render_frame_host, std::move(receiver)),
|
: DocumentServiceBase(render_frame_host, std::move(receiver)),
|
||||||
binding_url_(render_frame_host->GetLastCommittedURL()),
|
binding_url_(render_frame_host->GetLastCommittedURL()),
|
||||||
service_(std::move(service)) {}
|
service_(std::move(service)) {}
|
||||||
|
|
||||||
@@ -166,7 +166,7 @@ void CommerceHintService::BindCommerceHintObserver(
|
|||||||
content::RenderFrameHost* host,
|
content::RenderFrameHost* host,
|
||||||
mojo::PendingReceiver<mojom::CommerceHintObserver> receiver) {
|
mojo::PendingReceiver<mojom::CommerceHintObserver> receiver) {
|
||||||
// The object is bound to the lifetime of |host| and the mojo
|
// The object is bound to the lifetime of |host| and the mojo
|
||||||
// connection. See FrameServiceBase for details.
|
// connection. See DocumentServiceBase for details.
|
||||||
new CommerceHintObserverImpl(host, std::move(receiver),
|
new CommerceHintObserverImpl(host, std::move(receiver),
|
||||||
weak_factory_.GetWeakPtr());
|
weak_factory_.GetWeakPtr());
|
||||||
}
|
}
|
||||||
|
@@ -43,7 +43,7 @@ bool IsTrustedContext(content::RenderFrameHost* host,
|
|||||||
DeviceServiceImpl::DeviceServiceImpl(
|
DeviceServiceImpl::DeviceServiceImpl(
|
||||||
content::RenderFrameHost* host,
|
content::RenderFrameHost* host,
|
||||||
mojo::PendingReceiver<blink::mojom::DeviceAPIService> receiver)
|
mojo::PendingReceiver<blink::mojom::DeviceAPIService> receiver)
|
||||||
: FrameServiceBase(host, std::move(receiver)), host_(host) {
|
: DocumentServiceBase(host, std::move(receiver)), host_(host) {
|
||||||
pref_change_registrar_.Init(
|
pref_change_registrar_.Init(
|
||||||
Profile::FromBrowserContext(host->GetBrowserContext())->GetPrefs());
|
Profile::FromBrowserContext(host->GetBrowserContext())->GetPrefs());
|
||||||
pref_change_registrar_.Add(
|
pref_change_registrar_.Add(
|
||||||
@@ -67,7 +67,7 @@ void DeviceServiceImpl::Create(
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
// The object is bound to the lifetime of |host| and the mojo
|
// The object is bound to the lifetime of |host| and the mojo
|
||||||
// connection. See FrameServiceBase for details.
|
// connection. See DocumentServiceBase for details.
|
||||||
new DeviceServiceImpl(host, std::move(receiver));
|
new DeviceServiceImpl(host, std::move(receiver));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -6,7 +6,7 @@
|
|||||||
#define CHROME_BROWSER_DEVICE_API_DEVICE_SERVICE_IMPL_H_
|
#define CHROME_BROWSER_DEVICE_API_DEVICE_SERVICE_IMPL_H_
|
||||||
|
|
||||||
#include "components/prefs/pref_change_registrar.h"
|
#include "components/prefs/pref_change_registrar.h"
|
||||||
#include "content/public/browser/frame_service_base.h"
|
#include "content/public/browser/document_service_base.h"
|
||||||
#include "third_party/blink/public/mojom/device/device.mojom.h"
|
#include "third_party/blink/public/mojom/device/device.mojom.h"
|
||||||
|
|
||||||
namespace content {
|
namespace content {
|
||||||
@@ -16,7 +16,7 @@ class RenderFrameHost;
|
|||||||
// A browser-side mojo service, which corresponds to the navigator.managed Web
|
// A browser-side mojo service, which corresponds to the navigator.managed Web
|
||||||
// API. Available only to trusted web applications.
|
// API. Available only to trusted web applications.
|
||||||
class DeviceServiceImpl final
|
class DeviceServiceImpl final
|
||||||
: public content::FrameServiceBase<blink::mojom::DeviceAPIService> {
|
: public content::DocumentServiceBase<blink::mojom::DeviceAPIService> {
|
||||||
public:
|
public:
|
||||||
// Tries to attach this mojo service to |host| for trusted web applications.
|
// Tries to attach this mojo service to |host| for trusted web applications.
|
||||||
// Will dynamically disconnect if the trustness status is revoked.
|
// Will dynamically disconnect if the trustness status is revoked.
|
||||||
|
@@ -21,14 +21,14 @@ void ManagedConfigurationServiceImpl::Create(
|
|||||||
}
|
}
|
||||||
|
|
||||||
// The object is bound to the lifetime of |host| and the mojo
|
// The object is bound to the lifetime of |host| and the mojo
|
||||||
// connection. See FrameServiceBase for details.
|
// connection. See DocumentServiceBase for details.
|
||||||
new ManagedConfigurationServiceImpl(host, std::move(receiver));
|
new ManagedConfigurationServiceImpl(host, std::move(receiver));
|
||||||
}
|
}
|
||||||
|
|
||||||
ManagedConfigurationServiceImpl::ManagedConfigurationServiceImpl(
|
ManagedConfigurationServiceImpl::ManagedConfigurationServiceImpl(
|
||||||
content::RenderFrameHost* host,
|
content::RenderFrameHost* host,
|
||||||
mojo::PendingReceiver<blink::mojom::ManagedConfigurationService> receiver)
|
mojo::PendingReceiver<blink::mojom::ManagedConfigurationService> receiver)
|
||||||
: FrameServiceBase(host, std::move(receiver)), host_(host) {
|
: DocumentServiceBase(host, std::move(receiver)), host_(host) {
|
||||||
managed_configuration_api()->AddObserver(this);
|
managed_configuration_api()->AddObserver(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -6,11 +6,11 @@
|
|||||||
#define CHROME_BROWSER_DEVICE_API_MANAGED_CONFIGURATION_SERVICE_H_
|
#define CHROME_BROWSER_DEVICE_API_MANAGED_CONFIGURATION_SERVICE_H_
|
||||||
|
|
||||||
#include "chrome/browser/device_api/managed_configuration_api.h"
|
#include "chrome/browser/device_api/managed_configuration_api.h"
|
||||||
#include "content/public/browser/frame_service_base.h"
|
#include "content/public/browser/document_service_base.h"
|
||||||
#include "third_party/blink/public/mojom/device/device.mojom.h"
|
#include "third_party/blink/public/mojom/device/device.mojom.h"
|
||||||
|
|
||||||
class ManagedConfigurationServiceImpl
|
class ManagedConfigurationServiceImpl
|
||||||
: public content::FrameServiceBase<
|
: public content::DocumentServiceBase<
|
||||||
blink::mojom::ManagedConfigurationService>,
|
blink::mojom::ManagedConfigurationService>,
|
||||||
public ManagedConfigurationAPI::Observer {
|
public ManagedConfigurationAPI::Observer {
|
||||||
public:
|
public:
|
||||||
|
@@ -151,7 +151,7 @@ void CreateMediaDrmStorage(
|
|||||||
: base::BindRepeating(&CreateOriginId);
|
: base::BindRepeating(&CreateOriginId);
|
||||||
|
|
||||||
// The object will be deleted on connection error, or when the frame navigates
|
// The object will be deleted on connection error, or when the frame navigates
|
||||||
// away. See FrameServiceBase for details.
|
// away. See DocumentServiceBase for details.
|
||||||
new cdm::MediaDrmStorageImpl(
|
new cdm::MediaDrmStorageImpl(
|
||||||
render_frame_host, pref_service, get_origin_id_cb,
|
render_frame_host, pref_service, get_origin_id_cb,
|
||||||
base::BindRepeating(&AllowEmptyOriginId, render_frame_host),
|
base::BindRepeating(&AllowEmptyOriginId, render_frame_host),
|
||||||
|
@@ -93,14 +93,14 @@ void CdmPrefServiceImpl::Create(
|
|||||||
DCHECK_CURRENTLY_ON(content::BrowserThread::UI);
|
DCHECK_CURRENTLY_ON(content::BrowserThread::UI);
|
||||||
|
|
||||||
// The object is bound to the lifetime of `render_frame_host` and the mojo
|
// The object is bound to the lifetime of `render_frame_host` and the mojo
|
||||||
// connection. See FrameServiceBase for details.
|
// connection. See DocumentServiceBase for details.
|
||||||
new CdmPrefServiceImpl(render_frame_host, std::move(receiver));
|
new CdmPrefServiceImpl(render_frame_host, std::move(receiver));
|
||||||
}
|
}
|
||||||
|
|
||||||
CdmPrefServiceImpl::CdmPrefServiceImpl(
|
CdmPrefServiceImpl::CdmPrefServiceImpl(
|
||||||
content::RenderFrameHost* render_frame_host,
|
content::RenderFrameHost* render_frame_host,
|
||||||
mojo::PendingReceiver<media::mojom::CdmPrefService> receiver)
|
mojo::PendingReceiver<media::mojom::CdmPrefService> receiver)
|
||||||
: FrameServiceBase(render_frame_host, std::move(receiver)) {}
|
: DocumentServiceBase(render_frame_host, std::move(receiver)) {}
|
||||||
|
|
||||||
CdmPrefServiceImpl::~CdmPrefServiceImpl() = default;
|
CdmPrefServiceImpl::~CdmPrefServiceImpl() = default;
|
||||||
|
|
||||||
|
@@ -5,7 +5,7 @@
|
|||||||
#ifndef CHROME_BROWSER_MEDIA_CDM_PREF_SERVICE_IMPL_H_
|
#ifndef CHROME_BROWSER_MEDIA_CDM_PREF_SERVICE_IMPL_H_
|
||||||
#define CHROME_BROWSER_MEDIA_CDM_PREF_SERVICE_IMPL_H_
|
#define CHROME_BROWSER_MEDIA_CDM_PREF_SERVICE_IMPL_H_
|
||||||
|
|
||||||
#include "content/public/browser/frame_service_base.h"
|
#include "content/public/browser/document_service_base.h"
|
||||||
#include "media/mojo/mojom/cdm_pref_service.mojom.h"
|
#include "media/mojo/mojom/cdm_pref_service.mojom.h"
|
||||||
#include "url/origin.h"
|
#include "url/origin.h"
|
||||||
|
|
||||||
@@ -17,7 +17,7 @@ class PrefRegistrySimple;
|
|||||||
// for origins serving hardware security protected contents and as such the size
|
// for origins serving hardware security protected contents and as such the size
|
||||||
// of the CDM Origin ID dictionary should only contain a handful of items.
|
// of the CDM Origin ID dictionary should only contain a handful of items.
|
||||||
class CdmPrefServiceImpl final
|
class CdmPrefServiceImpl final
|
||||||
: public content::FrameServiceBase<media::mojom::CdmPrefService> {
|
: public content::DocumentServiceBase<media::mojom::CdmPrefService> {
|
||||||
public:
|
public:
|
||||||
static void Create(
|
static void Create(
|
||||||
content::RenderFrameHost* render_frame_host,
|
content::RenderFrameHost* render_frame_host,
|
||||||
@@ -35,7 +35,7 @@ class CdmPrefServiceImpl final
|
|||||||
CdmPrefServiceImpl(
|
CdmPrefServiceImpl(
|
||||||
content::RenderFrameHost* render_frame_host,
|
content::RenderFrameHost* render_frame_host,
|
||||||
mojo::PendingReceiver<media::mojom::CdmPrefService> receiver);
|
mojo::PendingReceiver<media::mojom::CdmPrefService> receiver);
|
||||||
// `this` can only be destructed as a FrameServiceBase
|
// `this` can only be destructed as a DocumentServiceBase
|
||||||
~CdmPrefServiceImpl() final;
|
~CdmPrefServiceImpl() final;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@@ -24,14 +24,14 @@ void OutputProtectionImpl::Create(
|
|||||||
DCHECK(render_frame_host);
|
DCHECK(render_frame_host);
|
||||||
|
|
||||||
// The object is bound to the lifetime of |render_frame_host| and the mojo
|
// The object is bound to the lifetime of |render_frame_host| and the mojo
|
||||||
// connection. See FrameServiceBase for details.
|
// connection. See DocumentServiceBase for details.
|
||||||
new OutputProtectionImpl(render_frame_host, std::move(receiver));
|
new OutputProtectionImpl(render_frame_host, std::move(receiver));
|
||||||
}
|
}
|
||||||
|
|
||||||
OutputProtectionImpl::OutputProtectionImpl(
|
OutputProtectionImpl::OutputProtectionImpl(
|
||||||
content::RenderFrameHost* render_frame_host,
|
content::RenderFrameHost* render_frame_host,
|
||||||
mojo::PendingReceiver<media::mojom::OutputProtection> receiver)
|
mojo::PendingReceiver<media::mojom::OutputProtection> receiver)
|
||||||
: FrameServiceBase(render_frame_host, std::move(receiver)),
|
: DocumentServiceBase(render_frame_host, std::move(receiver)),
|
||||||
render_process_id_(render_frame_host->GetProcess()->GetID()),
|
render_process_id_(render_frame_host->GetProcess()->GetID()),
|
||||||
render_frame_id_(render_frame_host->GetRoutingID()) {}
|
render_frame_id_(render_frame_host->GetRoutingID()) {}
|
||||||
|
|
||||||
|
@@ -5,7 +5,7 @@
|
|||||||
#ifndef CHROME_BROWSER_MEDIA_OUTPUT_PROTECTION_IMPL_H_
|
#ifndef CHROME_BROWSER_MEDIA_OUTPUT_PROTECTION_IMPL_H_
|
||||||
#define CHROME_BROWSER_MEDIA_OUTPUT_PROTECTION_IMPL_H_
|
#define CHROME_BROWSER_MEDIA_OUTPUT_PROTECTION_IMPL_H_
|
||||||
|
|
||||||
#include "content/public/browser/frame_service_base.h"
|
#include "content/public/browser/document_service_base.h"
|
||||||
#include "media/mojo/mojom/output_protection.mojom.h"
|
#include "media/mojo/mojom/output_protection.mojom.h"
|
||||||
#include "mojo/public/cpp/bindings/pending_receiver.h"
|
#include "mojo/public/cpp/bindings/pending_receiver.h"
|
||||||
|
|
||||||
@@ -19,7 +19,7 @@ class RenderFrameHost;
|
|||||||
// their statuses. On all platforms we'll check the network links. On ChromeOS
|
// their statuses. On all platforms we'll check the network links. On ChromeOS
|
||||||
// we'll also check the hardware links. Can only be used on the UI thread.
|
// we'll also check the hardware links. Can only be used on the UI thread.
|
||||||
class OutputProtectionImpl final
|
class OutputProtectionImpl final
|
||||||
: public content::FrameServiceBase<media::mojom::OutputProtection> {
|
: public content::DocumentServiceBase<media::mojom::OutputProtection> {
|
||||||
public:
|
public:
|
||||||
static void Create(
|
static void Create(
|
||||||
content::RenderFrameHost* render_frame_host,
|
content::RenderFrameHost* render_frame_host,
|
||||||
@@ -35,7 +35,7 @@ class OutputProtectionImpl final
|
|||||||
EnableProtectionCallback callback) final;
|
EnableProtectionCallback callback) final;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
// |this| can only be destructed as a FrameServiceBase.
|
// |this| can only be destructed as a DocumentServiceBase.
|
||||||
~OutputProtectionImpl() final;
|
~OutputProtectionImpl() final;
|
||||||
|
|
||||||
// Callbacks for QueryStatus and EnableProtection results.
|
// Callbacks for QueryStatus and EnableProtection results.
|
||||||
|
@@ -61,14 +61,14 @@ void PlatformVerificationImpl::Create(
|
|||||||
DCHECK_CURRENTLY_ON(content::BrowserThread::UI);
|
DCHECK_CURRENTLY_ON(content::BrowserThread::UI);
|
||||||
|
|
||||||
// The object is bound to the lifetime of |render_frame_host| and the mojo
|
// The object is bound to the lifetime of |render_frame_host| and the mojo
|
||||||
// connection. See FrameServiceBase for details.
|
// connection. See DocumentServiceBase for details.
|
||||||
new PlatformVerificationImpl(render_frame_host, std::move(receiver));
|
new PlatformVerificationImpl(render_frame_host, std::move(receiver));
|
||||||
}
|
}
|
||||||
|
|
||||||
PlatformVerificationImpl::PlatformVerificationImpl(
|
PlatformVerificationImpl::PlatformVerificationImpl(
|
||||||
content::RenderFrameHost* render_frame_host,
|
content::RenderFrameHost* render_frame_host,
|
||||||
mojo::PendingReceiver<media::mojom::PlatformVerification> receiver)
|
mojo::PendingReceiver<media::mojom::PlatformVerification> receiver)
|
||||||
: FrameServiceBase(render_frame_host, std::move(receiver)),
|
: DocumentServiceBase(render_frame_host, std::move(receiver)),
|
||||||
render_frame_host_(render_frame_host) {}
|
render_frame_host_(render_frame_host) {}
|
||||||
|
|
||||||
PlatformVerificationImpl::~PlatformVerificationImpl() {
|
PlatformVerificationImpl::~PlatformVerificationImpl() {
|
||||||
|
@@ -10,7 +10,7 @@
|
|||||||
#include "base/callback.h"
|
#include "base/callback.h"
|
||||||
#include "base/memory/ref_counted.h"
|
#include "base/memory/ref_counted.h"
|
||||||
#include "build/chromeos_buildflags.h"
|
#include "build/chromeos_buildflags.h"
|
||||||
#include "content/public/browser/frame_service_base.h"
|
#include "content/public/browser/document_service_base.h"
|
||||||
#include "media/mojo/mojom/platform_verification.mojom.h"
|
#include "media/mojo/mojom/platform_verification.mojom.h"
|
||||||
#include "mojo/public/cpp/bindings/pending_receiver.h"
|
#include "mojo/public/cpp/bindings/pending_receiver.h"
|
||||||
|
|
||||||
@@ -21,7 +21,7 @@
|
|||||||
// Implements media::mojom::PlatformVerification. Can only be used on the
|
// Implements media::mojom::PlatformVerification. Can only be used on the
|
||||||
// UI thread because PlatformVerificationFlow lives on the UI thread.
|
// UI thread because PlatformVerificationFlow lives on the UI thread.
|
||||||
class PlatformVerificationImpl final
|
class PlatformVerificationImpl final
|
||||||
: public content::FrameServiceBase<media::mojom::PlatformVerification> {
|
: public content::DocumentServiceBase<media::mojom::PlatformVerification> {
|
||||||
public:
|
public:
|
||||||
static void Create(
|
static void Create(
|
||||||
content::RenderFrameHost* render_frame_host,
|
content::RenderFrameHost* render_frame_host,
|
||||||
@@ -41,7 +41,7 @@ class PlatformVerificationImpl final
|
|||||||
#endif // BUILDFLAG(IS_CHROMEOS_ASH)
|
#endif // BUILDFLAG(IS_CHROMEOS_ASH)
|
||||||
|
|
||||||
private:
|
private:
|
||||||
// |this| can only be destructed as a FrameServiceBase.
|
// |this| can only be destructed as a DocumentServiceBase.
|
||||||
~PlatformVerificationImpl() final;
|
~PlatformVerificationImpl() final;
|
||||||
|
|
||||||
#if BUILDFLAG(IS_CHROMEOS_ASH)
|
#if BUILDFLAG(IS_CHROMEOS_ASH)
|
||||||
|
@@ -42,7 +42,7 @@ size_t kMaxClicksTracked = 10;
|
|||||||
NavigationPredictor::NavigationPredictor(
|
NavigationPredictor::NavigationPredictor(
|
||||||
content::RenderFrameHost* render_frame_host,
|
content::RenderFrameHost* render_frame_host,
|
||||||
mojo::PendingReceiver<AnchorElementMetricsHost> receiver)
|
mojo::PendingReceiver<AnchorElementMetricsHost> receiver)
|
||||||
: content::FrameServiceBase<blink::mojom::AnchorElementMetricsHost>(
|
: content::DocumentServiceBase<blink::mojom::AnchorElementMetricsHost>(
|
||||||
render_frame_host,
|
render_frame_host,
|
||||||
std::move(receiver)) {
|
std::move(receiver)) {
|
||||||
DETACH_FROM_SEQUENCE(sequence_checker_);
|
DETACH_FROM_SEQUENCE(sequence_checker_);
|
||||||
@@ -75,7 +75,7 @@ void NavigationPredictor::Create(
|
|||||||
}
|
}
|
||||||
|
|
||||||
// The object is bound to the lifetime of the |render_frame_host| and the mojo
|
// The object is bound to the lifetime of the |render_frame_host| and the mojo
|
||||||
// connection. See FrameServiceBase for details.
|
// connection. See DocumentServiceBase for details.
|
||||||
new NavigationPredictor(render_frame_host, std::move(receiver));
|
new NavigationPredictor(render_frame_host, std::move(receiver));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -12,7 +12,7 @@
|
|||||||
|
|
||||||
#include "base/macros.h"
|
#include "base/macros.h"
|
||||||
#include "base/sequence_checker.h"
|
#include "base/sequence_checker.h"
|
||||||
#include "content/public/browser/frame_service_base.h"
|
#include "content/public/browser/document_service_base.h"
|
||||||
#include "content/public/browser/visibility.h"
|
#include "content/public/browser/visibility.h"
|
||||||
#include "mojo/public/cpp/bindings/pending_receiver.h"
|
#include "mojo/public/cpp/bindings/pending_receiver.h"
|
||||||
#include "services/metrics/public/cpp/ukm_recorder.h"
|
#include "services/metrics/public/cpp/ukm_recorder.h"
|
||||||
@@ -32,8 +32,8 @@ class RenderFrameHost;
|
|||||||
//
|
//
|
||||||
// This class derives from WebContentsObserver so that it can keep track of when
|
// This class derives from WebContentsObserver so that it can keep track of when
|
||||||
// WebContents is being destroyed via web_contents().
|
// WebContents is being destroyed via web_contents().
|
||||||
class NavigationPredictor
|
class NavigationPredictor : public content::DocumentServiceBase<
|
||||||
: public content::FrameServiceBase<blink::mojom::AnchorElementMetricsHost> {
|
blink::mojom::AnchorElementMetricsHost> {
|
||||||
public:
|
public:
|
||||||
NavigationPredictor(content::RenderFrameHost* render_frame_host,
|
NavigationPredictor(content::RenderFrameHost* render_frame_host,
|
||||||
mojo::PendingReceiver<AnchorElementMetricsHost> receiver);
|
mojo::PendingReceiver<AnchorElementMetricsHost> receiver);
|
||||||
|
@@ -35,7 +35,7 @@ class ChromeSpeculationHostDelegate : public content::SpeculationHostDelegate {
|
|||||||
std::vector<blink::mojom::SpeculationCandidatePtr>& candidates) override;
|
std::vector<blink::mojom::SpeculationCandidatePtr>& candidates) override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
// content::SpeculationHostImpl, which inherits content::FrameServiceBase,
|
// content::SpeculationHostImpl, which inherits content::DocumentServiceBase,
|
||||||
// owns `this`, so `this` can access `render_frame_host_` safely.
|
// owns `this`, so `this` can access `render_frame_host_` safely.
|
||||||
content::RenderFrameHost& render_frame_host_;
|
content::RenderFrameHost& render_frame_host_;
|
||||||
|
|
||||||
|
@@ -14,7 +14,7 @@
|
|||||||
DraggableRegionsHostImpl::DraggableRegionsHostImpl(
|
DraggableRegionsHostImpl::DraggableRegionsHostImpl(
|
||||||
content::RenderFrameHost* render_frame_host,
|
content::RenderFrameHost* render_frame_host,
|
||||||
mojo::PendingReceiver<chrome::mojom::DraggableRegions> receiver)
|
mojo::PendingReceiver<chrome::mojom::DraggableRegions> receiver)
|
||||||
: FrameServiceBase(render_frame_host, std::move(receiver)) {}
|
: DocumentServiceBase(render_frame_host, std::move(receiver)) {}
|
||||||
|
|
||||||
DraggableRegionsHostImpl::~DraggableRegionsHostImpl() = default;
|
DraggableRegionsHostImpl::~DraggableRegionsHostImpl() = default;
|
||||||
|
|
||||||
@@ -31,7 +31,7 @@ void DraggableRegionsHostImpl::CreateIfAllowed(
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
// The object is bound to the lifetime of |render_frame_host| and the mojo
|
// The object is bound to the lifetime of |render_frame_host| and the mojo
|
||||||
// connection. See FrameServiceBase for details.
|
// connection. See DocumentServiceBase for details.
|
||||||
new DraggableRegionsHostImpl(render_frame_host, std::move(receiver));
|
new DraggableRegionsHostImpl(render_frame_host, std::move(receiver));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -6,14 +6,14 @@
|
|||||||
#define CHROME_BROWSER_UI_WEB_APPLICATIONS_DRAGGABLE_REGION_HOST_IMPL_H_
|
#define CHROME_BROWSER_UI_WEB_APPLICATIONS_DRAGGABLE_REGION_HOST_IMPL_H_
|
||||||
|
|
||||||
#include "chrome/common/draggable_regions.mojom.h"
|
#include "chrome/common/draggable_regions.mojom.h"
|
||||||
#include "content/public/browser/frame_service_base.h"
|
#include "content/public/browser/document_service_base.h"
|
||||||
|
|
||||||
namespace content {
|
namespace content {
|
||||||
class RenderFrameHost;
|
class RenderFrameHost;
|
||||||
}
|
}
|
||||||
|
|
||||||
class DraggableRegionsHostImpl
|
class DraggableRegionsHostImpl
|
||||||
: public content::FrameServiceBase<chrome::mojom::DraggableRegions> {
|
: public content::DocumentServiceBase<chrome::mojom::DraggableRegions> {
|
||||||
public:
|
public:
|
||||||
DraggableRegionsHostImpl(const DraggableRegionsHostImpl&) = delete;
|
DraggableRegionsHostImpl(const DraggableRegionsHostImpl&) = delete;
|
||||||
DraggableRegionsHostImpl& operator=(const DraggableRegionsHostImpl&) = delete;
|
DraggableRegionsHostImpl& operator=(const DraggableRegionsHostImpl&) = delete;
|
||||||
|
@@ -21,7 +21,8 @@ void CreateApplicationMediaInfoManager(
|
|||||||
mojo::PendingReceiver<::media::mojom::CastApplicationMediaInfoManager>
|
mojo::PendingReceiver<::media::mojom::CastApplicationMediaInfoManager>
|
||||||
receiver) {
|
receiver) {
|
||||||
// The created ApplicationMediaInfoManager will be deleted on connection
|
// The created ApplicationMediaInfoManager will be deleted on connection
|
||||||
// error, or when the frame navigates away. See FrameServiceBase for details.
|
// error, or when the frame navigates away. See DocumentServiceBase for
|
||||||
|
// details.
|
||||||
new ApplicationMediaInfoManager(render_frame_host, std::move(receiver),
|
new ApplicationMediaInfoManager(render_frame_host, std::move(receiver),
|
||||||
std::move(application_session_id),
|
std::move(application_session_id),
|
||||||
mixer_audio_enabled);
|
mixer_audio_enabled);
|
||||||
@@ -33,7 +34,7 @@ ApplicationMediaInfoManager::ApplicationMediaInfoManager(
|
|||||||
receiver,
|
receiver,
|
||||||
std::string application_session_id,
|
std::string application_session_id,
|
||||||
bool mixer_audio_enabled)
|
bool mixer_audio_enabled)
|
||||||
: FrameServiceBase(render_frame_host, std::move(receiver)),
|
: DocumentServiceBase(render_frame_host, std::move(receiver)),
|
||||||
application_session_id_(std::move(application_session_id)),
|
application_session_id_(std::move(application_session_id)),
|
||||||
mixer_audio_enabled_(mixer_audio_enabled),
|
mixer_audio_enabled_(mixer_audio_enabled),
|
||||||
renderer_blocked_(false) {
|
renderer_blocked_(false) {
|
||||||
|
@@ -10,7 +10,7 @@
|
|||||||
|
|
||||||
#include "base/macros.h"
|
#include "base/macros.h"
|
||||||
#include "base/memory/weak_ptr.h"
|
#include "base/memory/weak_ptr.h"
|
||||||
#include "content/public/browser/frame_service_base.h"
|
#include "content/public/browser/document_service_base.h"
|
||||||
#include "media/mojo/mojom/cast_application_media_info_manager.mojom.h"
|
#include "media/mojo/mojom/cast_application_media_info_manager.mojom.h"
|
||||||
#include "mojo/public/cpp/bindings/pending_receiver.h"
|
#include "mojo/public/cpp/bindings/pending_receiver.h"
|
||||||
|
|
||||||
@@ -24,7 +24,7 @@ namespace media {
|
|||||||
class ApplicationMediaInfoManagerTest;
|
class ApplicationMediaInfoManagerTest;
|
||||||
|
|
||||||
class ApplicationMediaInfoManager
|
class ApplicationMediaInfoManager
|
||||||
: public ::content::FrameServiceBase<
|
: public ::content::DocumentServiceBase<
|
||||||
::media::mojom::CastApplicationMediaInfoManager>,
|
::media::mojom::CastApplicationMediaInfoManager>,
|
||||||
public base::SupportsWeakPtr<ApplicationMediaInfoManager> {
|
public base::SupportsWeakPtr<ApplicationMediaInfoManager> {
|
||||||
public:
|
public:
|
||||||
|
@@ -717,7 +717,7 @@ MediaDrmStorageImpl::MediaDrmStorageImpl(
|
|||||||
GetOriginIdCB get_origin_id_cb,
|
GetOriginIdCB get_origin_id_cb,
|
||||||
AllowEmptyOriginIdCB allow_empty_origin_id_cb,
|
AllowEmptyOriginIdCB allow_empty_origin_id_cb,
|
||||||
mojo::PendingReceiver<media::mojom::MediaDrmStorage> receiver)
|
mojo::PendingReceiver<media::mojom::MediaDrmStorage> receiver)
|
||||||
: FrameServiceBase(render_frame_host, std::move(receiver)),
|
: DocumentServiceBase(render_frame_host, std::move(receiver)),
|
||||||
pref_service_(pref_service),
|
pref_service_(pref_service),
|
||||||
get_origin_id_cb_(get_origin_id_cb),
|
get_origin_id_cb_(get_origin_id_cb),
|
||||||
allow_empty_origin_id_cb_(allow_empty_origin_id_cb) {
|
allow_empty_origin_id_cb_(allow_empty_origin_id_cb) {
|
||||||
|
@@ -15,7 +15,7 @@
|
|||||||
#include "base/time/time.h"
|
#include "base/time/time.h"
|
||||||
#include "base/unguessable_token.h"
|
#include "base/unguessable_token.h"
|
||||||
#include "build/build_config.h"
|
#include "build/build_config.h"
|
||||||
#include "content/public/browser/frame_service_base.h"
|
#include "content/public/browser/document_service_base.h"
|
||||||
#include "content/public/browser/render_frame_host.h"
|
#include "content/public/browser/render_frame_host.h"
|
||||||
#include "content/public/browser/web_contents_observer.h"
|
#include "content/public/browser/web_contents_observer.h"
|
||||||
#include "media/mojo/mojom/media_drm_storage.mojom.h"
|
#include "media/mojo/mojom/media_drm_storage.mojom.h"
|
||||||
@@ -43,7 +43,7 @@ extern const char kMediaDrmStorage[];
|
|||||||
// This file is located under components/ so that it can be shared by multiple
|
// This file is located under components/ so that it can be shared by multiple
|
||||||
// content embedders (e.g. chrome and chromecast).
|
// content embedders (e.g. chrome and chromecast).
|
||||||
class MediaDrmStorageImpl final
|
class MediaDrmStorageImpl final
|
||||||
: public content::FrameServiceBase<media::mojom::MediaDrmStorage> {
|
: public content::DocumentServiceBase<media::mojom::MediaDrmStorage> {
|
||||||
public:
|
public:
|
||||||
// When using per-origin provisioning, this is the ID for the origin.
|
// When using per-origin provisioning, this is the ID for the origin.
|
||||||
// If not specified, the device specific origin ID is to be used.
|
// If not specified, the device specific origin ID is to be used.
|
||||||
@@ -125,7 +125,7 @@ class MediaDrmStorageImpl final
|
|||||||
RemovePersistentSessionCallback callback) final;
|
RemovePersistentSessionCallback callback) final;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
// |this| can only be destructed as a FrameServiceBase.
|
// |this| can only be destructed as a DocumentServiceBase.
|
||||||
~MediaDrmStorageImpl() final;
|
~MediaDrmStorageImpl() final;
|
||||||
|
|
||||||
// Called when |get_origin_id_cb_| asynchronously returns a origin ID as part
|
// Called when |get_origin_id_cb_| asynchronously returns a origin ID as part
|
||||||
|
@@ -43,7 +43,7 @@
|
|||||||
#include "content/common/content_navigation_policy.h"
|
#include "content/common/content_navigation_policy.h"
|
||||||
#include "content/common/render_accessibility.mojom.h"
|
#include "content/common/render_accessibility.mojom.h"
|
||||||
#include "content/public/browser/back_forward_cache.h"
|
#include "content/public/browser/back_forward_cache.h"
|
||||||
#include "content/public/browser/frame_service_base.h"
|
#include "content/public/browser/document_service_base.h"
|
||||||
#include "content/public/browser/global_routing_id.h"
|
#include "content/public/browser/global_routing_id.h"
|
||||||
#include "content/public/browser/idle_manager.h"
|
#include "content/public/browser/idle_manager.h"
|
||||||
#include "content/public/browser/media_session.h"
|
#include "content/public/browser/media_session.h"
|
||||||
@@ -9005,13 +9005,13 @@ IN_PROC_BROWSER_TEST_F(BackForwardCacheBrowserTest,
|
|||||||
|
|
||||||
namespace {
|
namespace {
|
||||||
|
|
||||||
// Subclass of FrameServiceBase for test.
|
// Subclass of DocumentServiceBase for test.
|
||||||
class EchoImpl final : public FrameServiceBase<mojom::Echo> {
|
class EchoImpl final : public DocumentServiceBase<mojom::Echo> {
|
||||||
public:
|
public:
|
||||||
EchoImpl(RenderFrameHost* render_frame_host,
|
EchoImpl(RenderFrameHost* render_frame_host,
|
||||||
mojo::PendingReceiver<mojom::Echo> receiver,
|
mojo::PendingReceiver<mojom::Echo> receiver,
|
||||||
bool* deleted)
|
bool* deleted)
|
||||||
: FrameServiceBase(render_frame_host, std::move(receiver)),
|
: DocumentServiceBase(render_frame_host, std::move(receiver)),
|
||||||
deleted_(deleted) {}
|
deleted_(deleted) {}
|
||||||
~EchoImpl() final { *deleted_ = true; }
|
~EchoImpl() final { *deleted_ = true; }
|
||||||
|
|
||||||
@@ -9026,7 +9026,7 @@ class EchoImpl final : public FrameServiceBase<mojom::Echo> {
|
|||||||
|
|
||||||
} // namespace
|
} // namespace
|
||||||
|
|
||||||
IN_PROC_BROWSER_TEST_F(BackForwardCacheBrowserTest, FrameServiceBase) {
|
IN_PROC_BROWSER_TEST_F(BackForwardCacheBrowserTest, DocumentServiceBase) {
|
||||||
ASSERT_TRUE(embedded_test_server()->Start());
|
ASSERT_TRUE(embedded_test_server()->Start());
|
||||||
GURL url_a(embedded_test_server()->GetURL("a.com", "/title1.html"));
|
GURL url_a(embedded_test_server()->GetURL("a.com", "/title1.html"));
|
||||||
GURL url_b(embedded_test_server()->GetURL("b.com", "/title1.html"));
|
GURL url_b(embedded_test_server()->GetURL("b.com", "/title1.html"));
|
||||||
|
@@ -39,7 +39,7 @@ void EyeDropperChooserImpl::Create(
|
|||||||
EyeDropperChooserImpl::EyeDropperChooserImpl(
|
EyeDropperChooserImpl::EyeDropperChooserImpl(
|
||||||
RenderFrameHost* render_frame_host,
|
RenderFrameHost* render_frame_host,
|
||||||
mojo::PendingReceiver<blink::mojom::EyeDropperChooser> receiver)
|
mojo::PendingReceiver<blink::mojom::EyeDropperChooser> receiver)
|
||||||
: FrameServiceBase(render_frame_host, std::move(receiver)) {}
|
: DocumentServiceBase(render_frame_host, std::move(receiver)) {}
|
||||||
|
|
||||||
EyeDropperChooserImpl::~EyeDropperChooserImpl() {
|
EyeDropperChooserImpl::~EyeDropperChooserImpl() {
|
||||||
if (callback_)
|
if (callback_)
|
||||||
|
@@ -7,8 +7,8 @@
|
|||||||
|
|
||||||
#include <memory>
|
#include <memory>
|
||||||
|
|
||||||
|
#include "content/public/browser/document_service_base.h"
|
||||||
#include "content/public/browser/eye_dropper_listener.h"
|
#include "content/public/browser/eye_dropper_listener.h"
|
||||||
#include "content/public/browser/frame_service_base.h"
|
|
||||||
#include "mojo/public/cpp/bindings/pending_receiver.h"
|
#include "mojo/public/cpp/bindings/pending_receiver.h"
|
||||||
#include "third_party/blink/public/mojom/choosers/color_chooser.mojom.h"
|
#include "third_party/blink/public/mojom/choosers/color_chooser.mojom.h"
|
||||||
|
|
||||||
@@ -18,7 +18,7 @@ class EyeDropper;
|
|||||||
class EyeDropperListener;
|
class EyeDropperListener;
|
||||||
|
|
||||||
class EyeDropperChooserImpl final
|
class EyeDropperChooserImpl final
|
||||||
: public FrameServiceBase<blink::mojom::EyeDropperChooser>,
|
: public DocumentServiceBase<blink::mojom::EyeDropperChooser>,
|
||||||
public EyeDropperListener {
|
public EyeDropperListener {
|
||||||
public:
|
public:
|
||||||
static void Create(RenderFrameHost*,
|
static void Create(RenderFrameHost*,
|
||||||
|
@@ -16,7 +16,7 @@ namespace content {
|
|||||||
FlocServiceImpl::FlocServiceImpl(
|
FlocServiceImpl::FlocServiceImpl(
|
||||||
RenderFrameHost* render_frame_host,
|
RenderFrameHost* render_frame_host,
|
||||||
mojo::PendingReceiver<blink::mojom::FlocService> receiver)
|
mojo::PendingReceiver<blink::mojom::FlocService> receiver)
|
||||||
: FrameServiceBase(render_frame_host, std::move(receiver)),
|
: DocumentServiceBase(render_frame_host, std::move(receiver)),
|
||||||
render_frame_host_(static_cast<RenderFrameHostImpl*>(render_frame_host)) {
|
render_frame_host_(static_cast<RenderFrameHostImpl*>(render_frame_host)) {
|
||||||
DCHECK(render_frame_host_);
|
DCHECK(render_frame_host_);
|
||||||
}
|
}
|
||||||
@@ -28,7 +28,7 @@ void FlocServiceImpl::CreateMojoService(
|
|||||||
DCHECK(render_frame_host);
|
DCHECK(render_frame_host);
|
||||||
|
|
||||||
// The object is bound to the lifetime of |render_frame_host| and the mojo
|
// The object is bound to the lifetime of |render_frame_host| and the mojo
|
||||||
// connection. See FrameServiceBase for details.
|
// connection. See DocumentServiceBase for details.
|
||||||
new FlocServiceImpl(render_frame_host, std::move(receiver));
|
new FlocServiceImpl(render_frame_host, std::move(receiver));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -6,7 +6,7 @@
|
|||||||
#define CONTENT_BROWSER_FEDERATED_LEARNING_FLOC_SERVICE_IMPL_H_
|
#define CONTENT_BROWSER_FEDERATED_LEARNING_FLOC_SERVICE_IMPL_H_
|
||||||
|
|
||||||
#include "content/common/content_export.h"
|
#include "content/common/content_export.h"
|
||||||
#include "content/public/browser/frame_service_base.h"
|
#include "content/public/browser/document_service_base.h"
|
||||||
#include "mojo/public/cpp/bindings/pending_receiver.h"
|
#include "mojo/public/cpp/bindings/pending_receiver.h"
|
||||||
#include "third_party/blink/public/mojom/federated_learning/floc.mojom.h"
|
#include "third_party/blink/public/mojom/federated_learning/floc.mojom.h"
|
||||||
|
|
||||||
@@ -16,7 +16,7 @@ class RenderFrameHost;
|
|||||||
class RenderFrameHostImpl;
|
class RenderFrameHostImpl;
|
||||||
|
|
||||||
class CONTENT_EXPORT FlocServiceImpl final
|
class CONTENT_EXPORT FlocServiceImpl final
|
||||||
: public FrameServiceBase<blink::mojom::FlocService> {
|
: public DocumentServiceBase<blink::mojom::FlocService> {
|
||||||
public:
|
public:
|
||||||
FlocServiceImpl(RenderFrameHost* render_frame_host,
|
FlocServiceImpl(RenderFrameHost* render_frame_host,
|
||||||
mojo::PendingReceiver<blink::mojom::FlocService> receiver);
|
mojo::PendingReceiver<blink::mojom::FlocService> receiver);
|
||||||
@@ -29,7 +29,7 @@ class CONTENT_EXPORT FlocServiceImpl final
|
|||||||
void GetInterestCohort(GetInterestCohortCallback callback) override;
|
void GetInterestCohort(GetInterestCohortCallback callback) override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
// |this| can only be destroyed by FrameServiceBase.
|
// |this| can only be destroyed by DocumentServiceBase.
|
||||||
~FlocServiceImpl() override;
|
~FlocServiceImpl() override;
|
||||||
|
|
||||||
RenderFrameHostImpl* const render_frame_host_;
|
RenderFrameHostImpl* const render_frame_host_;
|
||||||
|
@@ -70,7 +70,7 @@ void RemoveProtectedReports(device::mojom::HidDeviceInfo& device) {
|
|||||||
|
|
||||||
HidService::HidService(RenderFrameHost* render_frame_host,
|
HidService::HidService(RenderFrameHost* render_frame_host,
|
||||||
mojo::PendingReceiver<blink::mojom::HidService> receiver)
|
mojo::PendingReceiver<blink::mojom::HidService> receiver)
|
||||||
: FrameServiceBase(render_frame_host, std::move(receiver)),
|
: DocumentServiceBase(render_frame_host, std::move(receiver)),
|
||||||
origin_(render_frame_host->GetMainFrame()->GetLastCommittedOrigin()) {
|
origin_(render_frame_host->GetMainFrame()->GetLastCommittedOrigin()) {
|
||||||
watchers_.set_disconnect_handler(
|
watchers_.set_disconnect_handler(
|
||||||
base::BindRepeating(&HidService::OnWatcherRemoved, base::Unretained(this),
|
base::BindRepeating(&HidService::OnWatcherRemoved, base::Unretained(this),
|
||||||
|
@@ -10,7 +10,7 @@
|
|||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
#include "base/memory/weak_ptr.h"
|
#include "base/memory/weak_ptr.h"
|
||||||
#include "content/public/browser/frame_service_base.h"
|
#include "content/public/browser/document_service_base.h"
|
||||||
#include "content/public/browser/hid_delegate.h"
|
#include "content/public/browser/hid_delegate.h"
|
||||||
#include "mojo/public/cpp/bindings/pending_receiver.h"
|
#include "mojo/public/cpp/bindings/pending_receiver.h"
|
||||||
#include "mojo/public/cpp/bindings/pending_remote.h"
|
#include "mojo/public/cpp/bindings/pending_remote.h"
|
||||||
@@ -26,9 +26,10 @@ class RenderFrameHost;
|
|||||||
|
|
||||||
// HidService provides an implementation of the HidService mojom interface. This
|
// HidService provides an implementation of the HidService mojom interface. This
|
||||||
// interface is used by Blink to implement the WebHID API.
|
// interface is used by Blink to implement the WebHID API.
|
||||||
class HidService : public content::FrameServiceBase<blink::mojom::HidService>,
|
class HidService
|
||||||
public device::mojom::HidConnectionWatcher,
|
: public content::DocumentServiceBase<blink::mojom::HidService>,
|
||||||
public HidDelegate::Observer {
|
public device::mojom::HidConnectionWatcher,
|
||||||
|
public HidDelegate::Observer {
|
||||||
public:
|
public:
|
||||||
HidService(HidService&) = delete;
|
HidService(HidService&) = delete;
|
||||||
HidService& operator=(HidService&) = delete;
|
HidService& operator=(HidService&) = delete;
|
||||||
|
@@ -151,7 +151,7 @@ void ImageCaptureImpl::TakePhoto(const std::string& source_id,
|
|||||||
ImageCaptureImpl::ImageCaptureImpl(
|
ImageCaptureImpl::ImageCaptureImpl(
|
||||||
RenderFrameHost* render_frame_host,
|
RenderFrameHost* render_frame_host,
|
||||||
mojo::PendingReceiver<media::mojom::ImageCapture> receiver)
|
mojo::PendingReceiver<media::mojom::ImageCapture> receiver)
|
||||||
: FrameServiceBase(render_frame_host, std::move(receiver)) {}
|
: DocumentServiceBase(render_frame_host, std::move(receiver)) {}
|
||||||
|
|
||||||
ImageCaptureImpl::~ImageCaptureImpl() = default;
|
ImageCaptureImpl::~ImageCaptureImpl() = default;
|
||||||
|
|
||||||
|
@@ -6,14 +6,14 @@
|
|||||||
#define CONTENT_BROWSER_IMAGE_CAPTURE_IMAGE_CAPTURE_IMPL_H_
|
#define CONTENT_BROWSER_IMAGE_CAPTURE_IMAGE_CAPTURE_IMPL_H_
|
||||||
|
|
||||||
#include "base/memory/weak_ptr.h"
|
#include "base/memory/weak_ptr.h"
|
||||||
#include "content/public/browser/frame_service_base.h"
|
#include "content/public/browser/document_service_base.h"
|
||||||
#include "media/capture/mojom/image_capture.mojom.h"
|
#include "media/capture/mojom/image_capture.mojom.h"
|
||||||
#include "mojo/public/cpp/bindings/pending_receiver.h"
|
#include "mojo/public/cpp/bindings/pending_receiver.h"
|
||||||
|
|
||||||
namespace content {
|
namespace content {
|
||||||
|
|
||||||
class ImageCaptureImpl final
|
class ImageCaptureImpl final
|
||||||
: public content::FrameServiceBase<media::mojom::ImageCapture> {
|
: public content::DocumentServiceBase<media::mojom::ImageCapture> {
|
||||||
public:
|
public:
|
||||||
static void Create(
|
static void Create(
|
||||||
RenderFrameHost* render_frame_host,
|
RenderFrameHost* render_frame_host,
|
||||||
|
@@ -130,7 +130,7 @@ bool IsAuctionValid(const blink::mojom::AuctionAdConfig& config) {
|
|||||||
AdAuctionServiceImpl::AdAuctionServiceImpl(
|
AdAuctionServiceImpl::AdAuctionServiceImpl(
|
||||||
RenderFrameHost* render_frame_host,
|
RenderFrameHost* render_frame_host,
|
||||||
mojo::PendingReceiver<blink::mojom::AdAuctionService> receiver)
|
mojo::PendingReceiver<blink::mojom::AdAuctionService> receiver)
|
||||||
: FrameServiceBase(render_frame_host, std::move(receiver)) {}
|
: DocumentServiceBase(render_frame_host, std::move(receiver)) {}
|
||||||
|
|
||||||
AdAuctionServiceImpl::~AdAuctionServiceImpl() = default;
|
AdAuctionServiceImpl::~AdAuctionServiceImpl() = default;
|
||||||
|
|
||||||
@@ -141,7 +141,7 @@ void AdAuctionServiceImpl::CreateMojoService(
|
|||||||
DCHECK(render_frame_host);
|
DCHECK(render_frame_host);
|
||||||
|
|
||||||
// The object is bound to the lifetime of `render_frame_host` and the mojo
|
// The object is bound to the lifetime of `render_frame_host` and the mojo
|
||||||
// connection. See FrameServiceBase for details.
|
// connection. See DocumentServiceBase for details.
|
||||||
new AdAuctionServiceImpl(render_frame_host, std::move(receiver));
|
new AdAuctionServiceImpl(render_frame_host, std::move(receiver));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -12,7 +12,7 @@
|
|||||||
#include "content/browser/interest_group/auction_runner.h"
|
#include "content/browser/interest_group/auction_runner.h"
|
||||||
#include "content/browser/interest_group/interest_group_manager.h"
|
#include "content/browser/interest_group/interest_group_manager.h"
|
||||||
#include "content/common/content_export.h"
|
#include "content/common/content_export.h"
|
||||||
#include "content/public/browser/frame_service_base.h"
|
#include "content/public/browser/document_service_base.h"
|
||||||
#include "content/services/auction_worklet/public/mojom/auction_worklet_service.mojom-forward.h"
|
#include "content/services/auction_worklet/public/mojom/auction_worklet_service.mojom-forward.h"
|
||||||
#include "mojo/public/cpp/bindings/pending_receiver.h"
|
#include "mojo/public/cpp/bindings/pending_receiver.h"
|
||||||
#include "mojo/public/cpp/bindings/remote.h"
|
#include "mojo/public/cpp/bindings/remote.h"
|
||||||
@@ -29,7 +29,7 @@ class RenderFrameHost;
|
|||||||
|
|
||||||
// Implements the AdAuctionService service called by Blink code.
|
// Implements the AdAuctionService service called by Blink code.
|
||||||
class CONTENT_EXPORT AdAuctionServiceImpl final
|
class CONTENT_EXPORT AdAuctionServiceImpl final
|
||||||
: public FrameServiceBase<blink::mojom::AdAuctionService>,
|
: public DocumentServiceBase<blink::mojom::AdAuctionService>,
|
||||||
public AuctionRunner::Delegate {
|
public AuctionRunner::Delegate {
|
||||||
public:
|
public:
|
||||||
// Factory method for creating an instance of this interface that is
|
// Factory method for creating an instance of this interface that is
|
||||||
@@ -47,17 +47,17 @@ class CONTENT_EXPORT AdAuctionServiceImpl final
|
|||||||
network::mojom::URLLoaderFactory* GetTrustedURLLoaderFactory() override;
|
network::mojom::URLLoaderFactory* GetTrustedURLLoaderFactory() override;
|
||||||
auction_worklet::mojom::AuctionWorkletService* GetWorkletService() override;
|
auction_worklet::mojom::AuctionWorkletService* GetWorkletService() override;
|
||||||
|
|
||||||
using FrameServiceBase::origin;
|
using DocumentServiceBase::origin;
|
||||||
using FrameServiceBase::render_frame_host;
|
using DocumentServiceBase::render_frame_host;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
// `render_frame_host` must not be null, and FrameServiceBase guarantees
|
// `render_frame_host` must not be null, and DocumentServiceBase guarantees
|
||||||
// `this` will not outlive the `render_frame_host`.
|
// `this` will not outlive the `render_frame_host`.
|
||||||
AdAuctionServiceImpl(
|
AdAuctionServiceImpl(
|
||||||
RenderFrameHost* render_frame_host,
|
RenderFrameHost* render_frame_host,
|
||||||
mojo::PendingReceiver<blink::mojom::AdAuctionService> receiver);
|
mojo::PendingReceiver<blink::mojom::AdAuctionService> receiver);
|
||||||
|
|
||||||
// `this` can only be destroyed by FrameServiceBase.
|
// `this` can only be destroyed by DocumentServiceBase.
|
||||||
~AdAuctionServiceImpl() override;
|
~AdAuctionServiceImpl() override;
|
||||||
|
|
||||||
// Deletes `auction`.
|
// Deletes `auction`.
|
||||||
|
@@ -42,7 +42,7 @@ bool IsUrlAllowed(const GURL& url, const blink::mojom::InterestGroup& group) {
|
|||||||
InterestGroupServiceImpl::InterestGroupServiceImpl(
|
InterestGroupServiceImpl::InterestGroupServiceImpl(
|
||||||
RenderFrameHost* render_frame_host,
|
RenderFrameHost* render_frame_host,
|
||||||
mojo::PendingReceiver<blink::mojom::RestrictedInterestGroupStore> receiver)
|
mojo::PendingReceiver<blink::mojom::RestrictedInterestGroupStore> receiver)
|
||||||
: FrameServiceBase(render_frame_host, std::move(receiver)),
|
: DocumentServiceBase(render_frame_host, std::move(receiver)),
|
||||||
interest_group_manager_(*static_cast<StoragePartitionImpl*>(
|
interest_group_manager_(*static_cast<StoragePartitionImpl*>(
|
||||||
render_frame_host->GetStoragePartition())
|
render_frame_host->GetStoragePartition())
|
||||||
->GetInterestGroupStorage()) {}
|
->GetInterestGroupStorage()) {}
|
||||||
@@ -55,7 +55,7 @@ void InterestGroupServiceImpl::CreateMojoService(
|
|||||||
DCHECK(render_frame_host);
|
DCHECK(render_frame_host);
|
||||||
|
|
||||||
// The object is bound to the lifetime of |render_frame_host| and the mojo
|
// The object is bound to the lifetime of |render_frame_host| and the mojo
|
||||||
// connection. See FrameServiceBase for details.
|
// connection. See DocumentServiceBase for details.
|
||||||
new InterestGroupServiceImpl(render_frame_host, std::move(receiver));
|
new InterestGroupServiceImpl(render_frame_host, std::move(receiver));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -7,7 +7,7 @@
|
|||||||
|
|
||||||
#include "content/browser/interest_group/interest_group_manager.h"
|
#include "content/browser/interest_group/interest_group_manager.h"
|
||||||
#include "content/common/content_export.h"
|
#include "content/common/content_export.h"
|
||||||
#include "content/public/browser/frame_service_base.h"
|
#include "content/public/browser/document_service_base.h"
|
||||||
#include "mojo/public/cpp/bindings/pending_receiver.h"
|
#include "mojo/public/cpp/bindings/pending_receiver.h"
|
||||||
#include "third_party/blink/public/mojom/interest_group/restricted_interest_group_store.mojom.h"
|
#include "third_party/blink/public/mojom/interest_group/restricted_interest_group_store.mojom.h"
|
||||||
|
|
||||||
@@ -17,7 +17,7 @@ class RenderFrameHost;
|
|||||||
|
|
||||||
// Implements the RestrictedInterestGroupStore service called by Blink code.
|
// Implements the RestrictedInterestGroupStore service called by Blink code.
|
||||||
class CONTENT_EXPORT InterestGroupServiceImpl final
|
class CONTENT_EXPORT InterestGroupServiceImpl final
|
||||||
: public FrameServiceBase<blink::mojom::RestrictedInterestGroupStore> {
|
: public DocumentServiceBase<blink::mojom::RestrictedInterestGroupStore> {
|
||||||
public:
|
public:
|
||||||
// Factory method for creating an instance of this interface that is bound
|
// Factory method for creating an instance of this interface that is bound
|
||||||
// to the lifetime of the frame or receiver (whichever is shorter).
|
// to the lifetime of the frame or receiver (whichever is shorter).
|
||||||
@@ -32,14 +32,14 @@ class CONTENT_EXPORT InterestGroupServiceImpl final
|
|||||||
const std::string& name) override;
|
const std::string& name) override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
// `render_frame_host` must not be null, and FrameServiceBase guarantees
|
// `render_frame_host` must not be null, and DocumentServiceBase guarantees
|
||||||
// `this` will not outlive the `render_frame_host`.
|
// `this` will not outlive the `render_frame_host`.
|
||||||
InterestGroupServiceImpl(
|
InterestGroupServiceImpl(
|
||||||
RenderFrameHost* render_frame_host,
|
RenderFrameHost* render_frame_host,
|
||||||
mojo::PendingReceiver<blink::mojom::RestrictedInterestGroupStore>
|
mojo::PendingReceiver<blink::mojom::RestrictedInterestGroupStore>
|
||||||
receiver);
|
receiver);
|
||||||
|
|
||||||
// `this` can only be destroyed by FrameServiceBase.
|
// `this` can only be destroyed by DocumentServiceBase.
|
||||||
~InterestGroupServiceImpl() override;
|
~InterestGroupServiceImpl() override;
|
||||||
|
|
||||||
InterestGroupManager& interest_group_manager_;
|
InterestGroupManager& interest_group_manager_;
|
||||||
|
@@ -40,7 +40,7 @@ void LogKeyboardLockMethodCalled(KeyboardLockMethods method) {
|
|||||||
KeyboardLockServiceImpl::KeyboardLockServiceImpl(
|
KeyboardLockServiceImpl::KeyboardLockServiceImpl(
|
||||||
RenderFrameHost* render_frame_host,
|
RenderFrameHost* render_frame_host,
|
||||||
mojo::PendingReceiver<blink::mojom::KeyboardLockService> receiver)
|
mojo::PendingReceiver<blink::mojom::KeyboardLockService> receiver)
|
||||||
: FrameServiceBase(render_frame_host, std::move(receiver)),
|
: DocumentServiceBase(render_frame_host, std::move(receiver)),
|
||||||
render_frame_host_(static_cast<RenderFrameHostImpl*>(render_frame_host)) {
|
render_frame_host_(static_cast<RenderFrameHostImpl*>(render_frame_host)) {
|
||||||
DCHECK(render_frame_host_);
|
DCHECK(render_frame_host_);
|
||||||
}
|
}
|
||||||
@@ -52,7 +52,7 @@ void KeyboardLockServiceImpl::CreateMojoService(
|
|||||||
DCHECK(render_frame_host);
|
DCHECK(render_frame_host);
|
||||||
|
|
||||||
// The object is bound to the lifetime of |render_frame_host| and the mojo
|
// The object is bound to the lifetime of |render_frame_host| and the mojo
|
||||||
// connection. See FrameServiceBase for details.
|
// connection. See DocumentServiceBase for details.
|
||||||
new KeyboardLockServiceImpl(render_frame_host, std::move(receiver));
|
new KeyboardLockServiceImpl(render_frame_host, std::move(receiver));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -9,7 +9,7 @@
|
|||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
#include "content/common/content_export.h"
|
#include "content/common/content_export.h"
|
||||||
#include "content/public/browser/frame_service_base.h"
|
#include "content/public/browser/document_service_base.h"
|
||||||
#include "mojo/public/cpp/bindings/pending_receiver.h"
|
#include "mojo/public/cpp/bindings/pending_receiver.h"
|
||||||
#include "third_party/blink/public/mojom/keyboard_lock/keyboard_lock.mojom.h"
|
#include "third_party/blink/public/mojom/keyboard_lock/keyboard_lock.mojom.h"
|
||||||
|
|
||||||
@@ -19,7 +19,7 @@ class RenderFrameHost;
|
|||||||
class RenderFrameHostImpl;
|
class RenderFrameHostImpl;
|
||||||
|
|
||||||
class CONTENT_EXPORT KeyboardLockServiceImpl final
|
class CONTENT_EXPORT KeyboardLockServiceImpl final
|
||||||
: public FrameServiceBase<blink::mojom::KeyboardLockService> {
|
: public DocumentServiceBase<blink::mojom::KeyboardLockService> {
|
||||||
public:
|
public:
|
||||||
KeyboardLockServiceImpl(
|
KeyboardLockServiceImpl(
|
||||||
RenderFrameHost* render_frame_host,
|
RenderFrameHost* render_frame_host,
|
||||||
@@ -36,7 +36,7 @@ class CONTENT_EXPORT KeyboardLockServiceImpl final
|
|||||||
void GetKeyboardLayoutMap(GetKeyboardLayoutMapCallback callback) override;
|
void GetKeyboardLayoutMap(GetKeyboardLayoutMapCallback callback) override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
// |this| can only be destroyed by FrameServiceBase.
|
// |this| can only be destroyed by DocumentServiceBase.
|
||||||
~KeyboardLockServiceImpl() override;
|
~KeyboardLockServiceImpl() override;
|
||||||
|
|
||||||
RenderFrameHostImpl* const render_frame_host_;
|
RenderFrameHostImpl* const render_frame_host_;
|
||||||
|
@@ -77,7 +77,7 @@ CdmStorageImpl::CdmStorageImpl(
|
|||||||
const std::string& cdm_file_system_id,
|
const std::string& cdm_file_system_id,
|
||||||
scoped_refptr<storage::FileSystemContext> file_system_context,
|
scoped_refptr<storage::FileSystemContext> file_system_context,
|
||||||
mojo::PendingReceiver<media::mojom::CdmStorage> receiver)
|
mojo::PendingReceiver<media::mojom::CdmStorage> receiver)
|
||||||
: FrameServiceBase(render_frame_host, std::move(receiver)),
|
: DocumentServiceBase(render_frame_host, std::move(receiver)),
|
||||||
cdm_file_system_id_(cdm_file_system_id),
|
cdm_file_system_id_(cdm_file_system_id),
|
||||||
file_system_context_(std::move(file_system_context)),
|
file_system_context_(std::move(file_system_context)),
|
||||||
child_process_id_(render_frame_host->GetProcess()->GetID()) {}
|
child_process_id_(render_frame_host->GetProcess()->GetID()) {}
|
||||||
|
@@ -14,7 +14,7 @@
|
|||||||
#include "base/memory/ref_counted.h"
|
#include "base/memory/ref_counted.h"
|
||||||
#include "base/memory/weak_ptr.h"
|
#include "base/memory/weak_ptr.h"
|
||||||
#include "content/common/content_export.h"
|
#include "content/common/content_export.h"
|
||||||
#include "content/public/browser/frame_service_base.h"
|
#include "content/public/browser/document_service_base.h"
|
||||||
#include "media/mojo/mojom/cdm_storage.mojom.h"
|
#include "media/mojo/mojom/cdm_storage.mojom.h"
|
||||||
#include "mojo/public/cpp/bindings/pending_receiver.h"
|
#include "mojo/public/cpp/bindings/pending_receiver.h"
|
||||||
#include "mojo/public/cpp/bindings/unique_associated_receiver_set.h"
|
#include "mojo/public/cpp/bindings/unique_associated_receiver_set.h"
|
||||||
@@ -31,7 +31,7 @@ class RenderFrameHost;
|
|||||||
// PluginPrivateFileSystem for backwards compatibility with CDMs running
|
// PluginPrivateFileSystem for backwards compatibility with CDMs running
|
||||||
// as a pepper plugin.
|
// as a pepper plugin.
|
||||||
class CONTENT_EXPORT CdmStorageImpl final
|
class CONTENT_EXPORT CdmStorageImpl final
|
||||||
: public content::FrameServiceBase<media::mojom::CdmStorage> {
|
: public content::DocumentServiceBase<media::mojom::CdmStorage> {
|
||||||
public:
|
public:
|
||||||
|
|
||||||
// Check if |cdm_file_system_id| is valid.
|
// Check if |cdm_file_system_id| is valid.
|
||||||
|
@@ -35,14 +35,14 @@ void AudioContextManagerImpl::Create(
|
|||||||
DCHECK(render_frame_host);
|
DCHECK(render_frame_host);
|
||||||
|
|
||||||
// The object is bound to the lifetime of |render_frame_host| and the mojo
|
// The object is bound to the lifetime of |render_frame_host| and the mojo
|
||||||
// connection. See FrameServiceBase for details.
|
// connection. See DocumentServiceBase for details.
|
||||||
new AudioContextManagerImpl(render_frame_host, std::move(receiver));
|
new AudioContextManagerImpl(render_frame_host, std::move(receiver));
|
||||||
}
|
}
|
||||||
|
|
||||||
AudioContextManagerImpl::AudioContextManagerImpl(
|
AudioContextManagerImpl::AudioContextManagerImpl(
|
||||||
RenderFrameHost* render_frame_host,
|
RenderFrameHost* render_frame_host,
|
||||||
mojo::PendingReceiver<blink::mojom::AudioContextManager> receiver)
|
mojo::PendingReceiver<blink::mojom::AudioContextManager> receiver)
|
||||||
: FrameServiceBase(render_frame_host, std::move(receiver)),
|
: DocumentServiceBase(render_frame_host, std::move(receiver)),
|
||||||
render_frame_host_impl_(
|
render_frame_host_impl_(
|
||||||
static_cast<RenderFrameHostImpl*>(render_frame_host)),
|
static_cast<RenderFrameHostImpl*>(render_frame_host)),
|
||||||
clock_(base::DefaultTickClock::GetInstance()) {
|
clock_(base::DefaultTickClock::GetInstance()) {
|
||||||
|
@@ -6,7 +6,7 @@
|
|||||||
#define CONTENT_BROWSER_MEDIA_WEBAUDIO_AUDIO_CONTEXT_MANAGER_IMPL_H_
|
#define CONTENT_BROWSER_MEDIA_WEBAUDIO_AUDIO_CONTEXT_MANAGER_IMPL_H_
|
||||||
|
|
||||||
#include "content/common/content_export.h"
|
#include "content/common/content_export.h"
|
||||||
#include "content/public/browser/frame_service_base.h"
|
#include "content/public/browser/document_service_base.h"
|
||||||
#include "mojo/public/cpp/bindings/pending_receiver.h"
|
#include "mojo/public/cpp/bindings/pending_receiver.h"
|
||||||
#include "third_party/blink/public/mojom/webaudio/audio_context_manager.mojom.h"
|
#include "third_party/blink/public/mojom/webaudio/audio_context_manager.mojom.h"
|
||||||
|
|
||||||
@@ -26,7 +26,7 @@ class RenderFrameHostImpl;
|
|||||||
// We do not expect to see more than 3~4 AudioContexts per render frame, so
|
// We do not expect to see more than 3~4 AudioContexts per render frame, so
|
||||||
// handling multiple contexts would not be a significant bottle neck.
|
// handling multiple contexts would not be a significant bottle neck.
|
||||||
class CONTENT_EXPORT AudioContextManagerImpl final
|
class CONTENT_EXPORT AudioContextManagerImpl final
|
||||||
: public content::FrameServiceBase<blink::mojom::AudioContextManager> {
|
: public content::DocumentServiceBase<blink::mojom::AudioContextManager> {
|
||||||
public:
|
public:
|
||||||
explicit AudioContextManagerImpl(
|
explicit AudioContextManagerImpl(
|
||||||
RenderFrameHost* render_frame_host,
|
RenderFrameHost* render_frame_host,
|
||||||
|
@@ -65,7 +65,7 @@ void PictureInPictureServiceImpl::StartSession(
|
|||||||
PictureInPictureServiceImpl::PictureInPictureServiceImpl(
|
PictureInPictureServiceImpl::PictureInPictureServiceImpl(
|
||||||
RenderFrameHost* render_frame_host,
|
RenderFrameHost* render_frame_host,
|
||||||
mojo::PendingReceiver<blink::mojom::PictureInPictureService> receiver)
|
mojo::PendingReceiver<blink::mojom::PictureInPictureService> receiver)
|
||||||
: FrameServiceBase(render_frame_host, std::move(receiver)) {}
|
: DocumentServiceBase(render_frame_host, std::move(receiver)) {}
|
||||||
|
|
||||||
PictureInPictureServiceImpl::~PictureInPictureServiceImpl() {
|
PictureInPictureServiceImpl::~PictureInPictureServiceImpl() {
|
||||||
// If the service is destroyed because the frame was destroyed, the session
|
// If the service is destroyed because the frame was destroyed, the session
|
||||||
|
@@ -6,7 +6,7 @@
|
|||||||
#define CONTENT_BROWSER_PICTURE_IN_PICTURE_PICTURE_IN_PICTURE_SERVICE_IMPL_H_
|
#define CONTENT_BROWSER_PICTURE_IN_PICTURE_PICTURE_IN_PICTURE_SERVICE_IMPL_H_
|
||||||
|
|
||||||
#include "content/common/content_export.h"
|
#include "content/common/content_export.h"
|
||||||
#include "content/public/browser/frame_service_base.h"
|
#include "content/public/browser/document_service_base.h"
|
||||||
#include "media/mojo/mojom/media_player.mojom.h"
|
#include "media/mojo/mojom/media_player.mojom.h"
|
||||||
#include "mojo/public/cpp/bindings/pending_associated_remote.h"
|
#include "mojo/public/cpp/bindings/pending_associated_remote.h"
|
||||||
#include "mojo/public/cpp/bindings/pending_receiver.h"
|
#include "mojo/public/cpp/bindings/pending_receiver.h"
|
||||||
@@ -24,9 +24,10 @@ class PictureInPictureWindowControllerImpl;
|
|||||||
// killed given that the PictureInPictureWindowControllerImpl is
|
// killed given that the PictureInPictureWindowControllerImpl is
|
||||||
// WebContents-bound instead of RenderFrameHost.
|
// WebContents-bound instead of RenderFrameHost.
|
||||||
// PictureInPictureServiceImpl owns itself. It self-destruct as needed, see the
|
// PictureInPictureServiceImpl owns itself. It self-destruct as needed, see the
|
||||||
// FrameServiceBase's documentation for more information.
|
// DocumentServiceBase's documentation for more information.
|
||||||
class CONTENT_EXPORT PictureInPictureServiceImpl final
|
class CONTENT_EXPORT PictureInPictureServiceImpl final
|
||||||
: public content::FrameServiceBase<blink::mojom::PictureInPictureService> {
|
: public content::DocumentServiceBase<
|
||||||
|
blink::mojom::PictureInPictureService> {
|
||||||
public:
|
public:
|
||||||
static void Create(
|
static void Create(
|
||||||
RenderFrameHost*,
|
RenderFrameHost*,
|
||||||
|
@@ -2,7 +2,7 @@
|
|||||||
// Use of this source code is governed by a BSD-style license that can be
|
// Use of this source code is governed by a BSD-style license that can be
|
||||||
// found in the LICENSE file.
|
// found in the LICENSE file.
|
||||||
|
|
||||||
#include "content/public/browser/frame_service_base.h"
|
#include "content/public/browser/document_service_base.h"
|
||||||
|
|
||||||
#include "base/bind.h"
|
#include "base/bind.h"
|
||||||
#include "base/run_loop.h"
|
#include "base/run_loop.h"
|
||||||
@@ -17,7 +17,7 @@
|
|||||||
#include "mojo/public/cpp/bindings/remote.h"
|
#include "mojo/public/cpp/bindings/remote.h"
|
||||||
#include "url/gurl.h"
|
#include "url/gurl.h"
|
||||||
|
|
||||||
// Unit test for FrameServiceBase in content/public/browser.
|
// Unit test for DocumentServiceBase in content/public/browser.
|
||||||
|
|
||||||
namespace content {
|
namespace content {
|
||||||
|
|
||||||
@@ -26,13 +26,13 @@ namespace {
|
|||||||
const char kFooOrigin[] = "https://foo.com";
|
const char kFooOrigin[] = "https://foo.com";
|
||||||
const char kBarOrigin[] = "https://bar.com";
|
const char kBarOrigin[] = "https://bar.com";
|
||||||
|
|
||||||
// Subclass of FrameServiceBase for test.
|
// Subclass of DocumentServiceBase for test.
|
||||||
class EchoImpl final : public FrameServiceBase<mojom::Echo> {
|
class EchoImpl final : public DocumentServiceBase<mojom::Echo> {
|
||||||
public:
|
public:
|
||||||
EchoImpl(RenderFrameHost* render_frame_host,
|
EchoImpl(RenderFrameHost* render_frame_host,
|
||||||
mojo::PendingReceiver<mojom::Echo> receiver,
|
mojo::PendingReceiver<mojom::Echo> receiver,
|
||||||
base::OnceClosure destruction_cb)
|
base::OnceClosure destruction_cb)
|
||||||
: FrameServiceBase(render_frame_host, std::move(receiver)),
|
: DocumentServiceBase(render_frame_host, std::move(receiver)),
|
||||||
destruction_cb_(std::move(destruction_cb)) {}
|
destruction_cb_(std::move(destruction_cb)) {}
|
||||||
~EchoImpl() final { std::move(destruction_cb_).Run(); }
|
~EchoImpl() final { std::move(destruction_cb_).Run(); }
|
||||||
|
|
||||||
@@ -67,7 +67,7 @@ void DetachFrame(RenderFrameHost* rfh) {
|
|||||||
|
|
||||||
} // namespace
|
} // namespace
|
||||||
|
|
||||||
class FrameServiceBaseTest : public RenderViewHostTestHarness {
|
class DocumentServiceBaseTest : public RenderViewHostTestHarness {
|
||||||
protected:
|
protected:
|
||||||
void SetUp() final {
|
void SetUp() final {
|
||||||
RenderViewHostTestHarness::SetUp();
|
RenderViewHostTestHarness::SetUp();
|
||||||
@@ -83,7 +83,7 @@ class FrameServiceBaseTest : public RenderViewHostTestHarness {
|
|||||||
void CreateEchoImpl(RenderFrameHost* rfh) {
|
void CreateEchoImpl(RenderFrameHost* rfh) {
|
||||||
DCHECK(!is_echo_impl_alive_);
|
DCHECK(!is_echo_impl_alive_);
|
||||||
new EchoImpl(rfh, echo_remote_.BindNewPipeAndPassReceiver(),
|
new EchoImpl(rfh, echo_remote_.BindNewPipeAndPassReceiver(),
|
||||||
base::BindOnce(&FrameServiceBaseTest::OnEchoImplDestructed,
|
base::BindOnce(&DocumentServiceBaseTest::OnEchoImplDestructed,
|
||||||
base::Unretained(this)));
|
base::Unretained(this)));
|
||||||
is_echo_impl_alive_ = true;
|
is_echo_impl_alive_ = true;
|
||||||
}
|
}
|
||||||
@@ -103,13 +103,13 @@ class FrameServiceBaseTest : public RenderViewHostTestHarness {
|
|||||||
bool is_echo_impl_alive_ = false;
|
bool is_echo_impl_alive_ = false;
|
||||||
};
|
};
|
||||||
|
|
||||||
TEST_F(FrameServiceBaseTest, ConnectionError) {
|
TEST_F(DocumentServiceBaseTest, ConnectionError) {
|
||||||
CreateEchoImpl(main_rfh_);
|
CreateEchoImpl(main_rfh_);
|
||||||
ResetConnection();
|
ResetConnection();
|
||||||
EXPECT_FALSE(is_echo_impl_alive_);
|
EXPECT_FALSE(is_echo_impl_alive_);
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_F(FrameServiceBaseTest, RenderFrameDeleted) {
|
TEST_F(DocumentServiceBaseTest, RenderFrameDeleted) {
|
||||||
// Needs to create a child frame so we can delete it using DetachFrame()
|
// Needs to create a child frame so we can delete it using DetachFrame()
|
||||||
// because it is not allowed to detach the main frame.
|
// because it is not allowed to detach the main frame.
|
||||||
RenderFrameHost* child_rfh = AddChildFrame(main_rfh_, GURL(kBarOrigin));
|
RenderFrameHost* child_rfh = AddChildFrame(main_rfh_, GURL(kBarOrigin));
|
||||||
@@ -118,7 +118,7 @@ TEST_F(FrameServiceBaseTest, RenderFrameDeleted) {
|
|||||||
EXPECT_FALSE(is_echo_impl_alive_);
|
EXPECT_FALSE(is_echo_impl_alive_);
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_F(FrameServiceBaseTest, DidFinishNavigation) {
|
TEST_F(DocumentServiceBaseTest, DidFinishNavigation) {
|
||||||
// When a page enters the BackForwardCache, the RenderFrameHost is not
|
// When a page enters the BackForwardCache, the RenderFrameHost is not
|
||||||
// deleted.
|
// deleted.
|
||||||
web_contents()->GetController().GetBackForwardCache().DisableForTesting(
|
web_contents()->GetController().GetBackForwardCache().DisableForTesting(
|
||||||
@@ -128,7 +128,7 @@ TEST_F(FrameServiceBaseTest, DidFinishNavigation) {
|
|||||||
EXPECT_FALSE(is_echo_impl_alive_);
|
EXPECT_FALSE(is_echo_impl_alive_);
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_F(FrameServiceBaseTest, SameDocumentNavigation) {
|
TEST_F(DocumentServiceBaseTest, SameDocumentNavigation) {
|
||||||
CreateEchoImpl(main_rfh_);
|
CreateEchoImpl(main_rfh_);
|
||||||
|
|
||||||
// Must use the same origin to simulate same document navigation.
|
// Must use the same origin to simulate same document navigation.
|
||||||
@@ -140,7 +140,7 @@ TEST_F(FrameServiceBaseTest, SameDocumentNavigation) {
|
|||||||
EXPECT_TRUE(is_echo_impl_alive_);
|
EXPECT_TRUE(is_echo_impl_alive_);
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_F(FrameServiceBaseTest, FailedNavigation) {
|
TEST_F(DocumentServiceBaseTest, FailedNavigation) {
|
||||||
CreateEchoImpl(main_rfh_);
|
CreateEchoImpl(main_rfh_);
|
||||||
|
|
||||||
auto navigation_simulator =
|
auto navigation_simulator =
|
||||||
@@ -151,7 +151,7 @@ TEST_F(FrameServiceBaseTest, FailedNavigation) {
|
|||||||
EXPECT_FALSE(is_echo_impl_alive_);
|
EXPECT_FALSE(is_echo_impl_alive_);
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_F(FrameServiceBaseTest, DeleteContents) {
|
TEST_F(DocumentServiceBaseTest, DeleteContents) {
|
||||||
CreateEchoImpl(main_rfh_);
|
CreateEchoImpl(main_rfh_);
|
||||||
DeleteContents();
|
DeleteContents();
|
||||||
EXPECT_FALSE(is_echo_impl_alive_);
|
EXPECT_FALSE(is_echo_impl_alive_);
|
@@ -88,7 +88,7 @@ WebOTPService::WebOTPService(
|
|||||||
const OriginList& origin_list,
|
const OriginList& origin_list,
|
||||||
RenderFrameHost* host,
|
RenderFrameHost* host,
|
||||||
mojo::PendingReceiver<blink::mojom::WebOTPService> receiver)
|
mojo::PendingReceiver<blink::mojom::WebOTPService> receiver)
|
||||||
: FrameServiceBase(host, std::move(receiver)),
|
: DocumentServiceBase(host, std::move(receiver)),
|
||||||
fetcher_(fetcher),
|
fetcher_(fetcher),
|
||||||
origin_list_(origin_list),
|
origin_list_(origin_list),
|
||||||
timeout_timer_(FROM_HERE,
|
timeout_timer_(FROM_HERE,
|
||||||
|
@@ -17,7 +17,7 @@
|
|||||||
#include "content/browser/sms/sms_queue.h"
|
#include "content/browser/sms/sms_queue.h"
|
||||||
#include "content/browser/sms/user_consent_handler.h"
|
#include "content/browser/sms/user_consent_handler.h"
|
||||||
#include "content/common/content_export.h"
|
#include "content/common/content_export.h"
|
||||||
#include "content/public/browser/frame_service_base.h"
|
#include "content/public/browser/document_service_base.h"
|
||||||
#include "mojo/public/cpp/bindings/pending_receiver.h"
|
#include "mojo/public/cpp/bindings/pending_receiver.h"
|
||||||
#include "third_party/blink/public/mojom/sms/webotp_service.mojom.h"
|
#include "third_party/blink/public/mojom/sms/webotp_service.mojom.h"
|
||||||
#include "url/origin.h"
|
#include "url/origin.h"
|
||||||
@@ -31,11 +31,11 @@ struct LoadCommittedDetails;
|
|||||||
// WebOTPService handles mojo connections from the renderer, observing the
|
// WebOTPService handles mojo connections from the renderer, observing the
|
||||||
// incoming SMS messages from an SmsFetcher. In practice, it is owned and
|
// incoming SMS messages from an SmsFetcher. In practice, it is owned and
|
||||||
// managed by a RenderFrameHost. It accomplishes that via subclassing
|
// managed by a RenderFrameHost. It accomplishes that via subclassing
|
||||||
// FrameServiceBase, which observes the lifecycle of a RenderFrameHost and
|
// DocumentServiceBase, which observes the lifecycle of a RenderFrameHost and
|
||||||
// manages it own memory. Create() creates a self-managed instance of
|
// manages it own memory. Create() creates a self-managed instance of
|
||||||
// WebOTPService and binds it to the request.
|
// WebOTPService and binds it to the request.
|
||||||
class CONTENT_EXPORT WebOTPService
|
class CONTENT_EXPORT WebOTPService
|
||||||
: public FrameServiceBase<blink::mojom::WebOTPService>,
|
: public DocumentServiceBase<blink::mojom::WebOTPService>,
|
||||||
public SmsFetcher::Subscriber {
|
public SmsFetcher::Subscriber {
|
||||||
public:
|
public:
|
||||||
// Return value indicates success. Creation can fail if origin requirements
|
// Return value indicates success. Creation can fail if origin requirements
|
||||||
|
@@ -50,14 +50,14 @@ void SpeculationHostImpl::Bind(
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// FrameServiceBase will destroy this on pipe closure or frame destruction.
|
// DocumentServiceBase will destroy this on pipe closure or frame destruction.
|
||||||
new SpeculationHostImpl(frame_host, std::move(receiver));
|
new SpeculationHostImpl(frame_host, std::move(receiver));
|
||||||
}
|
}
|
||||||
|
|
||||||
SpeculationHostImpl::SpeculationHostImpl(
|
SpeculationHostImpl::SpeculationHostImpl(
|
||||||
RenderFrameHost* frame_host,
|
RenderFrameHost* frame_host,
|
||||||
mojo::PendingReceiver<blink::mojom::SpeculationHost> receiver)
|
mojo::PendingReceiver<blink::mojom::SpeculationHost> receiver)
|
||||||
: FrameServiceBase(frame_host, std::move(receiver)) {
|
: DocumentServiceBase(frame_host, std::move(receiver)) {
|
||||||
DCHECK_CURRENTLY_ON(content::BrowserThread::UI);
|
DCHECK_CURRENTLY_ON(content::BrowserThread::UI);
|
||||||
delegate_ = GetContentClient()->browser()->CreateSpeculationHostDelegate(
|
delegate_ = GetContentClient()->browser()->CreateSpeculationHostDelegate(
|
||||||
*render_frame_host());
|
*render_frame_host());
|
||||||
|
@@ -8,7 +8,7 @@
|
|||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
#include "content/common/content_export.h"
|
#include "content/common/content_export.h"
|
||||||
#include "content/public/browser/frame_service_base.h"
|
#include "content/public/browser/document_service_base.h"
|
||||||
#include "content/public/browser/speculation_host_delegate.h"
|
#include "content/public/browser/speculation_host_delegate.h"
|
||||||
#include "mojo/public/cpp/bindings/pending_receiver.h"
|
#include "mojo/public/cpp/bindings/pending_receiver.h"
|
||||||
#include "third_party/blink/public/mojom/speculation_rules/speculation_rules.mojom.h"
|
#include "third_party/blink/public/mojom/speculation_rules/speculation_rules.mojom.h"
|
||||||
@@ -20,7 +20,7 @@ class PrerenderProcessor;
|
|||||||
// Receiver for speculation rules from the web platform. See
|
// Receiver for speculation rules from the web platform. See
|
||||||
// third_party/blink/renderer/core/speculation_rules/README.md
|
// third_party/blink/renderer/core/speculation_rules/README.md
|
||||||
class CONTENT_EXPORT SpeculationHostImpl final
|
class CONTENT_EXPORT SpeculationHostImpl final
|
||||||
: public content::FrameServiceBase<blink::mojom::SpeculationHost> {
|
: public content::DocumentServiceBase<blink::mojom::SpeculationHost> {
|
||||||
public:
|
public:
|
||||||
// Creates and binds an instance of this per-frame.
|
// Creates and binds an instance of this per-frame.
|
||||||
static void Bind(
|
static void Bind(
|
||||||
|
@@ -36,6 +36,6 @@ void WakeLockServiceImpl::GetWakeLock(
|
|||||||
WakeLockServiceImpl::WakeLockServiceImpl(
|
WakeLockServiceImpl::WakeLockServiceImpl(
|
||||||
RenderFrameHost* render_frame_host,
|
RenderFrameHost* render_frame_host,
|
||||||
mojo::PendingReceiver<blink::mojom::WakeLockService> receiver)
|
mojo::PendingReceiver<blink::mojom::WakeLockService> receiver)
|
||||||
: FrameServiceBase(render_frame_host, std::move(receiver)) {}
|
: DocumentServiceBase(render_frame_host, std::move(receiver)) {}
|
||||||
|
|
||||||
} // namespace content
|
} // namespace content
|
||||||
|
@@ -5,14 +5,14 @@
|
|||||||
#ifndef CONTENT_BROWSER_WAKE_LOCK_WAKE_LOCK_SERVICE_IMPL_H_
|
#ifndef CONTENT_BROWSER_WAKE_LOCK_WAKE_LOCK_SERVICE_IMPL_H_
|
||||||
#define CONTENT_BROWSER_WAKE_LOCK_WAKE_LOCK_SERVICE_IMPL_H_
|
#define CONTENT_BROWSER_WAKE_LOCK_WAKE_LOCK_SERVICE_IMPL_H_
|
||||||
|
|
||||||
#include "content/public/browser/frame_service_base.h"
|
#include "content/public/browser/document_service_base.h"
|
||||||
#include "mojo/public/cpp/bindings/pending_receiver.h"
|
#include "mojo/public/cpp/bindings/pending_receiver.h"
|
||||||
#include "third_party/blink/public/mojom/wake_lock/wake_lock.mojom.h"
|
#include "third_party/blink/public/mojom/wake_lock/wake_lock.mojom.h"
|
||||||
|
|
||||||
namespace content {
|
namespace content {
|
||||||
|
|
||||||
class WakeLockServiceImpl final
|
class WakeLockServiceImpl final
|
||||||
: public FrameServiceBase<blink::mojom::WakeLockService> {
|
: public DocumentServiceBase<blink::mojom::WakeLockService> {
|
||||||
public:
|
public:
|
||||||
static void Create(RenderFrameHost*,
|
static void Create(RenderFrameHost*,
|
||||||
mojo::PendingReceiver<blink::mojom::WakeLockService>);
|
mojo::PendingReceiver<blink::mojom::WakeLockService>);
|
||||||
|
@@ -10,7 +10,7 @@
|
|||||||
|
|
||||||
#include "base/timer/timer.h"
|
#include "base/timer/timer.h"
|
||||||
#include "content/browser/webauth/authenticator_common.h"
|
#include "content/browser/webauth/authenticator_common.h"
|
||||||
#include "content/public/browser/frame_service_base.h"
|
#include "content/public/browser/document_service_base.h"
|
||||||
#include "content/public/browser/navigation_handle.h"
|
#include "content/public/browser/navigation_handle.h"
|
||||||
#include "content/public/browser/render_frame_host.h"
|
#include "content/public/browser/render_frame_host.h"
|
||||||
#include "content/public/browser/web_contents.h"
|
#include "content/public/browser/web_contents.h"
|
||||||
@@ -28,7 +28,7 @@ void AuthenticatorImpl::Create(
|
|||||||
}
|
}
|
||||||
|
|
||||||
// AuthenticatorImpl owns itself. It self-destructs when the RenderFrameHost
|
// AuthenticatorImpl owns itself. It self-destructs when the RenderFrameHost
|
||||||
// navigates or is deleted. See FrameServiceBase for details.
|
// navigates or is deleted. See DocumentServiceBase for details.
|
||||||
DCHECK(render_frame_host);
|
DCHECK(render_frame_host);
|
||||||
new AuthenticatorImpl(
|
new AuthenticatorImpl(
|
||||||
render_frame_host, std::move(receiver),
|
render_frame_host, std::move(receiver),
|
||||||
@@ -39,7 +39,7 @@ AuthenticatorImpl::AuthenticatorImpl(
|
|||||||
RenderFrameHost* render_frame_host,
|
RenderFrameHost* render_frame_host,
|
||||||
mojo::PendingReceiver<blink::mojom::Authenticator> receiver,
|
mojo::PendingReceiver<blink::mojom::Authenticator> receiver,
|
||||||
std::unique_ptr<AuthenticatorCommon> authenticator_common)
|
std::unique_ptr<AuthenticatorCommon> authenticator_common)
|
||||||
: FrameServiceBase(render_frame_host, std::move(receiver)),
|
: DocumentServiceBase(render_frame_host, std::move(receiver)),
|
||||||
authenticator_common_(std::move(authenticator_common)) {
|
authenticator_common_(std::move(authenticator_common)) {
|
||||||
DCHECK(authenticator_common_);
|
DCHECK(authenticator_common_);
|
||||||
}
|
}
|
||||||
|
@@ -11,7 +11,7 @@
|
|||||||
|
|
||||||
#include "base/macros.h"
|
#include "base/macros.h"
|
||||||
#include "content/common/content_export.h"
|
#include "content/common/content_export.h"
|
||||||
#include "content/public/browser/frame_service_base.h"
|
#include "content/public/browser/document_service_base.h"
|
||||||
#include "mojo/public/cpp/bindings/pending_receiver.h"
|
#include "mojo/public/cpp/bindings/pending_receiver.h"
|
||||||
#include "mojo/public/cpp/bindings/receiver.h"
|
#include "mojo/public/cpp/bindings/receiver.h"
|
||||||
#include "third_party/blink/public/mojom/webauthn/authenticator.mojom.h"
|
#include "third_party/blink/public/mojom/webauthn/authenticator.mojom.h"
|
||||||
@@ -41,7 +41,7 @@ class RenderFrameHost;
|
|||||||
|
|
||||||
// Implementation of the public Authenticator interface.
|
// Implementation of the public Authenticator interface.
|
||||||
class CONTENT_EXPORT AuthenticatorImpl
|
class CONTENT_EXPORT AuthenticatorImpl
|
||||||
: public FrameServiceBase<blink::mojom::Authenticator> {
|
: public DocumentServiceBase<blink::mojom::Authenticator> {
|
||||||
public:
|
public:
|
||||||
static void Create(
|
static void Create(
|
||||||
RenderFrameHost* render_frame_host,
|
RenderFrameHost* render_frame_host,
|
||||||
|
@@ -25,7 +25,7 @@ namespace content {
|
|||||||
FederatedAuthRequestImpl::FederatedAuthRequestImpl(
|
FederatedAuthRequestImpl::FederatedAuthRequestImpl(
|
||||||
RenderFrameHost* host,
|
RenderFrameHost* host,
|
||||||
mojo::PendingReceiver<blink::mojom::FederatedAuthRequest> receiver)
|
mojo::PendingReceiver<blink::mojom::FederatedAuthRequest> receiver)
|
||||||
: FrameServiceBase(host, std::move(receiver)) {}
|
: DocumentServiceBase(host, std::move(receiver)) {}
|
||||||
|
|
||||||
FederatedAuthRequestImpl::~FederatedAuthRequestImpl() {
|
FederatedAuthRequestImpl::~FederatedAuthRequestImpl() {
|
||||||
// Ensures key data members are destructed in proper order and resolves any
|
// Ensures key data members are destructed in proper order and resolves any
|
||||||
@@ -43,7 +43,7 @@ void FederatedAuthRequestImpl::Create(
|
|||||||
// the mojo method is invoked, causing the promise to be rejected.
|
// the mojo method is invoked, causing the promise to be rejected.
|
||||||
// https://crbug.com/1141125
|
// https://crbug.com/1141125
|
||||||
// It is safe to access host->GetLastCommittedOrigin during construction
|
// It is safe to access host->GetLastCommittedOrigin during construction
|
||||||
// but FrameServiceBase::origin() should be used thereafter.
|
// but DocumentServiceBase::origin() should be used thereafter.
|
||||||
if (!IsSameOriginWithAncestors(host, host->GetLastCommittedOrigin())) {
|
if (!IsSameOriginWithAncestors(host, host->GetLastCommittedOrigin())) {
|
||||||
mojo::ReportBadMessage(
|
mojo::ReportBadMessage(
|
||||||
"navigator.id.get cannot be invoked from within cross-origin iframes.");
|
"navigator.id.get cannot be invoked from within cross-origin iframes.");
|
||||||
|
@@ -13,7 +13,7 @@
|
|||||||
#include "base/macros.h"
|
#include "base/macros.h"
|
||||||
#include "content/browser/webid/idp_network_request_manager.h"
|
#include "content/browser/webid/idp_network_request_manager.h"
|
||||||
#include "content/common/content_export.h"
|
#include "content/common/content_export.h"
|
||||||
#include "content/public/browser/frame_service_base.h"
|
#include "content/public/browser/document_service_base.h"
|
||||||
#include "content/public/browser/identity_request_dialog_controller.h"
|
#include "content/public/browser/identity_request_dialog_controller.h"
|
||||||
#include "mojo/public/cpp/bindings/pending_receiver.h"
|
#include "mojo/public/cpp/bindings/pending_receiver.h"
|
||||||
#include "third_party/blink/public/mojom/webid/federated_auth_request.mojom.h"
|
#include "third_party/blink/public/mojom/webid/federated_auth_request.mojom.h"
|
||||||
@@ -29,12 +29,12 @@ class RenderFrameHost;
|
|||||||
// fulfill WebID-related requests.
|
// fulfill WebID-related requests.
|
||||||
//
|
//
|
||||||
// In practice, it is owned and managed by a RenderFrameHost. It accomplishes
|
// In practice, it is owned and managed by a RenderFrameHost. It accomplishes
|
||||||
// that via subclassing FrameServiceBase, which observes the lifecycle of a
|
// that via subclassing DocumentServiceBase, which observes the lifecycle of a
|
||||||
// RenderFrameHost and manages its own memory.
|
// RenderFrameHost and manages its own memory.
|
||||||
// Create() creates a self-managed instance of FederatedAuthRequestImpl and
|
// Create() creates a self-managed instance of FederatedAuthRequestImpl and
|
||||||
// binds it to the receiver.
|
// binds it to the receiver.
|
||||||
class CONTENT_EXPORT FederatedAuthRequestImpl
|
class CONTENT_EXPORT FederatedAuthRequestImpl
|
||||||
: public FrameServiceBase<blink::mojom::FederatedAuthRequest> {
|
: public DocumentServiceBase<blink::mojom::FederatedAuthRequest> {
|
||||||
public:
|
public:
|
||||||
static void Create(RenderFrameHost*,
|
static void Create(RenderFrameHost*,
|
||||||
mojo::PendingReceiver<blink::mojom::FederatedAuthRequest>);
|
mojo::PendingReceiver<blink::mojom::FederatedAuthRequest>);
|
||||||
|
@@ -18,7 +18,7 @@ namespace content {
|
|||||||
FederatedAuthResponseImpl::FederatedAuthResponseImpl(
|
FederatedAuthResponseImpl::FederatedAuthResponseImpl(
|
||||||
RenderFrameHost* host,
|
RenderFrameHost* host,
|
||||||
mojo::PendingReceiver<blink::mojom::FederatedAuthResponse> receiver)
|
mojo::PendingReceiver<blink::mojom::FederatedAuthResponse> receiver)
|
||||||
: FrameServiceBase(host, std::move(receiver)) {}
|
: DocumentServiceBase(host, std::move(receiver)) {}
|
||||||
|
|
||||||
// TODO(majidvp): We should reject any pending promise here.
|
// TODO(majidvp): We should reject any pending promise here.
|
||||||
// http://crbug.com/1141125
|
// http://crbug.com/1141125
|
||||||
@@ -34,7 +34,7 @@ void FederatedAuthResponseImpl::Create(
|
|||||||
// the mojo method is invoked, causing the promise to be rejected.
|
// the mojo method is invoked, causing the promise to be rejected.
|
||||||
// https://crbug.com/1141125
|
// https://crbug.com/1141125
|
||||||
// It is safe to access host->GetLastCommittedOrigin during construction
|
// It is safe to access host->GetLastCommittedOrigin during construction
|
||||||
// but FrameServiceBase::origin() should be used thereafter.
|
// but DocumentServiceBase::origin() should be used thereafter.
|
||||||
if (!IsSameOriginWithAncestors(host, host->GetLastCommittedOrigin())) {
|
if (!IsSameOriginWithAncestors(host, host->GetLastCommittedOrigin())) {
|
||||||
mojo::ReportBadMessage(
|
mojo::ReportBadMessage(
|
||||||
"WebID cannot be invoked from within cross-origin iframes.");
|
"WebID cannot be invoked from within cross-origin iframes.");
|
||||||
|
@@ -11,7 +11,7 @@
|
|||||||
#include "base/callback_forward.h"
|
#include "base/callback_forward.h"
|
||||||
#include "base/macros.h"
|
#include "base/macros.h"
|
||||||
#include "content/common/content_export.h"
|
#include "content/common/content_export.h"
|
||||||
#include "content/public/browser/frame_service_base.h"
|
#include "content/public/browser/document_service_base.h"
|
||||||
#include "mojo/public/cpp/bindings/pending_receiver.h"
|
#include "mojo/public/cpp/bindings/pending_receiver.h"
|
||||||
#include "third_party/blink/public/mojom/webid/federated_auth_response.mojom.h"
|
#include "third_party/blink/public/mojom/webid/federated_auth_response.mojom.h"
|
||||||
|
|
||||||
@@ -22,7 +22,7 @@ class RenderFrameHost;
|
|||||||
// FederatedAuthResponseImpl handles mojo connections from the renderer to
|
// FederatedAuthResponseImpl handles mojo connections from the renderer to
|
||||||
// fulfill WebID-related response by an IDP.
|
// fulfill WebID-related response by an IDP.
|
||||||
class FederatedAuthResponseImpl
|
class FederatedAuthResponseImpl
|
||||||
: public FrameServiceBase<blink::mojom::FederatedAuthResponse> {
|
: public DocumentServiceBase<blink::mojom::FederatedAuthResponse> {
|
||||||
public:
|
public:
|
||||||
// Creates a self-managed instance of FederatedAuthResponseImpl and binds it
|
// Creates a self-managed instance of FederatedAuthResponseImpl and binds it
|
||||||
// to the receiver.
|
// to the receiver.
|
||||||
|
@@ -14,8 +14,8 @@ class RenderFrameHost;
|
|||||||
// Determines whether |host| is same-origin with all of its ancestors in the
|
// Determines whether |host| is same-origin with all of its ancestors in the
|
||||||
// frame tree. Returns false if not.
|
// frame tree. Returns false if not.
|
||||||
// |origin| is provided because it is not considered safe to use
|
// |origin| is provided because it is not considered safe to use
|
||||||
// host->GetLastCommittedOrigin() at some times, so FrameServiceBase::origin()
|
// host->GetLastCommittedOrigin() at some times, so
|
||||||
// should be used to obtain the frame's origin.
|
// DocumentServiceBase::origin() should be used to obtain the frame's origin.
|
||||||
bool IsSameOriginWithAncestors(RenderFrameHost* host,
|
bool IsSameOriginWithAncestors(RenderFrameHost* host,
|
||||||
const url::Origin& origin);
|
const url::Origin& origin);
|
||||||
|
|
||||||
|
@@ -140,6 +140,7 @@ source_set("browser_sources") {
|
|||||||
"devtools_permission_overrides.cc",
|
"devtools_permission_overrides.cc",
|
||||||
"devtools_permission_overrides.h",
|
"devtools_permission_overrides.h",
|
||||||
"devtools_socket_factory.h",
|
"devtools_socket_factory.h",
|
||||||
|
"document_service_base.h",
|
||||||
"dom_storage_context.h",
|
"dom_storage_context.h",
|
||||||
"download_item_utils.h",
|
"download_item_utils.h",
|
||||||
"download_manager.cc",
|
"download_manager.cc",
|
||||||
@@ -170,7 +171,6 @@ source_set("browser_sources") {
|
|||||||
"font_list_async.h",
|
"font_list_async.h",
|
||||||
"frame_accept_header.cc",
|
"frame_accept_header.cc",
|
||||||
"frame_accept_header.h",
|
"frame_accept_header.h",
|
||||||
"frame_service_base.h",
|
|
||||||
"generated_code_cache_settings.h",
|
"generated_code_cache_settings.h",
|
||||||
"global_request_id.cc",
|
"global_request_id.cc",
|
||||||
"global_request_id.h",
|
"global_request_id.h",
|
||||||
|
@@ -2,8 +2,8 @@
|
|||||||
// Use of this source code is governed by a BSD-style license that can be
|
// Use of this source code is governed by a BSD-style license that can be
|
||||||
// found in the LICENSE file.
|
// found in the LICENSE file.
|
||||||
|
|
||||||
#ifndef CONTENT_PUBLIC_BROWSER_FRAME_SERVICE_BASE_H_
|
#ifndef CONTENT_PUBLIC_BROWSER_DOCUMENT_SERVICE_BASE_H_
|
||||||
#define CONTENT_PUBLIC_BROWSER_FRAME_SERVICE_BASE_H_
|
#define CONTENT_PUBLIC_BROWSER_DOCUMENT_SERVICE_BASE_H_
|
||||||
|
|
||||||
#include <utility>
|
#include <utility>
|
||||||
|
|
||||||
@@ -33,10 +33,10 @@ class RenderFrameHost;
|
|||||||
// origin() instead of from |render_frame_host| passed in the constructor.
|
// origin() instead of from |render_frame_host| passed in the constructor.
|
||||||
// See https://crbug.com/769189 for an example of such a race.
|
// See https://crbug.com/769189 for an example of such a race.
|
||||||
template <typename Interface>
|
template <typename Interface>
|
||||||
class FrameServiceBase : public Interface, public WebContentsObserver {
|
class DocumentServiceBase : public Interface, public WebContentsObserver {
|
||||||
public:
|
public:
|
||||||
FrameServiceBase(RenderFrameHost* render_frame_host,
|
DocumentServiceBase(RenderFrameHost* render_frame_host,
|
||||||
mojo::PendingReceiver<Interface> pending_receiver)
|
mojo::PendingReceiver<Interface> pending_receiver)
|
||||||
: WebContentsObserver(
|
: WebContentsObserver(
|
||||||
WebContents::FromRenderFrameHost(render_frame_host)),
|
WebContents::FromRenderFrameHost(render_frame_host)),
|
||||||
render_frame_host_(render_frame_host),
|
render_frame_host_(render_frame_host),
|
||||||
@@ -44,12 +44,12 @@ class FrameServiceBase : public Interface, public WebContentsObserver {
|
|||||||
receiver_(this, std::move(pending_receiver)) {
|
receiver_(this, std::move(pending_receiver)) {
|
||||||
// |this| owns |receiver_|, so unretained is safe.
|
// |this| owns |receiver_|, so unretained is safe.
|
||||||
receiver_.set_disconnect_handler(
|
receiver_.set_disconnect_handler(
|
||||||
base::BindOnce(&FrameServiceBase::Close, base::Unretained(this)));
|
base::BindOnce(&DocumentServiceBase::Close, base::Unretained(this)));
|
||||||
}
|
}
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
// Make the destructor private since |this| can only be deleted by Close().
|
// Make the destructor private since |this| can only be deleted by Close().
|
||||||
virtual ~FrameServiceBase() = default;
|
virtual ~DocumentServiceBase() = default;
|
||||||
|
|
||||||
// All subclasses should use this function to obtain the origin instead of
|
// All subclasses should use this function to obtain the origin instead of
|
||||||
// trying to get it from the RenderFrameHost pointer directly.
|
// trying to get it from the RenderFrameHost pointer directly.
|
||||||
@@ -64,8 +64,8 @@ class FrameServiceBase : public Interface, public WebContentsObserver {
|
|||||||
|
|
||||||
private:
|
private:
|
||||||
// Disallow calling web_contents() directly from the subclasses to ensure that
|
// Disallow calling web_contents() directly from the subclasses to ensure that
|
||||||
// tab-level state doesn't get queried or updated when the frame is
|
// tab-level state doesn't get queried or updated when the RenderFrameHost is
|
||||||
// not current.
|
// not active.
|
||||||
// Use WebContents::From(render_frame_host()) instead, but please keep in mind
|
// Use WebContents::From(render_frame_host()) instead, but please keep in mind
|
||||||
// that the render_frame_host() might not be active. See
|
// that the render_frame_host() might not be active. See
|
||||||
// RenderFrameHost::IsActive() for details.
|
// RenderFrameHost::IsActive() for details.
|
||||||
@@ -110,4 +110,4 @@ class FrameServiceBase : public Interface, public WebContentsObserver {
|
|||||||
|
|
||||||
} // namespace content
|
} // namespace content
|
||||||
|
|
||||||
#endif // CONTENT_PUBLIC_BROWSER_FRAME_SERVICE_BASE_H_
|
#endif // CONTENT_PUBLIC_BROWSER_DOCUMENT_SERVICE_BASE_H_
|
@@ -2028,8 +2028,8 @@ test("content_unittests") {
|
|||||||
"../browser/renderer_host/clipboard_host_impl_unittest.cc",
|
"../browser/renderer_host/clipboard_host_impl_unittest.cc",
|
||||||
"../browser/renderer_host/commit_deferring_condition_runner_unittest.cc",
|
"../browser/renderer_host/commit_deferring_condition_runner_unittest.cc",
|
||||||
"../browser/renderer_host/cursor_manager_unittest.cc",
|
"../browser/renderer_host/cursor_manager_unittest.cc",
|
||||||
|
"../browser/renderer_host/document_service_base_unittest.cc",
|
||||||
"../browser/renderer_host/embedded_frame_sink_provider_impl_unittest.cc",
|
"../browser/renderer_host/embedded_frame_sink_provider_impl_unittest.cc",
|
||||||
"../browser/renderer_host/frame_service_base_unittest.cc",
|
|
||||||
"../browser/renderer_host/frame_token_message_queue_unittest.cc",
|
"../browser/renderer_host/frame_token_message_queue_unittest.cc",
|
||||||
"../browser/renderer_host/frame_tree_node_blame_context_unittest.cc",
|
"../browser/renderer_host/frame_tree_node_blame_context_unittest.cc",
|
||||||
"../browser/renderer_host/frame_tree_unittest.cc",
|
"../browser/renderer_host/frame_tree_unittest.cc",
|
||||||
|
@@ -12,7 +12,7 @@
|
|||||||
#include "base/files/file_path.h"
|
#include "base/files/file_path.h"
|
||||||
#include "base/fuchsia/process_context.h"
|
#include "base/fuchsia/process_context.h"
|
||||||
#include "content/public/browser/browser_context.h"
|
#include "content/public/browser/browser_context.h"
|
||||||
#include "content/public/browser/frame_service_base.h"
|
#include "content/public/browser/document_service_base.h"
|
||||||
#include "content/public/browser/provision_fetcher_factory.h"
|
#include "content/public/browser/provision_fetcher_factory.h"
|
||||||
#include "content/public/browser/render_frame_host.h"
|
#include "content/public/browser/render_frame_host.h"
|
||||||
#include "content/public/browser/render_process_host.h"
|
#include "content/public/browser/render_process_host.h"
|
||||||
@@ -27,7 +27,7 @@
|
|||||||
namespace {
|
namespace {
|
||||||
|
|
||||||
class MediaResourceProviderImpl
|
class MediaResourceProviderImpl
|
||||||
: public content::FrameServiceBase<
|
: public content::DocumentServiceBase<
|
||||||
media::mojom::FuchsiaMediaResourceProvider> {
|
media::mojom::FuchsiaMediaResourceProvider> {
|
||||||
public:
|
public:
|
||||||
MediaResourceProviderImpl(
|
MediaResourceProviderImpl(
|
||||||
@@ -59,7 +59,7 @@ MediaResourceProviderImpl::MediaResourceProviderImpl(
|
|||||||
media::FuchsiaCdmManager* cdm_manager,
|
media::FuchsiaCdmManager* cdm_manager,
|
||||||
content::RenderFrameHost* render_frame_host,
|
content::RenderFrameHost* render_frame_host,
|
||||||
mojo::PendingReceiver<media::mojom::FuchsiaMediaResourceProvider> receiver)
|
mojo::PendingReceiver<media::mojom::FuchsiaMediaResourceProvider> receiver)
|
||||||
: FrameServiceBase(render_frame_host, std::move(receiver)),
|
: DocumentServiceBase(render_frame_host, std::move(receiver)),
|
||||||
cdm_manager_(cdm_manager) {
|
cdm_manager_(cdm_manager) {
|
||||||
DCHECK(cdm_manager_);
|
DCHECK(cdm_manager_);
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user