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

Unified Diff: components/mus/example/common/mus_views_init.cc

Issue 1390353007: Adds MUSViewsInit (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fix windows Created 5 years, 2 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: components/mus/example/common/mus_views_init.cc
diff --git a/components/mus/example/common/mus_views_init.cc b/components/mus/example/common/mus_views_init.cc
new file mode 100644
index 0000000000000000000000000000000000000000..e1f4fafc96c5928da88dd849d03bf650457ca22d
--- /dev/null
+++ b/components/mus/example/common/mus_views_init.cc
@@ -0,0 +1,59 @@
+// 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 "components/mus/example/common/mus_views_init.h"
+
+#include "components/mus/example/wm/wm.mojom.h"
+#include "components/mus/public/cpp/view_tree_connection.h"
+#include "components/mus/public/interfaces/view_tree.mojom.h"
+#include "mandoline/ui/aura/aura_init.h"
+#include "mandoline/ui/aura/native_widget_view_manager.h"
+#include "mojo/application/public/cpp/application_connection.h"
+#include "mojo/application/public/cpp/application_impl.h"
+
+MUSViewsInit::MUSViewsInit(mojo::ApplicationImpl* app) : app_(app) {}
+
+MUSViewsInit::~MUSViewsInit() {}
+
+mus::View* MUSViewsInit::CreateWindow() {
+ mojom::WMPtr wm;
+ mojo::URLRequestPtr request(mojo::URLRequest::New());
+ request->url = "mojo:example_wm";
+ app_->ConnectToService(request.Pass(), &wm);
+ mojo::ViewTreeClientPtr view_tree_client;
+ mojo::InterfaceRequest<mojo::ViewTreeClient> view_tree_client_request =
+ GetProxy(&view_tree_client);
+ wm->OpenWindow(view_tree_client.Pass());
+ mus::ViewTreeConnection* view_tree_connection =
+ mus::ViewTreeConnection::Create(
+ this, view_tree_client_request.Pass(),
+ mus::ViewTreeConnection::CreateType::WAIT_FOR_EMBED);
+ DCHECK(view_tree_connection->GetRoot());
+ return view_tree_connection->GetRoot();
+}
+
+views::NativeWidget* MUSViewsInit::CreateNativeWidget(
+ views::internal::NativeWidgetDelegate* delegate) {
+ return new mandoline::NativeWidgetViewManager(delegate, app_->shell(),
+ CreateWindow());
+}
+
+void MUSViewsInit::OnBeforeWidgetInit(
+ views::Widget::InitParams* params,
+ views::internal::NativeWidgetDelegate* delegate) {}
+
+void MUSViewsInit::OnEmbed(mus::View* root) {
+ if (!aura_init_) {
+ aura_init_.reset(
+ new mandoline::AuraInit(root, app_->shell(), "example_resources.pak"));
+ }
+}
+
+void MUSViewsInit::OnConnectionLost(mus::ViewTreeConnection* connection) {}
+
+#if defined(OS_WIN)
+HICON MUSViewsInit::GetSmallWindowIcon() const {
+ return nullptr;
+}
+#endif
« no previous file with comments | « components/mus/example/common/mus_views_init.h ('k') | components/mus/example/window_type_launcher/BUILD.gn » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698