Commit d3fac2a5 authored by Shimi Zhang's avatar Shimi Zhang Committed by Commit Bot

Convert AssociatedInterfacePtr to AssociateRemote in chrome/ (part 2/2)

This is a followup of http://crrev/c/1685837. See more at
https://docs.google.com/document/d/1Jwfbzbe8ozaoilhqj5mAPYbYGpgZCen_XAAAdwmyP1E/edit

Bug: 955171
Change-Id: Iaa528bed1f3909a60f1c5db5bd01bf575ecd2cd3
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1787168
Commit-Queue: Shimi Zhang <ctzsm@chromium.org>
Reviewed-by: default avatarTed Choc <tedchoc@chromium.org>
Cr-Commit-Position: refs/heads/master@{#694499}
parent 8921ea11
......@@ -344,7 +344,7 @@ void ChromeRenderFrameObserver::DidFinishLoad() {
GURL osdd_url = frame->GetDocument().OpenSearchDescriptionURL();
if (!osdd_url.is_empty()) {
chrome::mojom::OpenSearchDescriptionDocumentHandlerAssociatedPtr
mojo::AssociatedRemote<chrome::mojom::OpenSearchDescriptionDocumentHandler>
osdd_handler;
render_frame()->GetRemoteAssociatedInterfaces()->GetInterface(
&osdd_handler);
......@@ -369,7 +369,8 @@ void ChromeRenderFrameObserver::DidCreateNewDocument() {
// Connect to Mojo service on browser to notify it of the page's archive
// properties.
offline_pages::mojom::MhtmlPageNotifierAssociatedPtr mhtml_notifier;
mojo::AssociatedRemote<offline_pages::mojom::MhtmlPageNotifier>
mhtml_notifier;
render_frame()->GetRemoteAssociatedInterfaces()->GetInterface(
&mhtml_notifier);
DCHECK(mhtml_notifier);
......@@ -502,8 +503,9 @@ void ChromeRenderFrameObserver::OnDestruct() {
}
void ChromeRenderFrameObserver::OnRenderFrameObserverRequest(
chrome::mojom::ChromeRenderFrameAssociatedRequest request) {
bindings_.AddBinding(this, std::move(request));
mojo::PendingAssociatedReceiver<chrome::mojom::ChromeRenderFrame>
receiver) {
receivers_.Add(this, std::move(receiver));
}
void ChromeRenderFrameObserver::SetWindowFeatures(
......
......@@ -11,8 +11,8 @@
#include "chrome/common/chrome_render_frame.mojom.h"
#include "chrome/common/prerender_types.h"
#include "content/public/renderer/render_frame_observer.h"
#include "mojo/public/cpp/bindings/associated_binding_set.h"
#include "mojo/public/cpp/bindings/binding_set.h"
#include "mojo/public/cpp/bindings/associated_receiver_set.h"
#include "mojo/public/cpp/bindings/pending_associated_receiver.h"
#include "services/service_manager/public/cpp/binder_registry.h"
#include "third_party/blink/public/common/associated_interfaces/associated_interface_registry.h"
......@@ -91,7 +91,8 @@ class ChromeRenderFrameObserver : public content::RenderFrameObserver,
void GetWebApplicationInfo(GetWebApplicationInfoCallback callback) override;
void OnRenderFrameObserverRequest(
chrome::mojom::ChromeRenderFrameAssociatedRequest request);
mojo::PendingAssociatedReceiver<chrome::mojom::ChromeRenderFrame>
receiver);
// Captures page information using the top (main) frame of a frame tree.
// Currently, this page information is just the text content of the all
......@@ -115,7 +116,7 @@ class ChromeRenderFrameObserver : public content::RenderFrameObserver,
std::vector<base::string16> webui_javascript_;
#endif
mojo::AssociatedBindingSet<chrome::mojom::ChromeRenderFrame> bindings_;
mojo::AssociatedReceiverSet<chrome::mojom::ChromeRenderFrame> receivers_;
service_manager::BinderRegistry registry_;
blink::AssociatedInterfaceRegistry associated_interfaces_;
......
......@@ -275,8 +275,9 @@ void ChromeRenderThreadObserver::SetFieldTrialGroup(
}
void ChromeRenderThreadObserver::OnRendererConfigurationAssociatedRequest(
chrome::mojom::RendererConfigurationAssociatedRequest request) {
renderer_configuration_bindings_.AddBinding(this, std::move(request));
mojo::PendingAssociatedReceiver<chrome::mojom::RendererConfiguration>
receiver) {
renderer_configuration_receivers_.Add(this, std::move(receiver));
}
const RendererContentSettingRules*
......
......@@ -13,10 +13,12 @@
#include "chrome/common/renderer_configuration.mojom.h"
#include "components/content_settings/core/common/content_settings.h"
#include "content/public/renderer/render_thread_observer.h"
#include "mojo/public/cpp/bindings/associated_binding_set.h"
#include "mojo/public/cpp/bindings/associated_receiver_set.h"
#include "mojo/public/cpp/bindings/pending_associated_receiver.h"
#if defined(OS_CHROMEOS)
#include "chrome/renderer/chromeos_delayed_callback_group.h"
#include "mojo/public/cpp/bindings/binding.h"
#endif // defined(OS_CHROMEOS)
namespace content {
......@@ -114,7 +116,8 @@ class ChromeRenderThreadObserver : public content::RenderThreadObserver,
const std::string& group_name) override;
void OnRendererConfigurationAssociatedRequest(
chrome::mojom::RendererConfigurationAssociatedRequest request);
mojo::PendingAssociatedReceiver<chrome::mojom::RendererConfiguration>
receiver);
static bool is_incognito_process_;
std::unique_ptr<content::ResourceDispatcherDelegate> resource_delegate_;
......@@ -122,8 +125,8 @@ class ChromeRenderThreadObserver : public content::RenderThreadObserver,
std::unique_ptr<visitedlink::VisitedLinkSlave> visited_link_slave_;
mojo::AssociatedBindingSet<chrome::mojom::RendererConfiguration>
renderer_configuration_bindings_;
mojo::AssociatedReceiverSet<chrome::mojom::RendererConfiguration>
renderer_configuration_receivers_;
#if defined(OS_CHROMEOS)
// Only set if the Chrome OS merge session was running when the renderer
......
......@@ -247,8 +247,9 @@ void ContentSettingsObserver::SetAsInterstitial() {
}
void ContentSettingsObserver::OnContentSettingsRendererRequest(
chrome::mojom::ContentSettingsRendererAssociatedRequest request) {
bindings_.AddBinding(this, std::move(request));
mojo::PendingAssociatedReceiver<chrome::mojom::ContentSettingsRenderer>
receiver) {
receivers_.Add(this, std::move(receiver));
}
bool ContentSettingsObserver::AllowDatabase() {
......@@ -531,7 +532,7 @@ void ContentSettingsObserver::PersistClientHints(
UMA_HISTOGRAM_COUNTS_100("ClientHints.UpdateSize", update_count);
// Notify the embedder.
client_hints::mojom::ClientHintsAssociatedPtr host_observer;
mojo::AssociatedRemote<client_hints::mojom::ClientHints> host_observer;
render_frame()->GetRemoteAssociatedInterfaces()->GetInterface(&host_observer);
host_observer->PersistClientHints(primary_origin, std::move(client_hints),
duration);
......
......@@ -19,7 +19,9 @@
#include "content/public/renderer/render_frame_observer.h"
#include "content/public/renderer/render_frame_observer_tracker.h"
#include "extensions/buildflags/buildflags.h"
#include "mojo/public/cpp/bindings/associated_binding_set.h"
#include "mojo/public/cpp/bindings/associated_receiver.h"
#include "mojo/public/cpp/bindings/associated_receiver_set.h"
#include "mojo/public/cpp/bindings/associated_remote.h"
#include "services/service_manager/public/cpp/binder_registry.h"
#include "third_party/blink/public/platform/web_content_settings_client.h"
#include "url/gurl.h"
......@@ -128,7 +130,8 @@ class ContentSettingsObserver
void SetAsInterstitial() override;
void OnContentSettingsRendererRequest(
chrome::mojom::ContentSettingsRendererAssociatedRequest request);
mojo::PendingAssociatedReceiver<chrome::mojom::ContentSettingsRenderer>
receiver);
// Message handlers.
void OnLoadBlockedPlugins(const std::string& identifier);
......@@ -190,7 +193,8 @@ class ContentSettingsObserver
// If true, IsWhitelistedForContentSettings will always return true.
const bool should_whitelist_;
mojo::AssociatedBindingSet<chrome::mojom::ContentSettingsRenderer> bindings_;
mojo::AssociatedReceiverSet<chrome::mojom::ContentSettingsRenderer>
receivers_;
DISALLOW_COPY_AND_ASSIGN(ContentSettingsObserver);
};
......
......@@ -56,7 +56,7 @@ plugins::PluginPlaceholder* NonLoadablePluginPlaceholder::CreateErrorPlugin(
plugins::PluginPlaceholder* plugin =
new plugins::PluginPlaceholder(render_frame, params, html_data);
chrome::mojom::PluginHostAssociatedPtr plugin_host;
mojo::AssociatedRemote<chrome::mojom::PluginHost> plugin_host;
render_frame->GetRemoteAssociatedInterfaces()->GetInterface(&plugin_host);
plugin_host->CouldNotLoadPlugin(file_path);
......
......@@ -128,8 +128,9 @@ void PrerenderDispatcher::PrerenderStop(int prerender_id) {
}
void PrerenderDispatcher::OnPrerenderDispatcherRequest(
chrome::mojom::PrerenderDispatcherAssociatedRequest request) {
bindings_.AddBinding(this, std::move(request));
mojo::PendingAssociatedReceiver<chrome::mojom::PrerenderDispatcher>
receiver) {
receivers_.Add(this, std::move(receiver));
}
void PrerenderDispatcher::RegisterMojoInterfaces(
......
......@@ -14,7 +14,8 @@
#include "base/time/time.h"
#include "chrome/common/prerender.mojom.h"
#include "content/public/renderer/render_thread_observer.h"
#include "mojo/public/cpp/bindings/associated_binding_set.h"
#include "mojo/public/cpp/bindings/associated_receiver_set.h"
#include "mojo/public/cpp/bindings/pending_associated_receiver.h"
#include "third_party/blink/public/common/associated_interfaces/associated_interface_registry.h"
#include "third_party/blink/public/platform/web_prerender.h"
#include "third_party/blink/public/platform/web_prerendering_support.h"
......@@ -51,7 +52,8 @@ class PrerenderDispatcher : public content::RenderThreadObserver,
void PrerenderStop(int prerender_id) override;
void OnPrerenderDispatcherRequest(
chrome::mojom::PrerenderDispatcherAssociatedRequest request);
mojo::PendingAssociatedReceiver<chrome::mojom::PrerenderDispatcher>
receiver);
// From RenderThreadObserver:
void RegisterMojoInterfaces(
......@@ -77,7 +79,7 @@ class PrerenderDispatcher : public content::RenderThreadObserver,
base::TimeTicks process_start_time_;
base::TimeTicks prefetch_parsed_time_;
mojo::AssociatedBindingSet<chrome::mojom::PrerenderDispatcher> bindings_;
mojo::AssociatedReceiverSet<chrome::mojom::PrerenderDispatcher> receivers_;
};
} // namespace prerender
......
......@@ -26,7 +26,7 @@
#include "v8/include/v8.h"
SandboxStatusExtension::SandboxStatusExtension(content::RenderFrame* frame)
: content::RenderFrameObserver(frame), binding_(this) {
: content::RenderFrameObserver(frame) {
// Don't do anything else for subframes.
if (!frame->IsMainFrame())
return;
......@@ -57,8 +57,9 @@ void SandboxStatusExtension::AddSandboxStatusExtension() {
}
void SandboxStatusExtension::OnSandboxStatusExtensionRequest(
chrome::mojom::SandboxStatusExtensionAssociatedRequest request) {
binding_.Bind(std::move(request));
mojo::PendingAssociatedReceiver<chrome::mojom::SandboxStatusExtension>
receiver) {
receiver_.Bind(std::move(receiver));
}
void SandboxStatusExtension::Install() {
......
......@@ -12,7 +12,8 @@
#include "base/values.h"
#include "chrome/common/sandbox_status_extension_android.mojom.h"
#include "content/public/renderer/render_frame_observer.h"
#include "mojo/public/cpp/bindings/associated_binding.h"
#include "mojo/public/cpp/bindings/associated_receiver.h"
#include "mojo/public/cpp/bindings/pending_associated_receiver.h"
#include "v8/include/v8.h"
namespace gin {
......@@ -45,7 +46,8 @@ class SandboxStatusExtension
void AddSandboxStatusExtension() override;
void OnSandboxStatusExtensionRequest(
chrome::mojom::SandboxStatusExtensionAssociatedRequest request);
mojo::PendingAssociatedReceiver<chrome::mojom::SandboxStatusExtension>
receiver);
// Installs the JavaScript function into the scripting context, if
// should_install_ is true.
......@@ -67,7 +69,8 @@ class SandboxStatusExtension
// Set to true by AddSandboxStatusExtension().
bool should_install_ = false;
mojo::AssociatedBinding<chrome::mojom::SandboxStatusExtension> binding_;
mojo::AssociatedReceiver<chrome::mojom::SandboxStatusExtension> receiver_{
this};
DISALLOW_COPY_AND_ASSIGN(SandboxStatusExtension);
};
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment