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

Unified Diff: mojo/services/view_manager/cpp/lib/view_manager_context.cc

Issue 1536713004: Revert "Delete the ViewManager and WindowManager services." (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: Created 5 years 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
Index: mojo/services/view_manager/cpp/lib/view_manager_context.cc
diff --git a/mojo/services/view_manager/cpp/lib/view_manager_context.cc b/mojo/services/view_manager/cpp/lib/view_manager_context.cc
new file mode 100644
index 0000000000000000000000000000000000000000..adef60afba7b272f7148ae9d71df351247d16414
--- /dev/null
+++ b/mojo/services/view_manager/cpp/lib/view_manager_context.cc
@@ -0,0 +1,45 @@
+// Copyright 2014 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "view_manager/cpp/view_manager_context.h"
+
+#include "mojo/public/cpp/application/application_impl.h"
+#include "mojo/public/cpp/bindings/interface_request.h"
+#include "window_manager/interfaces/window_manager.mojom.h"
+
+namespace mojo {
+class ApplicationImpl;
+
+class ViewManagerContext::InternalState {
+ public:
+ explicit InternalState(ApplicationImpl* application_impl) {
+ application_impl->ConnectToService("mojo:window_manager", &wm_);
+ }
+ ~InternalState() {}
+
+ WindowManager* wm() { return wm_.get(); }
+
+ private:
+ WindowManagerPtr wm_;
+
+ MOJO_DISALLOW_COPY_AND_ASSIGN(InternalState);
+};
+
+ViewManagerContext::ViewManagerContext(ApplicationImpl* application_impl)
+ : state_(new InternalState(application_impl)) {}
+ViewManagerContext::~ViewManagerContext() {
+ delete state_;
+}
+
+void ViewManagerContext::Embed(const String& url) {
+ Embed(url, nullptr, nullptr);
+}
+
+void ViewManagerContext::Embed(const String& url,
+ InterfaceRequest<ServiceProvider> services,
+ ServiceProviderPtr exposed_services) {
+ state_->wm()->Embed(url, services.Pass(), exposed_services.Pass());
+}
+
+} // namespace mojo
« no previous file with comments | « mojo/services/view_manager/cpp/lib/view_manager_client_impl.cc ('k') | mojo/services/view_manager/cpp/lib/view_observer.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698