| 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/ozone/platform/dri/chromeos/display_event_listener.h" |
| 7 #include "ui/ozone/platform/dri/chromeos/display_mode_dri.h" | 10 #include "ui/ozone/platform/dri/chromeos/display_mode_dri.h" |
| 8 #include "ui/ozone/platform/dri/chromeos/display_snapshot_dri.h" | 11 #include "ui/ozone/platform/dri/chromeos/display_snapshot_dri.h" |
| 9 #include "ui/ozone/platform/dri/dri_surface_factory.h" | 12 #include "ui/ozone/platform/dri/dri_surface_factory.h" |
| 10 #include "ui/ozone/platform/dri/dri_util.h" | 13 #include "ui/ozone/platform/dri/dri_util.h" |
| 11 #include "ui/ozone/platform/dri/dri_wrapper.h" | 14 #include "ui/ozone/platform/dri/dri_wrapper.h" |
| 12 | 15 |
| 13 namespace ui { | 16 namespace ui { |
| 14 | 17 |
| 15 namespace { | 18 namespace { |
| 16 const size_t kMaxDisplayCount = 2; | 19 const size_t kMaxDisplayCount = 2; |
| 17 } // namespace | 20 } // namespace |
| 18 | 21 |
| 19 NativeDisplayDelegateDri::NativeDisplayDelegateDri( | 22 NativeDisplayDelegateDri::NativeDisplayDelegateDri( |
| 20 DriSurfaceFactory* surface_factory) | 23 DriSurfaceFactory* surface_factory, |
| 21 : surface_factory_(surface_factory) {} | 24 scoped_ptr<DisplayEventListener> display_listener) |
| 25 : surface_factory_(surface_factory), |
| 26 display_event_listener_(display_listener.Pass()) {} |
| 22 | 27 |
| 23 NativeDisplayDelegateDri::~NativeDisplayDelegateDri() {} | 28 NativeDisplayDelegateDri::~NativeDisplayDelegateDri() {} |
| 24 | 29 |
| 25 void NativeDisplayDelegateDri::Initialize() { | 30 void NativeDisplayDelegateDri::Initialize() { |
| 26 gfx::SurfaceFactoryOzone::HardwareState state = | 31 gfx::SurfaceFactoryOzone::HardwareState state = |
| 27 surface_factory_->InitializeHardware(); | 32 surface_factory_->InitializeHardware(); |
| 28 | 33 |
| 29 CHECK_EQ(gfx::SurfaceFactoryOzone::INITIALIZED, state) | 34 CHECK_EQ(gfx::SurfaceFactoryOzone::INITIALIZED, state) |
| 30 << "Failed to initialize hardware"; | 35 << "Failed to initialize hardware"; |
| 36 |
| 37 if (display_event_listener_) |
| 38 display_event_listener_->StartMonitoring( |
| 39 base::Bind(&NativeDisplayDelegateDri::OnDisplayEvent, |
| 40 base::Unretained(this))); |
| 31 } | 41 } |
| 32 | 42 |
| 33 void NativeDisplayDelegateDri::GrabServer() {} | 43 void NativeDisplayDelegateDri::GrabServer() {} |
| 34 | 44 |
| 35 void NativeDisplayDelegateDri::UngrabServer() {} | 45 void NativeDisplayDelegateDri::UngrabServer() {} |
| 36 | 46 |
| 37 void NativeDisplayDelegateDri::SyncWithServer() {} | 47 void NativeDisplayDelegateDri::SyncWithServer() {} |
| 38 | 48 |
| 39 void NativeDisplayDelegateDri::SetBackgroundColor(uint32_t color_argb) { | 49 void NativeDisplayDelegateDri::SetBackgroundColor(uint32_t color_argb) { |
| 40 NOTIMPLEMENTED(); | 50 NOTIMPLEMENTED(); |
| (...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 147 } | 157 } |
| 148 | 158 |
| 149 void NativeDisplayDelegateDri::AddObserver(NativeDisplayObserver* observer) { | 159 void NativeDisplayDelegateDri::AddObserver(NativeDisplayObserver* observer) { |
| 150 observers_.AddObserver(observer); | 160 observers_.AddObserver(observer); |
| 151 } | 161 } |
| 152 | 162 |
| 153 void NativeDisplayDelegateDri::RemoveObserver(NativeDisplayObserver* observer) { | 163 void NativeDisplayDelegateDri::RemoveObserver(NativeDisplayObserver* observer) { |
| 154 observers_.RemoveObserver(observer); | 164 observers_.RemoveObserver(observer); |
| 155 } | 165 } |
| 156 | 166 |
| 167 void NativeDisplayDelegateDri::OnDisplayEvent() { |
| 168 NOTIMPLEMENTED(); |
| 169 } |
| 170 |
| 157 } // namespace ui | 171 } // namespace ui |
| OLD | NEW |