diff --git a/peridot/bin/sessionmgr/BUILD.gn b/peridot/bin/sessionmgr/BUILD.gn index 3de5b70e38af0707c3cc8c4cf333b74623f29d73..8d9845c6bfe07f2b204fb4c4375c00a03131908f 100644 --- a/peridot/bin/sessionmgr/BUILD.gn +++ b/peridot/bin/sessionmgr/BUILD.gn @@ -130,7 +130,6 @@ executable_package("dev_session_shell") { "//sdk/fidl/fuchsia.modular", "//sdk/fidl/fuchsia.ui.scenic", "//sdk/fidl/fuchsia.ui.views", - "//sdk/fidl/fuchsia.ui.viewsv1token", "//sdk/lib/fidl/cpp", "//sdk/lib/ui/scenic/cpp", "//src/lib/fxl", diff --git a/peridot/bin/sessionmgr/dev_session_shell.cc b/peridot/bin/sessionmgr/dev_session_shell.cc index d84c1414e5126e089b7f57e5d8ef81b5a1e87a3b..d2dac47ec475e666f35beb7452be347158711568 100644 --- a/peridot/bin/sessionmgr/dev_session_shell.cc +++ b/peridot/bin/sessionmgr/dev_session_shell.cc @@ -6,9 +6,6 @@ // root module URL and data for its fuchsia::modular::Link as command line // arguments, which can be set using the basemgr --user-shell-args flag. -#include <memory> -#include <utility> - #include <fuchsia/modular/cpp/fidl.h> #include <fuchsia/sys/cpp/fidl.h> #include <fuchsia/ui/scenic/cpp/fidl.h> @@ -27,6 +24,9 @@ #include <src/lib/fxl/logging.h> #include <src/lib/fxl/macros.h> +#include <memory> +#include <utility> + #include "peridot/lib/fidl/single_service_app.h" #include "peridot/lib/fidl/view_host.h" #include "peridot/lib/rapidjson/rapidjson.h" @@ -209,9 +209,16 @@ class DevSessionShellApp : fuchsia::modular::StoryWatcher, void AttachView(fuchsia::modular::ViewIdentifier view_id, fidl::InterfaceHandle<fuchsia::ui::viewsv1token::ViewOwner> view_owner) override { + AttachView2(view_id, scenic::ToViewHolderToken(zx::eventpair( + view_owner.TakeChannel().release()))); + } + + // |SessionShell| + void AttachView2( + fuchsia::modular::ViewIdentifier view_id, + fuchsia::ui::views::ViewHolderToken view_holder_token) override { FXL_LOG(INFO) << "DevSessionShell AttachView(): " << view_id.story_id; - view_->ConnectView(scenic::ToViewHolderToken( - zx::eventpair(view_owner.TakeChannel().release()))); + view_->ConnectView(std::move(view_holder_token)); } // |SessionShell| diff --git a/peridot/bin/sessionmgr/story_runner/BUILD.gn b/peridot/bin/sessionmgr/story_runner/BUILD.gn index eba48f3baef467cbc27e77dbeb16a0da870764dc..4fed87805627193c41a680f17157c539e4b835b1 100644 --- a/peridot/bin/sessionmgr/story_runner/BUILD.gn +++ b/peridot/bin/sessionmgr/story_runner/BUILD.gn @@ -75,7 +75,6 @@ source_set("story_runner") { "//sdk/fidl/fuchsia.scenic.snapshot", "//sdk/fidl/fuchsia.ui.policy", "//sdk/fidl/fuchsia.ui.views", - "//sdk/fidl/fuchsia.ui.viewsv1token", "//sdk/lib/fidl/cpp", "//src/ledger/bin/fidl", "//src/lib/fxl", diff --git a/peridot/bin/sessionmgr/story_runner/story_controller_impl.cc b/peridot/bin/sessionmgr/story_runner/story_controller_impl.cc index c7b57b2fab9ebe0d3d43231477b8b74e5e0426b7..36b61ced6d61bc46fc0671cb36e90f6553003c7d 100644 --- a/peridot/bin/sessionmgr/story_runner/story_controller_impl.cc +++ b/peridot/bin/sessionmgr/story_runner/story_controller_impl.cc @@ -4,10 +4,6 @@ #include "peridot/bin/sessionmgr/story_runner/story_controller_impl.h" -#include <memory> -#include <string> -#include <vector> - #include <fuchsia/ledger/cpp/fidl.h> #include <fuchsia/modular/cpp/fidl.h> #include <fuchsia/modular/internal/cpp/fidl.h> @@ -701,8 +697,9 @@ class StoryControllerImpl::OnModuleDataUpdatedCall : public Operation<> { // // TODO(thatguy): Revisit this decision. It seems wrong: we do not want to // auto-start mods added through ModuleContext.EmbedModule(), because we do - // not have the necessary capabilities (the ImportToken). Mods added through - // ModuleContext.AddModuleToStory() can be started automatically, however. + // not have the necessary capabilities (the ViewHolderToken). Mods added + // through ModuleContext.AddModuleToStory() can be started automatically, + // however. if (module_data_.module_source == fuchsia::modular::ModuleSource::INTERNAL) { return; @@ -1366,15 +1363,12 @@ void StoryControllerImpl::GetLink( } void StoryControllerImpl::StartStoryShell() { - fuchsia::ui::viewsv1token::ViewOwnerPtr view_owner; + auto [view_token, view_holder_token] = scenic::NewViewTokenPair(); story_shell_holder_ = story_provider_impl_->StartStoryShell( - story_id_, - scenic::ToViewToken( - zx::eventpair(view_owner.NewRequest().TakeChannel().release())), - story_shell_.NewRequest()); + story_id_, std::move(view_token), story_shell_.NewRequest()); - story_provider_impl_->AttachView(story_id_, std::move(view_owner)); + story_provider_impl_->AttachView(story_id_, std::move(view_holder_token)); fuchsia::modular::StoryShellContextPtr story_shell_context; story_shell_context_impl_.Connect(story_shell_context.NewRequest()); diff --git a/peridot/bin/sessionmgr/story_runner/story_provider_impl.cc b/peridot/bin/sessionmgr/story_runner/story_provider_impl.cc index b8711beb75a072c5145aba04fcf54bb30a36ac1a..3f5bf3c2641ec7e99928145ed4bcc9f818f2b601 100644 --- a/peridot/bin/sessionmgr/story_runner/story_provider_impl.cc +++ b/peridot/bin/sessionmgr/story_runner/story_provider_impl.cc @@ -4,10 +4,6 @@ #include "peridot/bin/sessionmgr/story_runner/story_provider_impl.h" -#include <memory> -#include <utility> -#include <vector> - #include <fuchsia/scenic/snapshot/cpp/fidl.h> #include <fuchsia/ui/app/cpp/fidl.h> #include <lib/async/cpp/task.h> @@ -18,7 +14,10 @@ #include <lib/fsl/handles/object_info.h> #include <lib/fsl/vmo/strings.h> #include <lib/zx/time.h> -#include "src/lib/uuid/uuid.h" + +#include <memory> +#include <utility> +#include <vector> #include "peridot/bin/basemgr/cobalt/cobalt.h" #include "peridot/bin/sessionmgr/focus.h" @@ -34,6 +33,7 @@ #include "peridot/lib/fidl/clone.h" #include "peridot/lib/fidl/proxy.h" #include "peridot/lib/rapidjson/rapidjson.h" +#include "src/lib/uuid/uuid.h" // In tests prefetching mondrian saved ~30ms in story start up time. #define PREFETCH_MONDRIAN 1 @@ -529,11 +529,11 @@ void StoryProviderImpl::RequestStoryFocus(fidl::StringPtr story_id) { void StoryProviderImpl::AttachView( fidl::StringPtr story_id, - fuchsia::ui::viewsv1token::ViewOwnerPtr view_owner) { + fuchsia::ui::views::ViewHolderToken view_holder_token) { FXL_CHECK(session_shell_); fuchsia::modular::ViewIdentifier view_id; view_id.story_id = std::move(story_id); - session_shell_->AttachView(std::move(view_id), std::move(view_owner)); + session_shell_->AttachView2(std::move(view_id), std::move(view_holder_token)); } void StoryProviderImpl::DetachView(fidl::StringPtr story_id, diff --git a/peridot/bin/sessionmgr/story_runner/story_provider_impl.h b/peridot/bin/sessionmgr/story_runner/story_provider_impl.h index b4e5c1254df7ccbe96fe96a0707f6093cc95b7ca..45fd7b1af067fba25a75ae84d07cfb438535b903 100644 --- a/peridot/bin/sessionmgr/story_runner/story_provider_impl.h +++ b/peridot/bin/sessionmgr/story_runner/story_provider_impl.h @@ -5,10 +5,6 @@ #ifndef PERIDOT_BIN_SESSIONMGR_STORY_RUNNER_STORY_PROVIDER_IMPL_H_ #define PERIDOT_BIN_SESSIONMGR_STORY_RUNNER_STORY_PROVIDER_IMPL_H_ -#include <map> -#include <memory> -#include <set> - #include <fuchsia/ledger/cpp/fidl.h> #include <fuchsia/modular/cpp/fidl.h> #include <fuchsia/modular/internal/cpp/fidl.h> @@ -16,7 +12,6 @@ #include <fuchsia/ui/policy/cpp/fidl.h> #include <fuchsia/ui/views/cpp/fidl.h> #include <fuchsia/ui/viewsv1/cpp/fidl.h> -#include <fuchsia/ui/viewsv1token/cpp/fidl.h> #include <lib/async/cpp/operation.h> #include <lib/fidl/cpp/binding_set.h> #include <lib/fidl/cpp/interface_ptr.h> @@ -26,6 +21,10 @@ #include <lib/fit/function.h> #include <src/lib/fxl/macros.h> +#include <map> +#include <memory> +#include <set> + #include "peridot/bin/sessionmgr/agent_runner/agent_runner.h" #include "peridot/bin/sessionmgr/component_context_impl.h" #include "peridot/bin/sessionmgr/message_queue/message_queue_manager.h" @@ -136,7 +135,7 @@ class StoryProviderImpl : fuchsia::modular::StoryProvider, // Called by StoryControllerImpl. Sends, using AttachView(), a token for the // view of the story identified by |story_id| to the current session shell. void AttachView(fidl::StringPtr story_id, - fuchsia::ui::viewsv1token::ViewOwnerPtr view_owner); + fuchsia::ui::views::ViewHolderToken view_holder_token); // Called by StoryControllerImpl. Notifies, using DetachView(), the current // session shell that the view of the story identified by |story_id| is about diff --git a/peridot/lib/testing/BUILD.gn b/peridot/lib/testing/BUILD.gn index dd86f045587f6acf38366642279bef4003d63c45..2ded3334fe7a45a313290d74b2f0b9f65ffb03ea 100644 --- a/peridot/lib/testing/BUILD.gn +++ b/peridot/lib/testing/BUILD.gn @@ -140,7 +140,6 @@ source_set("session_shell_impl") { "//peridot/public/lib/integration_testing/cpp", "//sdk/fidl/fuchsia.modular", "//sdk/fidl/fuchsia.ui.views", - "//sdk/fidl/fuchsia.ui.viewsv1token", "//sdk/lib/fidl/cpp", "//src/lib/fxl", "//zircon/public/lib/async-loop-cpp", diff --git a/peridot/lib/testing/session_shell_impl.cc b/peridot/lib/testing/session_shell_impl.cc index 763bfedbdf12a76346892da476e9662fe6a85bf6..4b6bda465cb2a728aa554249309c645bb51150d3 100644 --- a/peridot/lib/testing/session_shell_impl.cc +++ b/peridot/lib/testing/session_shell_impl.cc @@ -25,6 +25,13 @@ void SessionShellImpl::AttachView( on_attach_view_(std::move(view_id)); } +// |SessionShell| +void SessionShellImpl::AttachView2( + fuchsia::modular::ViewIdentifier view_id, + fuchsia::ui::views::ViewHolderToken view_holder_token) { + on_attach_view_(std::move(view_id)); +} + // |SessionShell| void SessionShellImpl::DetachView(fuchsia::modular::ViewIdentifier view_id, fit::function<void()> done) { diff --git a/peridot/lib/testing/session_shell_impl.h b/peridot/lib/testing/session_shell_impl.h index 18569636bb925042be88409321a7a7d7c7e9f001..8093995809d62f9ab0bd0d7418c6d5b91e9f9c18 100644 --- a/peridot/lib/testing/session_shell_impl.h +++ b/peridot/lib/testing/session_shell_impl.h @@ -32,7 +32,7 @@ class SessionShellImpl : fuchsia::modular::SessionShell { fidl::InterfaceRequestHandler<fuchsia::modular::SessionShell> GetHandler(); // Whenever SessionShell.AttachView() is called, the supplied callback is - // invoked with the view ID. The ImportToken is dropped. + // invoked with the view ID. The ViewHolderToken is dropped. void set_on_attach_view(fit::function<void(ViewId view_id)> callback) { on_attach_view_ = std::move(callback); } @@ -57,6 +57,11 @@ class SessionShellImpl : fuchsia::modular::SessionShell { fidl::InterfaceHandle<fuchsia::ui::viewsv1token::ViewOwner> view_owner) override; + // |SessionShell| + void AttachView2( + fuchsia::modular::ViewIdentifier view_id, + fuchsia::ui::views::ViewHolderToken view_holder_token) override; + // |SessionShell| void DetachView(fuchsia::modular::ViewIdentifier view_id, fit::function<void()> done) override; diff --git a/sdk/fidl/fuchsia.modular/fuchsia.modular.api b/sdk/fidl/fuchsia.modular/fuchsia.modular.api index 30231c576013419edc0245198c4e36155afccff8..bb3f4dad238a3683f33a86dda6eb26a1ed8928af 100644 --- a/sdk/fidl/fuchsia.modular/fuchsia.modular.api +++ b/sdk/fidl/fuchsia.modular/fuchsia.modular.api @@ -32,7 +32,7 @@ "fidl/fuchsia.modular/module_resolver/module_resolver.fidl": "e6837b2e15ce3a7a1c899e02110b933d", "fidl/fuchsia.modular/session/device_map.fidl": "3cd55018a8967d8d483fd02d172de98f", "fidl/fuchsia.modular/session/focus.fidl": "7787b6c08cacd6c981d729c952f12f17", - "fidl/fuchsia.modular/session/session_shell.fidl": "8c9a5c08c1ff04ca3c8f3dcd61d01cfc", + "fidl/fuchsia.modular/session/session_shell.fidl": "0fee7f4ea179d0515d0fda320fc20994", "fidl/fuchsia.modular/story/create_link.fidl": "a3e1da920eb02637478b914c2009bf90", "fidl/fuchsia.modular/story/create_module_parameter_map.fidl": "79bf5bdf04655966584b72ff0b1b3066", "fidl/fuchsia.modular/story/link.fidl": "5a0130509caadb5e6263ae76adbccd50", diff --git a/sdk/fidl/fuchsia.modular/session/session_shell.fidl b/sdk/fidl/fuchsia.modular/session/session_shell.fidl index 6f8e7000178181167635bffd103ec75c6fbf25e2..c89c35125a549407301f0b2e453e76b3f62f238a 100644 --- a/sdk/fidl/fuchsia.modular/session/session_shell.fidl +++ b/sdk/fidl/fuchsia.modular/session/session_shell.fidl @@ -7,6 +7,7 @@ library fuchsia.modular; using fuchsia.modular.auth; using fuchsia.speech; using fuchsia.ui.policy; +using fuchsia.ui.views; using fuchsia.ui.viewsv1token; // This interface is implemented by a session shell and is used by the @@ -16,7 +17,11 @@ using fuchsia.ui.viewsv1token; protocol SessionShell { // Displays the given story view. The story this view belongs to is // identified by |view_id.story_id|. + // DEPRECATED. For transitional purposes only. + [Transitional] AttachView(ViewIdentifier view_id, fuchsia.ui.viewsv1token.ViewOwner view_owner); + [Transitional] + AttachView2(ViewIdentifier view_id, fuchsia.ui.views.ViewHolderToken view_holder_token); // Instructs the session shell to detach the view identified by |view_id| // that was previously provided by AttachView() from the UI of the session