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

Side by Side Diff: services/ui/display/screen_manager_forwarding.h

Issue 2805633004: Add Mojo NativeDisplayDelegate / NativeDisplayObserver. (Closed)
Patch Set: Created 3 years, 8 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 2017 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_UI_DISPLAY_SCREEN_MANAGER_FORWARDING_H_
6 #define SERVICES_UI_DISPLAY_SCREEN_MANAGER_FORWARDING_H_
7
8 #include <memory>
9 #include <unordered_map>
10 #include <vector>
11
12 #include "base/macros.h"
13 #include "base/memory/weak_ptr.h"
14 #include "mojo/public/cpp/bindings/binding.h"
15 #include "services/service_manager/public/cpp/interface_factory.h"
16 #include "services/ui/display/screen_manager.h"
17 #include "ui/display/mojo/native_display_delegate.mojom.h"
18 #include "ui/display/types/native_display_observer.h"
19
20 namespace display {
21
22 class NativeDisplayDelegate;
23
24 // ScreenManager implementation that implements mojom::NativeDisplayDelegate.
25 // This will own a real NativeDisplayDelegate and forwards calls to and
sky 2017/04/06 20:30:20 ' ' -> ' '
kylechar 2017/04/07 13:52:16 Done.
26 // responses from it over Mojo.
27 class ScreenManagerForwarding
28 : public ScreenManager,
29 public NativeDisplayObserver,
30 public mojom::NativeDisplayDelegate,
31 service_manager::InterfaceFactory<mojom::NativeDisplayDelegate> {
32 public:
33 ScreenManagerForwarding();
34 ~ScreenManagerForwarding() override;
35
36 // ScreenManager:
37 void AddInterfaces(service_manager::InterfaceRegistry* registry) override;
38 void Init(ScreenManagerDelegate* delegate) override;
39 void RequestCloseDisplay(int64_t display_id) override;
40
41 // NativeDisplayObserver:
42 void OnConfigurationChanged() override;
43 void OnDisplaySnapshotsInvalidated() override;
44
45 // mojom::NativeDisplayDelegate:
46 void RegisterObserver(mojom::NativeDisplayObserverPtr observer) override;
47 void Initialize() override;
48 void TakeDisplayControl(const TakeDisplayControlCallback& callback) override;
49 void RelinquishDisplayControl(
50 const RelinquishDisplayControlCallback& callback) override;
51 void GetDisplays(const GetDisplaysCallback& callback) override;
52 void Configure(int64_t display_id,
53 std::unique_ptr<display::DisplayMode> mode,
54 const gfx::Point& origin,
55 const ConfigureCallback& callback) override;
56 void GetHDCPState(int64_t display_id,
57 const GetHDCPStateCallback& callback) override;
58 void SetHDCPState(int64_t display_id,
59 display::HDCPState state,
60 const SetHDCPStateCallback& callback) override;
61 void SetColorCorrection(
62 int64_t display_id,
63 const std::vector<display::GammaRampRGBEntry>& degamma_lut,
64 const std::vector<display::GammaRampRGBEntry>& gamma_lut,
65 const std::vector<float>& correction_matrix) override;
66
67 // service_manager::InterfaceFactory<mojom::NativeDisplayDelegate>:
68 void Create(const service_manager::Identity& remote_identity,
69 mojom::NativeDisplayDelegateRequest request) override;
70
71 private:
72 // Forwards results from GetDisplays() back with |callback|.
73 void ForwardGetDisplays(
74 const mojom::NativeDisplayDelegate::GetDisplaysCallback& callback,
75 const std::vector<DisplaySnapshot*>& displays);
76
77 // Forwards results from call to Configure() back with |callback|.
78 void ForwardConfigure(
79 DisplaySnapshot* snapshot,
80 const DisplayMode* mode,
81 const gfx::Point& origin,
82 const mojom::NativeDisplayDelegate::ConfigureCallback& callback,
83 bool status);
84
85 mojo::Binding<mojom::NativeDisplayDelegate> binding_;
86 mojom::NativeDisplayObserverPtr observer_;
87
88 std::unique_ptr<display::NativeDisplayDelegate> native_display_delegate_;
89
90 // Lookup display snapshots for a particular display id.
91 std::unordered_map<int64_t, DisplaySnapshot*> snapshot_map_;
sky 2017/04/06 20:30:20 Who owns the values in this map? It seems like the
kylechar 2017/04/07 13:52:16 DisplaySnapshot* are passed out of NDD and it's as
92
93 base::WeakPtrFactory<ScreenManagerForwarding> weak_ptr_factory_;
94
95 DISALLOW_COPY_AND_ASSIGN(ScreenManagerForwarding);
96 };
97
98 } // namespace display
99
100 #endif // SERVICES_UI_DISPLAY_SCREEN_MANAGER_FORWARDING_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698