Chromium Code Reviews| Index: ui/ozone/platform/dri/gpu_platform_support_host_gbm.cc |
| diff --git a/ui/ozone/platform/dri/gpu_platform_support_host_gbm.cc b/ui/ozone/platform/dri/gpu_platform_support_host_gbm.cc |
| index 39478bd427f5af0b2c3b5eba6be9e736997a64e2..2dc866633e7ab48690da1ab5bc667d2dce584e82 100644 |
| --- a/ui/ozone/platform/dri/gpu_platform_support_host_gbm.cc |
| +++ b/ui/ozone/platform/dri/gpu_platform_support_host_gbm.cc |
| @@ -4,18 +4,35 @@ |
| #include "ui/ozone/platform/dri/gpu_platform_support_host_gbm.h" |
| +#include "ui/ozone/common/chromeos/display_snapshot_proxy.h" |
| +#include "ui/ozone/common/chromeos/display_util.h" |
| #include "ui/ozone/common/gpu/ozone_gpu_messages.h" |
| +#include "ui/ozone/platform/dri/chromeos/native_display_delegate_proxy.h" |
| namespace ui { |
| +namespace { |
| + |
| +} // namespace |
| + |
| GpuPlatformSupportHostGbm::GpuPlatformSupportHostGbm() |
| : host_id_(-1), sender_(NULL) { |
| +#if defined(OS_CHROMEOS) |
| + ndd_ = NULL; |
| +#endif |
| } |
| void GpuPlatformSupportHostGbm::OnChannelEstablished(int host_id, |
| IPC::Sender* sender) { |
| host_id_ = host_id; |
| sender_ = sender; |
| + |
| +#if defined(OS_CHROMEOS) |
| + // Force an initial configure such that the browser process can get the actual |
| + // state. |
| + if (ndd_) |
| + RefreshNativeDisplays(); |
| +#endif |
| } |
| void GpuPlatformSupportHostGbm::OnChannelDestroyed(int host_id) { |
| @@ -26,7 +43,17 @@ void GpuPlatformSupportHostGbm::OnChannelDestroyed(int host_id) { |
| } |
| bool GpuPlatformSupportHostGbm::OnMessageReceived(const IPC::Message& message) { |
| - return false; |
| + bool handled = true; |
| + |
| + IPC_BEGIN_MESSAGE_MAP(GpuPlatformSupportHostGbm, message) |
| +#if defined(OS_CHROMEOS) |
| + IPC_MESSAGE_HANDLER(OzoneHostMsg_UpdateNativeDisplays, |
| + OnUpdateNativeDisplays) |
| +#endif |
| + IPC_MESSAGE_UNHANDLED(handled = false); |
| + IPC_END_MESSAGE_MAP() |
| + |
|
spang
2014/07/08 14:40:53
same here.. could do
if (!handled)
handled = di
dnicoara
2014/07/08 17:13:35
Done.
|
| + return handled; |
| } |
| void GpuPlatformSupportHostGbm::SetHardwareCursor(gfx::AcceleratedWidget widget, |
| @@ -43,4 +70,42 @@ void GpuPlatformSupportHostGbm::MoveHardwareCursor( |
| sender_->Send(new OzoneGpuMsg_CursorMove(widget, location)); |
| } |
| +#if defined(OS_CHROMEOS) |
| +void GpuPlatformSupportHostGbm::ForceDPMSOn() { |
| + if (sender_) |
| + sender_->Send(new OzoneGpuMsg_ForceDPMSOn()); |
| +} |
| + |
| +void GpuPlatformSupportHostGbm::RefreshNativeDisplays() { |
| + if (sender_) |
| + sender_->Send(new OzoneGpuMsg_RefreshNativeDisplays()); |
| +} |
| + |
| +void GpuPlatformSupportHostGbm::ConfigureNativeDisplay( |
| + int64_t id, const DisplayMode* mode, const gfx::Point& origin) { |
| + if (sender_) { |
| + if (mode) |
| + sender_->Send(new OzoneGpuMsg_ConfigureNativeDisplay( |
| + id, GetDisplayModeParams(*mode), origin)); |
| + else |
| + sender_->Send(new OzoneGpuMsg_DisableNativeDisplay(id)); |
| + } |
| +} |
| + |
| +void GpuPlatformSupportHostGbm::OnUpdateNativeDisplays( |
| + const std::vector<DisplaySnapshot_Params>& displays) { |
| + ScopedVector<DisplaySnapshot> native_displays; |
| + for (size_t i = 0; i < displays.size(); ++i) |
| + native_displays.push_back(new DisplaySnapshotProxy(displays[i])); |
| + |
| + if (ndd_) |
| + ndd_->OnUpdateNativeDisplays(native_displays.Pass()); |
| +} |
| + |
| +void GpuPlatformSupportHostGbm::RegisterDisplayDelegate( |
| + NativeDisplayDelegateProxy* ndd) { |
| + ndd_ = ndd; |
| +} |
| +#endif |
| + |
| } // namespace ui |