Index: ui/ozone/platform/dri/chromeos/native_display_delegate_proxy.cc |
diff --git a/ui/ozone/platform/dri/chromeos/native_display_delegate_proxy.cc b/ui/ozone/platform/dri/chromeos/native_display_delegate_proxy.cc |
new file mode 100644 |
index 0000000000000000000000000000000000000000..277973a3eb4ff5a8f39cc86614e1814b22df931c |
--- /dev/null |
+++ b/ui/ozone/platform/dri/chromeos/native_display_delegate_proxy.cc |
@@ -0,0 +1,119 @@ |
+// 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. |
+ |
+#include "ui/ozone/platform/dri/chromeos/native_display_delegate_proxy.h" |
+ |
+#include "base/logging.h" |
+#include "ui/display/types/chromeos/display_snapshot.h" |
+#include "ui/display/types/chromeos/native_display_observer.h" |
+#include "ui/events/ozone/device/device_event.h" |
+#include "ui/events/ozone/device/device_manager.h" |
+#include "ui/ozone/platform/dri/gpu_platform_support_host_gbm.h" |
+ |
+namespace ui { |
+ |
+NativeDisplayDelegateProxy::NativeDisplayDelegateProxy( |
+ GpuPlatformSupportHostGbm* proxy, |
+ DeviceManager* device_manager) |
+ : proxy_(proxy), |
+ device_manager_(device_manager) {} |
+ |
+NativeDisplayDelegateProxy::~NativeDisplayDelegateProxy() { |
+ if (device_manager_) |
+ device_manager_->RemoveObserver(this); |
+ |
+ proxy_->RegisterDisplayDelegate(NULL); |
+} |
+ |
+void NativeDisplayDelegateProxy::Initialize() { |
+ if (device_manager_) |
+ device_manager_->AddObserver(this); |
+ |
+ proxy_->RegisterDisplayDelegate(this); |
+} |
+ |
+void NativeDisplayDelegateProxy::GrabServer() {} |
+ |
+void NativeDisplayDelegateProxy::UngrabServer() {} |
+ |
+void NativeDisplayDelegateProxy::SyncWithServer() {} |
+ |
+void NativeDisplayDelegateProxy::SetBackgroundColor(uint32_t color_argb) { |
+ NOTIMPLEMENTED(); |
+} |
+ |
+void NativeDisplayDelegateProxy::ForceDPMSOn() { |
+ proxy_->ForceDPMSOn(); |
+} |
+ |
+std::vector<DisplaySnapshot*> NativeDisplayDelegateProxy::GetDisplays() { |
+ return displays_.get(); |
+} |
+ |
+void NativeDisplayDelegateProxy::AddMode(const DisplaySnapshot& output, |
+ const DisplayMode* mode) {} |
+ |
+bool NativeDisplayDelegateProxy::Configure(const DisplaySnapshot& output, |
+ const DisplayMode* mode, |
+ const gfx::Point& origin) { |
+ // TODO(dnicoara) Should handle an asynchronous response. |
+ proxy_->ConfigureNativeDisplay(output.display_id(), mode, origin); |
+ return true; |
+} |
+ |
+void NativeDisplayDelegateProxy::CreateFrameBuffer(const gfx::Size& size) {} |
+ |
+bool NativeDisplayDelegateProxy::GetHDCPState(const DisplaySnapshot& output, |
+ HDCPState* state) { |
+ NOTIMPLEMENTED(); |
+ return false; |
+} |
+ |
+bool NativeDisplayDelegateProxy::SetHDCPState(const DisplaySnapshot& output, |
+ HDCPState state) { |
+ NOTIMPLEMENTED(); |
+ return false; |
+} |
+ |
+std::vector<ColorCalibrationProfile> |
+NativeDisplayDelegateProxy::GetAvailableColorCalibrationProfiles( |
+ const DisplaySnapshot& output) { |
+ NOTIMPLEMENTED(); |
+ return std::vector<ColorCalibrationProfile>(); |
+} |
+ |
+bool NativeDisplayDelegateProxy::SetColorCalibrationProfile( |
+ const DisplaySnapshot& output, |
+ ColorCalibrationProfile new_profile) { |
+ NOTIMPLEMENTED(); |
+ return false; |
+} |
+ |
+void NativeDisplayDelegateProxy::AddObserver(NativeDisplayObserver* observer) { |
+ observers_.AddObserver(observer); |
+} |
+ |
+void NativeDisplayDelegateProxy::RemoveObserver( |
+ NativeDisplayObserver* observer) { |
+ observers_.RemoveObserver(observer); |
+} |
+ |
+void NativeDisplayDelegateProxy::OnDeviceEvent(const DeviceEvent& event) { |
+ if (event.device_type() != DeviceEvent::DISPLAY) |
+ return; |
+ |
+ if (event.action_type() == DeviceEvent::CHANGE) { |
+ VLOG(1) << "Got display changed event"; |
+ proxy_->RefreshNativeDisplays(); |
+ } |
+} |
+ |
+void NativeDisplayDelegateProxy::OnUpdateNativeDisplays( |
+ ScopedVector<DisplaySnapshot> displays) { |
+ displays_.swap(displays); |
+ FOR_EACH_OBSERVER( |
+ NativeDisplayObserver, observers_, OnConfigurationChanged()); |
+} |
+ |
+} // namespace ui |