OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "ui/ozone/platform/dri/chromeos/native_display_delegate_dri.h" | 5 #include "ui/ozone/platform/dri/chromeos/native_display_delegate_dri.h" |
6 | 6 |
| 7 #include "base/bind.h" |
| 8 #include "ui/display/types/chromeos/native_display_observer.h" |
| 9 #include "ui/events/ozone/device/device_event.h" |
| 10 #include "ui/events/ozone/device/device_manager.h" |
7 #include "ui/ozone/platform/dri/chromeos/display_mode_dri.h" | 11 #include "ui/ozone/platform/dri/chromeos/display_mode_dri.h" |
8 #include "ui/ozone/platform/dri/chromeos/display_snapshot_dri.h" | 12 #include "ui/ozone/platform/dri/chromeos/display_snapshot_dri.h" |
9 #include "ui/ozone/platform/dri/dri_surface_factory.h" | 13 #include "ui/ozone/platform/dri/dri_surface_factory.h" |
10 #include "ui/ozone/platform/dri/dri_util.h" | 14 #include "ui/ozone/platform/dri/dri_util.h" |
11 #include "ui/ozone/platform/dri/dri_wrapper.h" | 15 #include "ui/ozone/platform/dri/dri_wrapper.h" |
12 | 16 |
13 namespace ui { | 17 namespace ui { |
14 | 18 |
15 namespace { | 19 namespace { |
16 const size_t kMaxDisplayCount = 2; | 20 const size_t kMaxDisplayCount = 2; |
17 } // namespace | 21 } // namespace |
18 | 22 |
19 NativeDisplayDelegateDri::NativeDisplayDelegateDri( | 23 NativeDisplayDelegateDri::NativeDisplayDelegateDri( |
20 DriSurfaceFactory* surface_factory) | 24 DriSurfaceFactory* surface_factory, DeviceManager* device_manager) |
21 : surface_factory_(surface_factory) {} | 25 : surface_factory_(surface_factory), |
| 26 device_manager_(device_manager) {} |
22 | 27 |
23 NativeDisplayDelegateDri::~NativeDisplayDelegateDri() {} | 28 NativeDisplayDelegateDri::~NativeDisplayDelegateDri() { |
| 29 device_manager_->RemoveObserver(this); |
| 30 } |
24 | 31 |
25 void NativeDisplayDelegateDri::Initialize() { | 32 void NativeDisplayDelegateDri::Initialize() { |
26 gfx::SurfaceFactoryOzone::HardwareState state = | 33 gfx::SurfaceFactoryOzone::HardwareState state = |
27 surface_factory_->InitializeHardware(); | 34 surface_factory_->InitializeHardware(); |
28 | 35 |
29 CHECK_EQ(gfx::SurfaceFactoryOzone::INITIALIZED, state) | 36 CHECK_EQ(gfx::SurfaceFactoryOzone::INITIALIZED, state) |
30 << "Failed to initialize hardware"; | 37 << "Failed to initialize hardware"; |
| 38 |
| 39 device_manager_->AddObserver(this); |
31 } | 40 } |
32 | 41 |
33 void NativeDisplayDelegateDri::GrabServer() {} | 42 void NativeDisplayDelegateDri::GrabServer() {} |
34 | 43 |
35 void NativeDisplayDelegateDri::UngrabServer() {} | 44 void NativeDisplayDelegateDri::UngrabServer() {} |
36 | 45 |
37 void NativeDisplayDelegateDri::SyncWithServer() {} | 46 void NativeDisplayDelegateDri::SyncWithServer() {} |
38 | 47 |
39 void NativeDisplayDelegateDri::SetBackgroundColor(uint32_t color_argb) { | 48 void NativeDisplayDelegateDri::SetBackgroundColor(uint32_t color_argb) { |
40 NOTIMPLEMENTED(); | 49 NOTIMPLEMENTED(); |
(...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
147 } | 156 } |
148 | 157 |
149 void NativeDisplayDelegateDri::AddObserver(NativeDisplayObserver* observer) { | 158 void NativeDisplayDelegateDri::AddObserver(NativeDisplayObserver* observer) { |
150 observers_.AddObserver(observer); | 159 observers_.AddObserver(observer); |
151 } | 160 } |
152 | 161 |
153 void NativeDisplayDelegateDri::RemoveObserver(NativeDisplayObserver* observer) { | 162 void NativeDisplayDelegateDri::RemoveObserver(NativeDisplayObserver* observer) { |
154 observers_.RemoveObserver(observer); | 163 observers_.RemoveObserver(observer); |
155 } | 164 } |
156 | 165 |
| 166 void NativeDisplayDelegateDri::OnDeviceEvent(const DeviceEvent& event) { |
| 167 if (event.device_type() != DeviceEvent::DISPLAY) |
| 168 return; |
| 169 |
| 170 if (event.action_type() == DeviceEvent::CHANGE) |
| 171 NOTIMPLEMENTED(); |
| 172 } |
| 173 |
157 } // namespace ui | 174 } // namespace ui |
OLD | NEW |