Commit 36f0e203 authored by Sergey Ulanov's avatar Sergey Ulanov Committed by Commit Bot

[Fuchsia] Restore viewsv1::ViewProvider impl in WebComponent

This change reverts some parts of https://crrev.com/632311 .
Modular still depends on ViewsV1, so it was broken by that change since
it removed ViewsV1 support in web_runner.

Bug: 899348
Change-Id: I10cd2c2c11b3b4d2ad2d3a0000ffee5c13e549e7
Reviewed-on: https://chromium-review.googlesource.com/c/1476063
Commit-Queue: Sergey Ulanov <sergeyu@chromium.org>
Reviewed-by: default avatarWez <wez@chromium.org>
Auto-Submit: Sergey Ulanov <sergeyu@chromium.org>
Cr-Commit-Position: refs/heads/master@{#632796}
parent d64e8f73
...@@ -18,6 +18,7 @@ source_set("common") { ...@@ -18,6 +18,7 @@ source_set("common") {
deps = [ deps = [
"//base", "//base",
"//third_party/fuchsia-sdk/sdk:ui_app", "//third_party/fuchsia-sdk/sdk:ui_app",
"//third_party/fuchsia-sdk/sdk:ui_viewsv1",
"//url", "//url",
] ]
public_deps = [ public_deps = [
......
...@@ -67,6 +67,9 @@ WebComponent::WebComponent( ...@@ -67,6 +67,9 @@ WebComponent::WebComponent(
view_provider_binding_ = std::make_unique< view_provider_binding_ = std::make_unique<
base::fuchsia::ScopedServiceBinding<fuchsia::ui::app::ViewProvider>>( base::fuchsia::ScopedServiceBinding<fuchsia::ui::app::ViewProvider>>(
startup_context()->public_services(), this); startup_context()->public_services(), this);
legacy_view_provider_binding_ = std::make_unique<
base::fuchsia::ScopedServiceBinding<fuchsia::ui::viewsv1::ViewProvider>>(
startup_context()->public_services(), this);
} }
void WebComponent::Kill() { void WebComponent::Kill() {
...@@ -92,6 +95,16 @@ void WebComponent::CreateView( ...@@ -92,6 +95,16 @@ void WebComponent::CreateView(
view_is_bound_ = true; view_is_bound_ = true;
} }
void WebComponent::CreateView(
fidl::InterfaceRequest<fuchsia::ui::viewsv1token::ViewOwner> view_owner,
fidl::InterfaceRequest<fuchsia::sys::ServiceProvider> services) {
// Cast the ViewOwner request to view_token. This is temporary hack for
// ViewsV2 transition. This version of CreateView() will be removed in the
// future.
CreateView(zx::eventpair(view_owner.TakeChannel().release()),
std::move(services), nullptr);
}
void WebComponent::DestroyComponent(int termination_exit_code, void WebComponent::DestroyComponent(int termination_exit_code,
fuchsia::sys::TerminationReason reason) { fuchsia::sys::TerminationReason reason) {
termination_reason_ = reason; termination_reason_ = reason;
......
...@@ -7,6 +7,7 @@ ...@@ -7,6 +7,7 @@
#include <fuchsia/sys/cpp/fidl.h> #include <fuchsia/sys/cpp/fidl.h>
#include <fuchsia/ui/app/cpp/fidl.h> #include <fuchsia/ui/app/cpp/fidl.h>
#include <fuchsia/ui/viewsv1/cpp/fidl.h>
#include <lib/fidl/cpp/binding.h> #include <lib/fidl/cpp/binding.h>
#include <lib/fidl/cpp/binding_set.h> #include <lib/fidl/cpp/binding_set.h>
#include <memory> #include <memory>
...@@ -29,8 +30,11 @@ class WebContentRunner; ...@@ -29,8 +30,11 @@ class WebContentRunner;
// resources and service bindings. Runners for specialized web-based content // resources and service bindings. Runners for specialized web-based content
// (e.g. Cast applications) can extend this class to configure the Frame to // (e.g. Cast applications) can extend this class to configure the Frame to
// their needs, publish additional APIs, etc. // their needs, publish additional APIs, etc.
// TODO(crbug.com/899348): Remove fuchsia::ui::viewsv1::ViewProvider after
// SCN-1033 is closed.
class WebComponent : public fuchsia::sys::ComponentController, class WebComponent : public fuchsia::sys::ComponentController,
public fuchsia::ui::app::ViewProvider { public fuchsia::ui::app::ViewProvider,
public fuchsia::ui::viewsv1::ViewProvider {
public: public:
// Creates a WebComponent encapsulating a web.Frame. A ViewProvider service // Creates a WebComponent encapsulating a web.Frame. A ViewProvider service
// will be published to the service-directory specified by |startup_context|, // will be published to the service-directory specified by |startup_context|,
...@@ -61,6 +65,11 @@ class WebComponent : public fuchsia::sys::ComponentController, ...@@ -61,6 +65,11 @@ class WebComponent : public fuchsia::sys::ComponentController,
fidl::InterfaceHandle<fuchsia::sys::ServiceProvider> outgoing_services) fidl::InterfaceHandle<fuchsia::sys::ServiceProvider> outgoing_services)
override; override;
// fuchsia::ui::viewsv1::ViewProvider implementation.
void CreateView(
fidl::InterfaceRequest<fuchsia::ui::viewsv1token::ViewOwner> view_owner,
fidl::InterfaceRequest<fuchsia::sys::ServiceProvider> services) override;
// Reports the supplied exit-code and reason to the |controller_binding_| and // Reports the supplied exit-code and reason to the |controller_binding_| and
// requests that the |runner_| delete this component. // requests that the |runner_| delete this component.
virtual void DestroyComponent(int termination_exit_code, virtual void DestroyComponent(int termination_exit_code,
...@@ -91,6 +100,9 @@ class WebComponent : public fuchsia::sys::ComponentController, ...@@ -91,6 +100,9 @@ class WebComponent : public fuchsia::sys::ComponentController,
std::unique_ptr< std::unique_ptr<
base::fuchsia::ScopedServiceBinding<fuchsia::ui::app::ViewProvider>> base::fuchsia::ScopedServiceBinding<fuchsia::ui::app::ViewProvider>>
view_provider_binding_; view_provider_binding_;
std::unique_ptr<
base::fuchsia::ScopedServiceBinding<fuchsia::ui::viewsv1::ViewProvider>>
legacy_view_provider_binding_;
// Termination reason and exit-code to be reported via the // Termination reason and exit-code to be reported via the
// sys::ComponentController::OnTerminated event. // sys::ComponentController::OnTerminated event.
......
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