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

Unified Diff: services/ui/demo/mus_demo_internal.cc

Issue 2693923004: Mus Demo: Extract code specific to internal mode into a separate class (Closed)
Patch Set: Created 3 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
Index: services/ui/demo/mus_demo_internal.cc
diff --git a/services/ui/demo/mus_demo_internal.cc b/services/ui/demo/mus_demo_internal.cc
new file mode 100644
index 0000000000000000000000000000000000000000..93a3e277093c6b8570b8d8af293162e3ca5d497c
--- /dev/null
+++ b/services/ui/demo/mus_demo_internal.cc
@@ -0,0 +1,100 @@
+// Copyright 2017 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 "services/ui/demo/mus_demo_internal.h"
+#include "services/service_manager/public/cpp/service_context.h"
+#include "ui/aura/mus/window_tree_client.h"
+#include "ui/aura/mus/window_tree_host_mus.h"
+
+namespace ui {
+namespace demo {
+
+// Size of square in pixels to draw.
+const int kSquareSize = 300;
kylechar 2017/02/14 18:40:11 Put this in an anonymous namespace.
fwang 2017/02/15 13:49:26 Done.
+
+MusDemoInternal::MusDemoInternal() {}
+
+void MusDemoInternal::OnStartImpl() {
+ window_tree_client_ = base::MakeUnique<aura::WindowTreeClient>(
+ context()->connector(), this, this);
+ window_tree_client_->ConnectAsWindowManager();
+}
+
+void MusDemoInternal::SetWindowManagerClient(
+ aura::WindowManagerClient* client) {}
+
+bool MusDemoInternal::OnWmSetBounds(aura::Window* window, gfx::Rect* bounds) {
+ return true;
+}
+
+bool MusDemoInternal::OnWmSetProperty(
+ aura::Window* window,
+ const std::string& name,
+ std::unique_ptr<std::vector<uint8_t>>* new_data) {
+ return true;
+}
+
+void MusDemoInternal::OnWmSetCanFocus(aura::Window* window, bool can_focus) {}
+
+aura::Window* MusDemoInternal::OnWmCreateTopLevelWindow(
+ mojom::WindowType window_type,
+ std::map<std::string, std::vector<uint8_t>>* properties) {
+ NOTREACHED();
+ return nullptr;
+}
+
+void MusDemoInternal::OnWmClientJankinessChanged(
+ const std::set<aura::Window*>& client_windows,
+ bool janky) {
+ // Don't care
+}
+
+void MusDemoInternal::OnWmWillCreateDisplay(const display::Display& display) {
+ screen_->display_list().AddDisplay(display,
+ display::DisplayList::Type::PRIMARY);
+}
+
+void MusDemoInternal::OnWmNewDisplay(
+ std::unique_ptr<aura::WindowTreeHostMus> window_tree_host,
+ const display::Display& display) {
+ DCHECK(!window_tree_data_); // Only support one display.
+ window_tree_data_ = base::MakeUnique<WindowTreeData>(
+ std::move(window_tree_host), kSquareSize);
+}
+
+void MusDemoInternal::OnWmDisplayRemoved(
+ aura::WindowTreeHostMus* window_tree_host) {
+ window_tree_data_.reset();
+}
+
+void MusDemoInternal::OnWmDisplayModified(const display::Display& display) {}
+
+mojom::EventResult MusDemoInternal::OnAccelerator(uint32_t id,
+ const Event& event) {
+ return mojom::EventResult::UNHANDLED;
+}
+
+void MusDemoInternal::OnWmPerformMoveLoop(
+ aura::Window* window,
+ mojom::MoveLoopSource source,
+ const gfx::Point& cursor_location,
+ const base::Callback<void(bool)>& on_done) {
+ // Don't care
+}
+
+void MusDemoInternal::OnWmCancelMoveLoop(aura::Window* window) {}
+
+void MusDemoInternal::OnWmSetClientArea(
+ aura::Window* window,
+ const gfx::Insets& insets,
+ const std::vector<gfx::Rect>& additional_client_areas) {}
+
+bool MusDemoInternal::IsWindowActive(aura::Window* window) {
+ return false;
+}
+
+void MusDemoInternal::OnWmDeactivateWindow(aura::Window* window) {}
+
+} // namespace demo
+} // namespace aura

Powered by Google App Engine
This is Rietveld 408576698