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

Unified Diff: services/view_manager/display_manager.h

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
« no previous file with comments | « services/view_manager/default_access_policy.cc ('k') | services/view_manager/display_manager.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: services/view_manager/display_manager.h
diff --git a/services/view_manager/display_manager.h b/services/view_manager/display_manager.h
new file mode 100644
index 0000000000000000000000000000000000000000..99b6a46b1c1f9b170b36efe8d91eaafd443964e5
--- /dev/null
+++ b/services/view_manager/display_manager.h
@@ -0,0 +1,91 @@
+// 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.
+
+#ifndef SERVICES_VIEW_MANAGER_DISPLAY_MANAGER_H_
+#define SERVICES_VIEW_MANAGER_DISPLAY_MANAGER_H_
+
+#include <map>
+
+#include "base/macros.h"
+#include "base/memory/scoped_ptr.h"
+#include "base/memory/weak_ptr.h"
+#include "base/timer/timer.h"
+#include "mojo/public/cpp/bindings/callback.h"
+#include "mojo/services/native_viewport/interfaces/native_viewport.mojom.h"
+#include "mojo/services/surfaces/interfaces/display.mojom.h"
+#include "mojo/services/view_manager/interfaces/view_manager.mojom.h"
+#include "ui/gfx/rect.h"
+
+namespace cc {
+class SurfaceIdAllocator;
+}
+
+namespace mojo {
+class ApplicationConnection;
+class ApplicationImpl;
+}
+
+namespace view_manager {
+
+class ConnectionManager;
+class ServerView;
+
+// DisplayManager is used to connect the root ServerView to a display.
+class DisplayManager {
+ public:
+ virtual ~DisplayManager() {}
+
+ virtual void Init(ConnectionManager* connection_manager) = 0;
+
+ // Schedules a paint for the specified region in the coordinates of |view|.
+ virtual void SchedulePaint(const ServerView* view,
+ const gfx::Rect& bounds) = 0;
+
+ virtual void SetViewportSize(const gfx::Size& size) = 0;
+
+ virtual const mojo::ViewportMetrics& GetViewportMetrics() = 0;
+};
+
+// DisplayManager implementation that connects to the services necessary to
+// actually display.
+class DefaultDisplayManager : public DisplayManager {
+ public:
+ DefaultDisplayManager(mojo::ApplicationImpl* app_impl,
+ mojo::ApplicationConnection* app_connection,
+ const mojo::Closure& native_viewport_closed_callback);
+ ~DefaultDisplayManager() override;
+
+ // DisplayManager:
+ void Init(ConnectionManager* connection_manager) override;
+ void SchedulePaint(const ServerView* view, const gfx::Rect& bounds) override;
+ void SetViewportSize(const gfx::Size& size) override;
+ const mojo::ViewportMetrics& GetViewportMetrics() override;
+
+ private:
+ void WantToDraw();
+ void Draw();
+ void DidDraw();
+
+ void OnMetricsChanged(mojo::ViewportMetricsPtr metrics);
+
+ mojo::ApplicationImpl* app_impl_;
+ mojo::ApplicationConnection* app_connection_;
+ ConnectionManager* connection_manager_;
+
+ mojo::ViewportMetrics metrics_;
+ gfx::Rect dirty_rect_;
+ base::Timer draw_timer_;
+ bool frame_pending_;
+
+ mojo::DisplayPtr display_;
+ mojo::NativeViewportPtr native_viewport_;
+ mojo::Closure native_viewport_closed_callback_;
+ base::WeakPtrFactory<DefaultDisplayManager> weak_factory_;
+
+ DISALLOW_COPY_AND_ASSIGN(DefaultDisplayManager);
+};
+
+} // namespace view_manager
+
+#endif // SERVICES_VIEW_MANAGER_DISPLAY_MANAGER_H_
« no previous file with comments | « services/view_manager/default_access_policy.cc ('k') | services/view_manager/display_manager.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698