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