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

Unified Diff: mojo/ui/base_view.cc

Issue 1556803002: Add helpers for creating UI components. (Closed) Base URL: git@github.com:domokit/mojo.git@moz-13
Patch Set: Created 4 years, 12 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
Index: mojo/ui/base_view.cc
diff --git a/mojo/ui/base_view.cc b/mojo/ui/base_view.cc
new file mode 100644
index 0000000000000000000000000000000000000000..b58faf4104e0f0ef0138561587a0f7020763c35b
--- /dev/null
+++ b/mojo/ui/base_view.cc
@@ -0,0 +1,36 @@
+// Copyright 2015 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 "mojo/ui/base_view.h"
+
+#include "base/logging.h"
+
+namespace mojo {
+namespace ui {
+
+BaseView::BaseView(
+ mojo::ApplicationImpl* app_impl,
+ const std::string& label,
+ const mojo::ui::ViewProvider::CreateViewCallback& create_view_callback)
+ : app_impl_(app_impl), view_binding_(this) {
+ DCHECK(app_impl_);
+ app_impl_->ConnectToService("mojo:view_manager_service", &view_manager_);
+
+ mojo::ui::ViewPtr view;
+ view_binding_.Bind(mojo::GetProxy(&view));
+ view_manager_->RegisterView(view.Pass(), mojo::GetProxy(&view_host_), label,
+ create_view_callback);
+ view_host_->CreateScene(mojo::GetProxy(&scene_));
+ view_host_->GetServiceProvider(mojo::GetProxy(&view_service_provider_));
+}
+
+BaseView::~BaseView() {}
+
+void BaseView::OnChildUnavailable(uint32_t child_key,
+ const OnChildUnavailableCallback& callback) {
+ callback.Run();
+}
+
+} // namespace ui
+} // namespace mojo

Powered by Google App Engine
This is Rietveld 408576698