OLD | NEW |
| (Empty) |
1 // Copyright 2016 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/x11/native_display_delegate_ozone_x11.h" | |
6 | |
7 #include "base/logging.h" | |
8 #include "base/memory/ptr_util.h" | |
9 #include "ui/display/types/native_display_observer.h" | |
10 #include "ui/ozone/common/display_snapshot_proxy.h" | |
11 #include "ui/ozone/common/display_util.h" | |
12 | |
13 namespace ui { | |
14 | |
15 namespace { | |
16 | |
17 void GetDefaultDisplaySnapshotParams(DisplaySnapshot_Params* params) { | |
18 DisplayMode_Params mode_param; | |
19 mode_param.size = gfx::Size(1024, 768); | |
20 mode_param.refresh_rate = 60; | |
21 | |
22 params->display_id = 1; | |
23 params->modes.push_back(mode_param); | |
24 params->type = DISPLAY_CONNECTION_TYPE_INTERNAL; | |
25 params->physical_size = gfx::Size(0, 0); | |
26 params->has_current_mode = true; | |
27 params->current_mode = mode_param; | |
28 params->has_native_mode = true; | |
29 params->native_mode = mode_param; | |
30 params->product_id = 1; | |
31 } | |
32 | |
33 } // namespace | |
34 | |
35 NativeDisplayDelegateOzoneX11::NativeDisplayDelegateOzoneX11() {} | |
36 | |
37 NativeDisplayDelegateOzoneX11::~NativeDisplayDelegateOzoneX11() {} | |
38 | |
39 void NativeDisplayDelegateOzoneX11::OnConfigurationChanged() { | |
40 // TODO(kylechar): Listen for X11 window resizes to trigger this. | |
41 FOR_EACH_OBSERVER(NativeDisplayObserver, observers_, | |
42 OnConfigurationChanged()); | |
43 } | |
44 | |
45 void NativeDisplayDelegateOzoneX11::Initialize() { | |
46 // Create display snapshot from command line or use default values. | |
47 DisplaySnapshot_Params params; | |
48 if (!CreateSnapshotFromCommandLine(¶ms)) | |
49 GetDefaultDisplaySnapshotParams(¶ms); | |
50 | |
51 DCHECK_NE(DISPLAY_CONNECTION_TYPE_NONE, params.type); | |
52 displays().push_back(base::WrapUnique(new DisplaySnapshotProxy(params))); | |
53 } | |
54 | |
55 void NativeDisplayDelegateOzoneX11::AddObserver( | |
56 NativeDisplayObserver* observer) { | |
57 observers_.AddObserver(observer); | |
58 } | |
59 | |
60 void NativeDisplayDelegateOzoneX11::RemoveObserver( | |
61 NativeDisplayObserver* observer) { | |
62 observers_.RemoveObserver(observer); | |
63 } | |
64 | |
65 } // namespace ui | |
OLD | NEW |