OLD | NEW |
(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/chromeos/native_display_delegate_proxy.h" |
| 6 |
| 7 #include "base/logging.h" |
| 8 #include "ui/display/types/chromeos/display_snapshot.h" |
| 9 #include "ui/display/types/chromeos/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/platform/dri/gpu_platform_support_host_gbm.h" |
| 13 |
| 14 namespace ui { |
| 15 |
| 16 NativeDisplayDelegateProxy::NativeDisplayDelegateProxy( |
| 17 GpuPlatformSupportHostGbm* proxy, |
| 18 DeviceManager* device_manager) |
| 19 : proxy_(proxy), |
| 20 device_manager_(device_manager) {} |
| 21 |
| 22 NativeDisplayDelegateProxy::~NativeDisplayDelegateProxy() { |
| 23 if (device_manager_) |
| 24 device_manager_->RemoveObserver(this); |
| 25 |
| 26 proxy_->RegisterDisplayDelegate(NULL); |
| 27 } |
| 28 |
| 29 void NativeDisplayDelegateProxy::Initialize() { |
| 30 if (device_manager_) |
| 31 device_manager_->AddObserver(this); |
| 32 |
| 33 proxy_->RegisterDisplayDelegate(this); |
| 34 } |
| 35 |
| 36 void NativeDisplayDelegateProxy::GrabServer() {} |
| 37 |
| 38 void NativeDisplayDelegateProxy::UngrabServer() {} |
| 39 |
| 40 void NativeDisplayDelegateProxy::SyncWithServer() {} |
| 41 |
| 42 void NativeDisplayDelegateProxy::SetBackgroundColor(uint32_t color_argb) { |
| 43 NOTIMPLEMENTED(); |
| 44 } |
| 45 |
| 46 void NativeDisplayDelegateProxy::ForceDPMSOn() { |
| 47 proxy_->ForceDPMSOn(); |
| 48 } |
| 49 |
| 50 std::vector<DisplaySnapshot*> NativeDisplayDelegateProxy::GetDisplays() { |
| 51 return displays_.get(); |
| 52 } |
| 53 |
| 54 void NativeDisplayDelegateProxy::AddMode(const DisplaySnapshot& output, |
| 55 const DisplayMode* mode) {} |
| 56 |
| 57 bool NativeDisplayDelegateProxy::Configure(const DisplaySnapshot& output, |
| 58 const DisplayMode* mode, |
| 59 const gfx::Point& origin) { |
| 60 // TODO(dnicoara) Should handle an asynchronous response. |
| 61 proxy_->ConfigureNativeDisplay(output.display_id(), mode, origin); |
| 62 return true; |
| 63 } |
| 64 |
| 65 void NativeDisplayDelegateProxy::CreateFrameBuffer(const gfx::Size& size) {} |
| 66 |
| 67 bool NativeDisplayDelegateProxy::GetHDCPState(const DisplaySnapshot& output, |
| 68 HDCPState* state) { |
| 69 NOTIMPLEMENTED(); |
| 70 return false; |
| 71 } |
| 72 |
| 73 bool NativeDisplayDelegateProxy::SetHDCPState(const DisplaySnapshot& output, |
| 74 HDCPState state) { |
| 75 NOTIMPLEMENTED(); |
| 76 return false; |
| 77 } |
| 78 |
| 79 std::vector<ColorCalibrationProfile> |
| 80 NativeDisplayDelegateProxy::GetAvailableColorCalibrationProfiles( |
| 81 const DisplaySnapshot& output) { |
| 82 NOTIMPLEMENTED(); |
| 83 return std::vector<ColorCalibrationProfile>(); |
| 84 } |
| 85 |
| 86 bool NativeDisplayDelegateProxy::SetColorCalibrationProfile( |
| 87 const DisplaySnapshot& output, |
| 88 ColorCalibrationProfile new_profile) { |
| 89 NOTIMPLEMENTED(); |
| 90 return false; |
| 91 } |
| 92 |
| 93 void NativeDisplayDelegateProxy::AddObserver(NativeDisplayObserver* observer) { |
| 94 observers_.AddObserver(observer); |
| 95 } |
| 96 |
| 97 void NativeDisplayDelegateProxy::RemoveObserver( |
| 98 NativeDisplayObserver* observer) { |
| 99 observers_.RemoveObserver(observer); |
| 100 } |
| 101 |
| 102 void NativeDisplayDelegateProxy::OnDeviceEvent(const DeviceEvent& event) { |
| 103 if (event.device_type() != DeviceEvent::DISPLAY) |
| 104 return; |
| 105 |
| 106 if (event.action_type() == DeviceEvent::CHANGE) { |
| 107 VLOG(1) << "Got display changed event"; |
| 108 proxy_->RefreshNativeDisplays(); |
| 109 } |
| 110 } |
| 111 |
| 112 void NativeDisplayDelegateProxy::OnUpdateNativeDisplays( |
| 113 ScopedVector<DisplaySnapshot> displays) { |
| 114 displays_.swap(displays); |
| 115 FOR_EACH_OBSERVER( |
| 116 NativeDisplayObserver, observers_, OnConfigurationChanged()); |
| 117 } |
| 118 |
| 119 } // namespace ui |
OLD | NEW |