| 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/common/display_util.h" | 5 #include "ui/ozone/common/display_util.h" |
| 6 | 6 |
| 7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
| 8 #include "base/files/file_path.h" | 8 #include "base/files/file_path.h" |
| 9 #include "base/files/file_util.h" | 9 #include "base/files/file_util.h" |
| 10 #include "ui/display/types/display_mode.h" | 10 #include "ui/display/types/display_mode.h" |
| 11 #include "ui/display/types/display_snapshot.h" | 11 #include "ui/display/types/display_snapshot.h" |
| 12 #include "ui/display/util/edid_parser.h" | 12 #include "ui/display/util/edid_parser.h" |
| 13 #include "ui/display/util/edid_parser.h" | 13 #include "ui/display/util/edid_parser.h" |
| 14 #include "ui/ozone/public/ozone_switches.h" | 14 #include "ui/ozone/public/ozone_switches.h" |
| 15 | 15 |
| 16 namespace ui { | 16 namespace ui { |
| 17 | 17 |
| 18 namespace { | 18 namespace { |
| 19 | 19 |
| 20 const int64_t kDummyDisplayId = 1; | 20 const int64_t kDummyDisplayId = 1; |
| 21 const int64_t kDummyProductId = 1; |
| 21 | 22 |
| 22 } // namespace | 23 } // namespace |
| 23 | 24 |
| 24 FindDisplayById::FindDisplayById(int64_t display_id) : display_id_(display_id) { | 25 FindDisplayById::FindDisplayById(int64_t display_id) : display_id_(display_id) { |
| 25 } | 26 } |
| 26 | 27 |
| 27 bool FindDisplayById::operator()(const DisplaySnapshot_Params& display) const { | 28 bool FindDisplayById::operator()(const DisplaySnapshot_Params& display) const { |
| 28 return display.display_id == display_id_; | 29 return display.display_id == display_id_; |
| 29 } | 30 } |
| 30 | 31 |
| (...skipping 20 matching lines...) Expand all Loading... |
| 51 params.modes.push_back(GetDisplayModeParams(*display.modes()[i])); | 52 params.modes.push_back(GetDisplayModeParams(*display.modes()[i])); |
| 52 | 53 |
| 53 params.has_current_mode = display.current_mode() != NULL; | 54 params.has_current_mode = display.current_mode() != NULL; |
| 54 if (params.has_current_mode) | 55 if (params.has_current_mode) |
| 55 params.current_mode = GetDisplayModeParams(*display.current_mode()); | 56 params.current_mode = GetDisplayModeParams(*display.current_mode()); |
| 56 | 57 |
| 57 params.has_native_mode = display.native_mode() != NULL; | 58 params.has_native_mode = display.native_mode() != NULL; |
| 58 if (params.has_native_mode) | 59 if (params.has_native_mode) |
| 59 params.native_mode = GetDisplayModeParams(*display.native_mode()); | 60 params.native_mode = GetDisplayModeParams(*display.native_mode()); |
| 60 | 61 |
| 62 params.product_id = display.product_id(); |
| 61 params.string_representation = display.ToString(); | 63 params.string_representation = display.ToString(); |
| 62 | 64 |
| 63 return params; | 65 return params; |
| 64 } | 66 } |
| 65 | 67 |
| 66 bool CreateSnapshotFromCommandLine(DisplaySnapshot_Params* snapshot_out) { | 68 bool CreateSnapshotFromCommandLine(DisplaySnapshot_Params* snapshot_out) { |
| 67 base::CommandLine* cmd = base::CommandLine::ForCurrentProcess(); | 69 base::CommandLine* cmd = base::CommandLine::ForCurrentProcess(); |
| 68 std::string spec = | 70 std::string spec = |
| 69 cmd->GetSwitchValueASCII(switches::kOzoneInitialDisplayBounds); | 71 cmd->GetSwitchValueASCII(switches::kOzoneInitialDisplayBounds); |
| 70 std::string physical_spec = | 72 std::string physical_spec = |
| (...skipping 15 matching lines...) Expand all Loading... |
| 86 mode_param.refresh_rate = 60; | 88 mode_param.refresh_rate = 60; |
| 87 | 89 |
| 88 snapshot_out->display_id = kDummyDisplayId; | 90 snapshot_out->display_id = kDummyDisplayId; |
| 89 snapshot_out->modes.push_back(mode_param); | 91 snapshot_out->modes.push_back(mode_param); |
| 90 snapshot_out->type = DISPLAY_CONNECTION_TYPE_INTERNAL; | 92 snapshot_out->type = DISPLAY_CONNECTION_TYPE_INTERNAL; |
| 91 snapshot_out->physical_size = gfx::Size(physical_width, physical_height); | 93 snapshot_out->physical_size = gfx::Size(physical_width, physical_height); |
| 92 snapshot_out->has_current_mode = true; | 94 snapshot_out->has_current_mode = true; |
| 93 snapshot_out->current_mode = mode_param; | 95 snapshot_out->current_mode = mode_param; |
| 94 snapshot_out->has_native_mode = true; | 96 snapshot_out->has_native_mode = true; |
| 95 snapshot_out->native_mode = mode_param; | 97 snapshot_out->native_mode = mode_param; |
| 98 snapshot_out->product_id = kDummyProductId; |
| 96 return true; | 99 return true; |
| 97 } | 100 } |
| 98 | 101 |
| 99 } // namespace ui | 102 } // namespace ui |
| OLD | NEW |