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

Side by Side Diff: ui/ozone/platform/dri/native_display_delegate_proxy.cc

Issue 851853002: It is time. (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: Trying to reup because the last upload failed. Created 5 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 #include "ui/ozone/platform/dri/native_display_delegate_proxy.h"
6
7 #include "base/logging.h"
8 #include "ui/display/types/display_snapshot.h"
9 #include "ui/display/types/native_display_observer.h"
10 #include "ui/events/ozone/device/device_event.h"
11 #include "ui/events/ozone/device/device_manager.h"
12 #include "ui/ozone/common/display_snapshot_proxy.h"
13 #include "ui/ozone/common/display_util.h"
14 #include "ui/ozone/common/gpu/ozone_gpu_messages.h"
15 #include "ui/ozone/platform/dri/dri_gpu_platform_support_host.h"
16
17 namespace ui {
18
19 NativeDisplayDelegateProxy::NativeDisplayDelegateProxy(
20 DriGpuPlatformSupportHost* proxy,
21 DeviceManager* device_manager)
22 : proxy_(proxy), device_manager_(device_manager) {
23 proxy_->RegisterHandler(this);
24 }
25
26 NativeDisplayDelegateProxy::~NativeDisplayDelegateProxy() {
27 if (device_manager_)
28 device_manager_->RemoveObserver(this);
29
30 proxy_->UnregisterHandler(this);
31 }
32
33 void NativeDisplayDelegateProxy::Initialize() {
34 if (device_manager_)
35 device_manager_->AddObserver(this);
36 }
37
38 void NativeDisplayDelegateProxy::GrabServer() {
39 }
40
41 void NativeDisplayDelegateProxy::UngrabServer() {
42 }
43
44 void NativeDisplayDelegateProxy::SyncWithServer() {
45 }
46
47 void NativeDisplayDelegateProxy::SetBackgroundColor(uint32_t color_argb) {
48 NOTIMPLEMENTED();
49 }
50
51 void NativeDisplayDelegateProxy::ForceDPMSOn() {
52 proxy_->Send(new OzoneGpuMsg_ForceDPMSOn());
53 }
54
55 std::vector<DisplaySnapshot*> NativeDisplayDelegateProxy::GetDisplays() {
56 return displays_.get();
57 }
58
59 void NativeDisplayDelegateProxy::AddMode(const DisplaySnapshot& output,
60 const DisplayMode* mode) {
61 }
62
63 bool NativeDisplayDelegateProxy::Configure(const DisplaySnapshot& output,
64 const DisplayMode* mode,
65 const gfx::Point& origin) {
66 // TODO(dnicoara) Should handle an asynchronous response.
67 if (mode)
68 proxy_->Send(new OzoneGpuMsg_ConfigureNativeDisplay(
69 output.display_id(), GetDisplayModeParams(*mode), origin));
70 else
71 proxy_->Send(new OzoneGpuMsg_DisableNativeDisplay(output.display_id()));
72
73 return true;
74 }
75
76 void NativeDisplayDelegateProxy::CreateFrameBuffer(const gfx::Size& size) {
77 }
78
79 bool NativeDisplayDelegateProxy::GetHDCPState(const DisplaySnapshot& output,
80 HDCPState* state) {
81 NOTIMPLEMENTED();
82 return false;
83 }
84
85 bool NativeDisplayDelegateProxy::SetHDCPState(const DisplaySnapshot& output,
86 HDCPState state) {
87 NOTIMPLEMENTED();
88 return false;
89 }
90
91 std::vector<ColorCalibrationProfile>
92 NativeDisplayDelegateProxy::GetAvailableColorCalibrationProfiles(
93 const DisplaySnapshot& output) {
94 NOTIMPLEMENTED();
95 return std::vector<ColorCalibrationProfile>();
96 }
97
98 bool NativeDisplayDelegateProxy::SetColorCalibrationProfile(
99 const DisplaySnapshot& output,
100 ColorCalibrationProfile new_profile) {
101 NOTIMPLEMENTED();
102 return false;
103 }
104
105 void NativeDisplayDelegateProxy::AddObserver(NativeDisplayObserver* observer) {
106 observers_.AddObserver(observer);
107 }
108
109 void NativeDisplayDelegateProxy::RemoveObserver(
110 NativeDisplayObserver* observer) {
111 observers_.RemoveObserver(observer);
112 }
113
114 void NativeDisplayDelegateProxy::OnDeviceEvent(const DeviceEvent& event) {
115 if (event.device_type() != DeviceEvent::DISPLAY)
116 return;
117
118 if (event.action_type() == DeviceEvent::CHANGE) {
119 VLOG(1) << "Got display changed event";
120 proxy_->Send(new OzoneGpuMsg_RefreshNativeDisplays(
121 std::vector<DisplaySnapshot_Params>()));
122 }
123 }
124
125 void NativeDisplayDelegateProxy::OnChannelEstablished(int host_id,
126 IPC::Sender* sender) {
127 std::vector<DisplaySnapshot_Params> display_params;
128 for (size_t i = 0; i < displays_.size(); ++i)
129 display_params.push_back(GetDisplaySnapshotParams(*displays_[i]));
130
131 // Force an initial configure such that the browser process can get the actual
132 // state. Pass in the current display state since the GPU process may have
133 // crashed and we want to re-synchronize the state between processes.
134 proxy_->Send(new OzoneGpuMsg_RefreshNativeDisplays(display_params));
135 }
136
137 void NativeDisplayDelegateProxy::OnChannelDestroyed(int host_id) {
138 }
139
140 bool NativeDisplayDelegateProxy::OnMessageReceived(
141 const IPC::Message& message) {
142 bool handled = true;
143
144 IPC_BEGIN_MESSAGE_MAP(NativeDisplayDelegateProxy, message)
145 IPC_MESSAGE_HANDLER(OzoneHostMsg_UpdateNativeDisplays, OnUpdateNativeDisplays)
146 IPC_MESSAGE_UNHANDLED(handled = false)
147 IPC_END_MESSAGE_MAP()
148
149 return handled;
150 }
151
152 void NativeDisplayDelegateProxy::OnUpdateNativeDisplays(
153 const std::vector<DisplaySnapshot_Params>& displays) {
154 displays_.clear();
155 for (size_t i = 0; i < displays.size(); ++i)
156 displays_.push_back(new DisplaySnapshotProxy(displays[i]));
157
158 FOR_EACH_OBSERVER(
159 NativeDisplayObserver, observers_, OnConfigurationChanged());
160 }
161
162 } // namespace ui
OLDNEW
« no previous file with comments | « ui/ozone/platform/dri/native_display_delegate_proxy.h ('k') | ui/ozone/platform/dri/overlay_plane.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698