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/native_display_delegate_proxy.h" | 5 #include "ui/ozone/platform/dri/native_display_delegate_proxy.h" |
6 | 6 |
7 #include <stdio.h> | 7 #include <stdio.h> |
8 | 8 |
9 #include "base/logging.h" | 9 #include "base/logging.h" |
10 #include "ui/display/types/display_snapshot.h" | 10 #include "ui/display/types/display_snapshot.h" |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
56 device_manager_->RemoveObserver(this); | 56 device_manager_->RemoveObserver(this); |
57 proxy_->UnregisterHandler(this); | 57 proxy_->UnregisterHandler(this); |
58 } | 58 } |
59 | 59 |
60 void NativeDisplayDelegateProxy::Initialize() { | 60 void NativeDisplayDelegateProxy::Initialize() { |
61 device_manager_->AddObserver(this); | 61 device_manager_->AddObserver(this); |
62 device_manager_->ScanDevices(this); | 62 device_manager_->ScanDevices(this); |
63 | 63 |
64 if (!displays_.empty()) | 64 if (!displays_.empty()) |
65 return; | 65 return; |
66 | 66 // The file generated by frecon that contains EDID for the 1st display. |
67 DisplaySnapshot_Params params = CreateSnapshotFromCommandLine(); | 67 const base::FilePath kEDIDFile("/tmp/display_info.bin"); |
68 if (params.type != DISPLAY_CONNECTION_TYPE_NONE) { | 68 DisplaySnapshot_Params params; |
| 69 // Fallback to command line if the file doesn't exit or failed to read. |
| 70 if (CreateSnapshotFromEDIDFile(kEDIDFile, ¶ms) || |
| 71 CreateSnapshotFromCommandLine(¶ms)) { |
| 72 DCHECK_NE(DISPLAY_CONNECTION_TYPE_NONE, params.type); |
69 displays_.push_back(new DriDisplaySnapshotProxy(params, display_manager_)); | 73 displays_.push_back(new DriDisplaySnapshotProxy(params, display_manager_)); |
70 has_dummy_display_ = true; | 74 has_dummy_display_ = true; |
71 } | 75 } |
72 } | 76 } |
73 | 77 |
74 void NativeDisplayDelegateProxy::GrabServer() { | 78 void NativeDisplayDelegateProxy::GrabServer() { |
75 } | 79 } |
76 | 80 |
77 void NativeDisplayDelegateProxy::UngrabServer() { | 81 void NativeDisplayDelegateProxy::UngrabServer() { |
78 } | 82 } |
(...skipping 170 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
249 void NativeDisplayDelegateProxy::OnDisplayConfigured(int64_t display_id, | 253 void NativeDisplayDelegateProxy::OnDisplayConfigured(int64_t display_id, |
250 bool status) { | 254 bool status) { |
251 auto it = configure_callback_map_.find(display_id); | 255 auto it = configure_callback_map_.find(display_id); |
252 if (it != configure_callback_map_.end()) { | 256 if (it != configure_callback_map_.end()) { |
253 it->second.Run(status); | 257 it->second.Run(status); |
254 configure_callback_map_.erase(it); | 258 configure_callback_map_.erase(it); |
255 } | 259 } |
256 } | 260 } |
257 | 261 |
258 } // namespace ui | 262 } // namespace ui |
OLD | NEW |