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/display/chromeos/display_util.h" | 5 #include "ui/display/chromeos/display_util.h" |
6 | 6 |
7 #include "base/logging.h" | 7 #include "base/logging.h" |
8 #include "base/strings/string_number_conversions.h" | 8 #include "base/strings/string_number_conversions.h" |
9 #include "base/strings/stringprintf.h" | 9 #include "base/strings/stringprintf.h" |
10 #include "ui/display/types/display_snapshot.h" | 10 #include "ui/display/types/display_snapshot.h" |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
48 int GetDisplayPower(const std::vector<DisplaySnapshot*>& displays, | 48 int GetDisplayPower(const std::vector<DisplaySnapshot*>& displays, |
49 chromeos::DisplayPowerState state, | 49 chromeos::DisplayPowerState state, |
50 std::vector<bool>* display_power) { | 50 std::vector<bool>* display_power) { |
51 int num_on_displays = 0; | 51 int num_on_displays = 0; |
52 if (display_power) | 52 if (display_power) |
53 display_power->resize(displays.size()); | 53 display_power->resize(displays.size()); |
54 | 54 |
55 for (size_t i = 0; i < displays.size(); ++i) { | 55 for (size_t i = 0; i < displays.size(); ++i) { |
56 bool internal = displays[i]->type() == DISPLAY_CONNECTION_TYPE_INTERNAL; | 56 bool internal = displays[i]->type() == DISPLAY_CONNECTION_TYPE_INTERNAL; |
57 bool on = | 57 bool on = |
| 58 displays[i]->type() == DISPLAY_CONNECTION_TYPE_VIRTUAL || |
58 state == chromeos::DISPLAY_POWER_ALL_ON || | 59 state == chromeos::DISPLAY_POWER_ALL_ON || |
59 (state == chromeos::DISPLAY_POWER_INTERNAL_OFF_EXTERNAL_ON && | 60 (state == chromeos::DISPLAY_POWER_INTERNAL_OFF_EXTERNAL_ON && |
60 !internal) || | 61 !internal) || |
61 (state == chromeos::DISPLAY_POWER_INTERNAL_ON_EXTERNAL_OFF && internal); | 62 (state == chromeos::DISPLAY_POWER_INTERNAL_ON_EXTERNAL_OFF && internal); |
62 if (display_power) | 63 if (display_power) |
63 (*display_power)[i] = on; | 64 (*display_power)[i] = on; |
64 if (on) | 65 if (on) |
65 num_on_displays++; | 66 num_on_displays++; |
66 } | 67 } |
67 return num_on_displays; | 68 return num_on_displays; |
68 } | 69 } |
69 | 70 |
| 71 bool IsPhysicalDisplayType(ui::DisplayConnectionType type) { |
| 72 return !(type & |
| 73 (DISPLAY_CONNECTION_TYPE_NETWORK | DISPLAY_CONNECTION_TYPE_VIRTUAL)); |
| 74 } |
| 75 |
70 } // namespace ui | 76 } // namespace ui |
OLD | NEW |