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

Unified Diff: ui/views/mus/screen_mus.h

Issue 1615023004: Start of display management for mus (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fix crash and add back getting constants Created 4 years, 11 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 | « ui/views/mus/BUILD.gn ('k') | ui/views/mus/screen_mus.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/views/mus/screen_mus.h
diff --git a/ui/views/mus/screen_mus.h b/ui/views/mus/screen_mus.h
new file mode 100644
index 0000000000000000000000000000000000000000..16adc16949babdaf5d4348081d2c51b6c247c9a7
--- /dev/null
+++ b/ui/views/mus/screen_mus.h
@@ -0,0 +1,71 @@
+// Copyright 2016 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.
+
+#ifndef UI_VIEWS_MUS_SCREEN_MUS_H_
+#define UI_VIEWS_MUS_SCREEN_MUS_H_
+
+#include <vector>
+
+#include "base/observer_list.h"
+#include "components/mus/public/interfaces/display.mojom.h"
+#include "mojo/public/cpp/bindings/binding.h"
+#include "ui/gfx/display.h"
+#include "ui/gfx/screen.h"
+#include "ui/views/mus/mus_export.h"
+
+namespace mojo {
+class ApplicationImpl;
+}
+
+namespace views {
+
+// Screen implementation backed by mus::mojom::DisplayManager.
+class VIEWS_MUS_EXPORT ScreenMus
+ : public gfx::Screen,
+ public NON_EXPORTED_BASE(mus::mojom::DisplayManagerObserver) {
+ public:
+ ScreenMus();
+ ~ScreenMus() override;
+
+ void Init(mojo::ApplicationImpl* app);
+
+ private:
+ int FindDisplayIndexById(int64_t id) const;
+
+ // Invoked when a display changed in some weay, including being added.
+ // If |is_primary| is true, |changed_display| is the primary display.
+ void ProcessDisplayChanged(const gfx::Display& changed_display,
+ bool is_primary);
+
+ // gfx::Screen:
+ gfx::Point GetCursorScreenPoint() override;
+ gfx::NativeWindow GetWindowUnderCursor() override;
+ gfx::NativeWindow GetWindowAtScreenPoint(const gfx::Point& point) override;
+ gfx::Display GetPrimaryDisplay() const override;
+ gfx::Display GetDisplayNearestWindow(gfx::NativeView view) const override;
+ gfx::Display GetDisplayNearestPoint(const gfx::Point& point) const override;
+ int GetNumDisplays() const override;
+ std::vector<gfx::Display> GetAllDisplays() const override;
+ gfx::Display GetDisplayMatching(const gfx::Rect& match_rect) const override;
+ void AddObserver(gfx::DisplayObserver* observer) override;
+ void RemoveObserver(gfx::DisplayObserver* observer) override;
+
+ // mus::mojom::DisplayManager:
+ void OnDisplays(mojo::Array<mus::mojom::DisplayPtr> displays) override;
+ void OnDisplaysChanged(mojo::Array<mus::mojom::DisplayPtr> display) override;
+ void OnDisplayRemoved(int64_t id) override;
+
+ mus::mojom::DisplayManagerPtr display_manager_;
+ std::vector<gfx::Display> displays_;
+ int primary_display_index_;
+ mojo::Binding<mus::mojom::DisplayManagerObserver>
+ display_manager_observer_binding_;
+ base::ObserverList<gfx::DisplayObserver> observers_;
+
+ DISALLOW_COPY_AND_ASSIGN(ScreenMus);
+};
+
+} // namespace views
+
+#endif // UI_VIEWS_MUS_SCREEN_MUS_H_
« no previous file with comments | « ui/views/mus/BUILD.gn ('k') | ui/views/mus/screen_mus.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698