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

Side by Side Diff: services/view_manager/display_manager.h

Issue 1531403003: Delete the ViewManager and WindowManager services. (Closed) Base URL: git@github.com:domokit/mojo.git@moz-3
Patch Set: rebase 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 unified diff | Download patch
OLDNEW
(Empty)
1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #ifndef SERVICES_VIEW_MANAGER_DISPLAY_MANAGER_H_
6 #define SERVICES_VIEW_MANAGER_DISPLAY_MANAGER_H_
7
8 #include <map>
9
10 #include "base/macros.h"
11 #include "base/memory/scoped_ptr.h"
12 #include "base/memory/weak_ptr.h"
13 #include "base/timer/timer.h"
14 #include "mojo/public/cpp/bindings/callback.h"
15 #include "mojo/services/native_viewport/interfaces/native_viewport.mojom.h"
16 #include "mojo/services/surfaces/interfaces/display.mojom.h"
17 #include "mojo/services/view_manager/interfaces/view_manager.mojom.h"
18 #include "ui/gfx/rect.h"
19
20 namespace cc {
21 class SurfaceIdAllocator;
22 }
23
24 namespace mojo {
25 class ApplicationConnection;
26 class ApplicationImpl;
27 }
28
29 namespace view_manager {
30
31 class ConnectionManager;
32 class ServerView;
33
34 // DisplayManager is used to connect the root ServerView to a display.
35 class DisplayManager {
36 public:
37 virtual ~DisplayManager() {}
38
39 virtual void Init(ConnectionManager* connection_manager) = 0;
40
41 // Schedules a paint for the specified region in the coordinates of |view|.
42 virtual void SchedulePaint(const ServerView* view,
43 const gfx::Rect& bounds) = 0;
44
45 virtual void SetViewportSize(const gfx::Size& size) = 0;
46
47 virtual const mojo::ViewportMetrics& GetViewportMetrics() = 0;
48 };
49
50 // DisplayManager implementation that connects to the services necessary to
51 // actually display.
52 class DefaultDisplayManager : public DisplayManager {
53 public:
54 DefaultDisplayManager(mojo::ApplicationImpl* app_impl,
55 mojo::ApplicationConnection* app_connection,
56 const mojo::Closure& native_viewport_closed_callback);
57 ~DefaultDisplayManager() override;
58
59 // DisplayManager:
60 void Init(ConnectionManager* connection_manager) override;
61 void SchedulePaint(const ServerView* view, const gfx::Rect& bounds) override;
62 void SetViewportSize(const gfx::Size& size) override;
63 const mojo::ViewportMetrics& GetViewportMetrics() override;
64
65 private:
66 void WantToDraw();
67 void Draw();
68 void DidDraw();
69
70 void OnMetricsChanged(mojo::ViewportMetricsPtr metrics);
71
72 mojo::ApplicationImpl* app_impl_;
73 mojo::ApplicationConnection* app_connection_;
74 ConnectionManager* connection_manager_;
75
76 mojo::ViewportMetrics metrics_;
77 gfx::Rect dirty_rect_;
78 base::Timer draw_timer_;
79 bool frame_pending_;
80
81 mojo::DisplayPtr display_;
82 mojo::NativeViewportPtr native_viewport_;
83 mojo::Closure native_viewport_closed_callback_;
84 base::WeakPtrFactory<DefaultDisplayManager> weak_factory_;
85
86 DISALLOW_COPY_AND_ASSIGN(DefaultDisplayManager);
87 };
88
89 } // namespace view_manager
90
91 #endif // SERVICES_VIEW_MANAGER_DISPLAY_MANAGER_H_
OLDNEW
« 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