Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(130)

Unified Diff: services/ui/launcher/launcher_app.cc

Issue 1679023006: Reify view ownership as a message pipe. (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Created 4 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « services/ui/launcher/launcher_app.h ('k') | services/ui/launcher/launcher_view_tree.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: services/ui/launcher/launcher_app.cc
diff --git a/services/ui/launcher/launcher_app.cc b/services/ui/launcher/launcher_app.cc
index 55a58bea03c85736a34cafc587521bd2eda43e3a..08572b4b0dbec3f82e1490278ce1705d0a7ff3b5 100644
--- a/services/ui/launcher/launcher_app.cc
+++ b/services/ui/launcher/launcher_app.cc
@@ -12,6 +12,7 @@
#include "mojo/public/c/system/main.h"
#include "mojo/public/cpp/application/application_connection.h"
#include "mojo/public/cpp/application/application_impl.h"
+#include "mojo/services/ui/views/interfaces/view_provider.mojom.h"
#include "services/ui/launcher/launcher_view_tree.h"
namespace launcher {
@@ -97,7 +98,8 @@ void LauncherApp::OnViewportCreated(mojo::ViewportMetricsPtr metrics) {
compositor_.get(), view_manager_.get(), context_provider.Pass(),
metrics.Pass(),
base::Bind(&LauncherApp::Shutdown, base::Unretained(this))));
- UpdateClientView();
+ view_tree_->SetRoot(client_view_owner_.Pass());
+
RequestUpdatedViewportMetrics();
}
@@ -123,28 +125,11 @@ void LauncherApp::OnEvent(mojo::EventPtr event,
void LauncherApp::LaunchClient(std::string app_url) {
DVLOG(1) << "Launching " << app_url;
- app_impl_->ConnectToService(app_url, &client_view_provider_);
- client_view_provider_.set_connection_error_handler(base::Bind(
- &LauncherApp::OnClientConnectionError, base::Unretained(this)));
-
- client_view_provider_->CreateView(
- nullptr, nullptr,
- base::Bind(&LauncherApp::OnClientViewCreated, base::Unretained(this)));
-}
+ mojo::ui::ViewProviderPtr client_view_provider;
+ app_impl_->ConnectToService(app_url, &client_view_provider);
-void LauncherApp::OnClientConnectionError() {
- LOG(ERROR) << "Exiting due to client application connection error.";
- Shutdown();
-}
-
-void LauncherApp::OnClientViewCreated(mojo::ui::ViewTokenPtr view_token) {
- client_view_token_ = view_token.Pass();
- UpdateClientView();
-}
-
-void LauncherApp::UpdateClientView() {
- if (view_tree_)
- view_tree_->SetRoot(client_view_token_.Clone());
+ client_view_provider->CreateView(mojo::GetProxy(&client_view_owner_), nullptr,
+ nullptr);
}
void LauncherApp::Shutdown() {
« no previous file with comments | « services/ui/launcher/launcher_app.h ('k') | services/ui/launcher/launcher_view_tree.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698