Commit 4284288a authored by Julie Jeongeun Kim's avatar Julie Jeongeun Kim Committed by Commit Bot

Clean up old Mojo type for mojom::EmbeddedSearchClient

This CL cleans up old mojo types for mojom::EmbeddedSearchClient
using AssociatedReceiver, AssociatedRemote, and
PendingAssociatedRemote.

Bug: 955171
Change-Id: I1fe1d2cf2fda69ebc8f88f49771171741754b457
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1897399Reviewed-by: default avatarOksana Zhuravlova <oksamyt@chromium.org>
Reviewed-by: default avatarSam McNally <sammc@chromium.org>
Reviewed-by: default avatarDan Beam <dbeam@chromium.org>
Commit-Queue: Julie Kim <jkim@igalia.com>
Cr-Commit-Position: refs/heads/master@{#714856}
parent e71e01b4
...@@ -17,6 +17,8 @@ ...@@ -17,6 +17,8 @@
#include "content/public/browser/render_process_host.h" #include "content/public/browser/render_process_host.h"
#include "content/public/browser/web_contents.h" #include "content/public/browser/web_contents.h"
#include "content/public/common/child_process_host.h" #include "content/public/common/child_process_host.h"
#include "mojo/public/cpp/bindings/associated_remote.h"
#include "mojo/public/cpp/bindings/pending_associated_remote.h"
#include "third_party/blink/public/common/associated_interfaces/associated_interface_provider.h" #include "third_party/blink/public/common/associated_interfaces/associated_interface_provider.h"
namespace { namespace {
...@@ -43,7 +45,8 @@ class EmbeddedSearchClientFactoryImpl ...@@ -43,7 +45,8 @@ class EmbeddedSearchClientFactoryImpl
DCHECK(web_contents); DCHECK(web_contents);
DCHECK(binding); DCHECK(binding);
// Before we are connected to a frame we throw away all messages. // Before we are connected to a frame we throw away all messages.
mojo::MakeRequestAssociatedWithDedicatedPipe(&embedded_search_client_); ignore_result(embedded_search_client_
.BindNewEndpointAndPassDedicatedReceiverForTesting());
} }
chrome::mojom::EmbeddedSearchClient* GetEmbeddedSearchClient() override { chrome::mojom::EmbeddedSearchClient* GetEmbeddedSearchClient() override {
...@@ -53,12 +56,14 @@ class EmbeddedSearchClientFactoryImpl ...@@ -53,12 +56,14 @@ class EmbeddedSearchClientFactoryImpl
private: private:
void Connect( void Connect(
chrome::mojom::EmbeddedSearchAssociatedRequest request, chrome::mojom::EmbeddedSearchAssociatedRequest request,
chrome::mojom::EmbeddedSearchClientAssociatedPtrInfo client) override; mojo::PendingAssociatedRemote<chrome::mojom::EmbeddedSearchClient> client)
override;
// An interface used to push updates to the frame that connected to us. Before // An interface used to push updates to the frame that connected to us. Before
// we've been connected to a frame, messages sent on this interface go into // we've been connected to a frame, messages sent on this interface go into
// the void. // the void.
chrome::mojom::EmbeddedSearchClientAssociatedPtr embedded_search_client_; mojo::AssociatedRemote<chrome::mojom::EmbeddedSearchClient>
embedded_search_client_;
// Used to bind incoming interface requests to the implementation, which lives // Used to bind incoming interface requests to the implementation, which lives
// in SearchIPCRouter. // in SearchIPCRouter.
...@@ -73,13 +78,14 @@ class EmbeddedSearchClientFactoryImpl ...@@ -73,13 +78,14 @@ class EmbeddedSearchClientFactoryImpl
void EmbeddedSearchClientFactoryImpl::Connect( void EmbeddedSearchClientFactoryImpl::Connect(
chrome::mojom::EmbeddedSearchAssociatedRequest request, chrome::mojom::EmbeddedSearchAssociatedRequest request,
chrome::mojom::EmbeddedSearchClientAssociatedPtrInfo client) { mojo::PendingAssociatedRemote<chrome::mojom::EmbeddedSearchClient> client) {
content::RenderFrameHost* frame = factory_bindings_.GetCurrentTargetFrame(); content::RenderFrameHost* frame = factory_bindings_.GetCurrentTargetFrame();
const bool is_main_frame = frame->GetParent() == nullptr; const bool is_main_frame = frame->GetParent() == nullptr;
if (!IsInInstantProcess(frame) || !is_main_frame) { if (!IsInInstantProcess(frame) || !is_main_frame) {
return; return;
} }
client_binding_->Bind(std::move(request)); client_binding_->Bind(std::move(request));
embedded_search_client_.reset();
embedded_search_client_.Bind(std::move(client)); embedded_search_client_.Bind(std::move(client));
} }
......
...@@ -29,7 +29,7 @@ interface EmbeddedSearchConnector { ...@@ -29,7 +29,7 @@ interface EmbeddedSearchConnector {
// connection used by the embedded search interface implementation to push // connection used by the embedded search interface implementation to push
// browser state updates to the client. // browser state updates to the client.
Connect(associated EmbeddedSearch & embedded_search, Connect(associated EmbeddedSearch & embedded_search,
associated EmbeddedSearchClient client); pending_associated_remote<EmbeddedSearchClient> client);
}; };
// See components/omnibox/browser/autocomplete_match.h. // See components/omnibox/browser/autocomplete_match.h.
......
...@@ -26,6 +26,7 @@ ...@@ -26,6 +26,7 @@
#include "content/public/renderer/render_frame.h" #include "content/public/renderer/render_frame.h"
#include "content/public/renderer/render_view.h" #include "content/public/renderer/render_view.h"
#include "mojo/public/cpp/bindings/associated_remote.h" #include "mojo/public/cpp/bindings/associated_remote.h"
#include "mojo/public/cpp/bindings/pending_associated_remote.h"
#include "third_party/blink/public/common/associated_interfaces/associated_interface_provider.h" #include "third_party/blink/public/common/associated_interfaces/associated_interface_provider.h"
#include "third_party/blink/public/common/associated_interfaces/associated_interface_registry.h" #include "third_party/blink/public/common/associated_interfaces/associated_interface_registry.h"
#include "third_party/blink/public/web/web_frame.h" #include "third_party/blink/public/web/web_frame.h"
...@@ -198,7 +199,6 @@ SearchBox::IconURLHelper::~IconURLHelper() = default; ...@@ -198,7 +199,6 @@ SearchBox::IconURLHelper::~IconURLHelper() = default;
SearchBox::SearchBox(content::RenderFrame* render_frame) SearchBox::SearchBox(content::RenderFrame* render_frame)
: content::RenderFrameObserver(render_frame), : content::RenderFrameObserver(render_frame),
content::RenderFrameObserverTracker<SearchBox>(render_frame), content::RenderFrameObserverTracker<SearchBox>(render_frame),
binding_(this),
can_run_js_in_renderframe_(false), can_run_js_in_renderframe_(false),
page_seq_no_(0), page_seq_no_(0),
is_focused_(false), is_focused_(false),
...@@ -209,10 +209,11 @@ SearchBox::SearchBox(content::RenderFrame* render_frame) ...@@ -209,10 +209,11 @@ SearchBox::SearchBox(content::RenderFrame* render_frame)
// Connect to the embedded search interface in the browser. // Connect to the embedded search interface in the browser.
mojo::AssociatedRemote<chrome::mojom::EmbeddedSearchConnector> connector; mojo::AssociatedRemote<chrome::mojom::EmbeddedSearchConnector> connector;
render_frame->GetRemoteAssociatedInterfaces()->GetInterface(&connector); render_frame->GetRemoteAssociatedInterfaces()->GetInterface(&connector);
chrome::mojom::EmbeddedSearchClientAssociatedPtrInfo embedded_search_client; mojo::PendingAssociatedRemote<chrome::mojom::EmbeddedSearchClient>
binding_.Bind(mojo::MakeRequest(&embedded_search_client), embedded_search_client;
render_frame->GetTaskRunner( receiver_.Bind(embedded_search_client.InitWithNewEndpointAndPassReceiver(),
blink::TaskType::kInternalNavigationAssociated)); render_frame->GetTaskRunner(
blink::TaskType::kInternalNavigationAssociated));
connector->Connect( connector->Connect(
mojo::MakeRequest(&embedded_search_service_, mojo::MakeRequest(&embedded_search_service_,
render_frame->GetTaskRunner( render_frame->GetTaskRunner(
......
...@@ -20,7 +20,7 @@ ...@@ -20,7 +20,7 @@
#include "components/omnibox/common/omnibox_focus_state.h" #include "components/omnibox/common/omnibox_focus_state.h"
#include "content/public/renderer/render_frame_observer.h" #include "content/public/renderer/render_frame_observer.h"
#include "content/public/renderer/render_frame_observer_tracker.h" #include "content/public/renderer/render_frame_observer_tracker.h"
#include "mojo/public/cpp/bindings/associated_binding.h" #include "mojo/public/cpp/bindings/associated_receiver.h"
#include "url/gurl.h" #include "url/gurl.h"
// The renderer-side implementation of the embeddedSearch API (see // The renderer-side implementation of the embeddedSearch API (see
...@@ -237,7 +237,7 @@ class SearchBox : public content::RenderFrameObserver, ...@@ -237,7 +237,7 @@ class SearchBox : public content::RenderFrameObserver,
// The connection to the EmbeddedSearch service in the browser process. // The connection to the EmbeddedSearch service in the browser process.
chrome::mojom::EmbeddedSearchAssociatedPtr embedded_search_service_; chrome::mojom::EmbeddedSearchAssociatedPtr embedded_search_service_;
mojo::AssociatedBinding<chrome::mojom::EmbeddedSearchClient> binding_; mojo::AssociatedReceiver<chrome::mojom::EmbeddedSearchClient> receiver_{this};
// Whether it's legal to execute JavaScript in |render_frame()|. // Whether it's legal to execute JavaScript in |render_frame()|.
// This class may want to execute JS in response to IPCs (via the // This class may want to execute JS in response to IPCs (via the
......
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