OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 "ash/display/display_change_observer_chromeos.h" | 5 #include "ash/display/display_change_observer_chromeos.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <map> | 8 #include <map> |
9 #include <set> | 9 #include <set> |
10 #include <vector> | 10 #include <vector> |
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
116 return true; | 116 return true; |
117 } | 117 } |
118 | 118 |
119 void DisplayChangeObserver::OnDisplayModeChanged( | 119 void DisplayChangeObserver::OnDisplayModeChanged( |
120 const std::vector<OutputConfigurator::OutputSnapshot>& outputs) { | 120 const std::vector<OutputConfigurator::OutputSnapshot>& outputs) { |
121 std::vector<DisplayInfo> displays; | 121 std::vector<DisplayInfo> displays; |
122 std::set<int64> ids; | 122 std::set<int64> ids; |
123 for (size_t i = 0; i < outputs.size(); ++i) { | 123 for (size_t i = 0; i < outputs.size(); ++i) { |
124 const OutputConfigurator::OutputSnapshot& output = outputs[i]; | 124 const OutputConfigurator::OutputSnapshot& output = outputs[i]; |
125 | 125 |
126 if (output.is_internal && | 126 if (output.type == chromeos::OUTPUT_TYPE_INTERNAL && |
127 gfx::Display::InternalDisplayId() == gfx::Display::kInvalidDisplayID) { | 127 gfx::Display::InternalDisplayId() == gfx::Display::kInvalidDisplayID) { |
128 // Fall back to output index. crbug.com/180100 | 128 // Fall back to output index. crbug.com/180100 |
129 gfx::Display::SetInternalDisplayId( | 129 gfx::Display::SetInternalDisplayId( |
130 output.display_id == gfx::Display::kInvalidDisplayID ? output.index : | 130 output.display_id == gfx::Display::kInvalidDisplayID ? output.index : |
131 output.display_id); | 131 output.display_id); |
132 } | 132 } |
133 | 133 |
134 const OutputConfigurator::ModeInfo* mode_info = | 134 const OutputConfigurator::ModeInfo* mode_info = |
135 OutputConfigurator::GetModeInfo(output, output.current_mode); | 135 OutputConfigurator::GetModeInfo(output, output.current_mode); |
136 if (!mode_info) | 136 if (!mode_info) |
137 continue; | 137 continue; |
138 | 138 |
139 float device_scale_factor = 1.0f; | 139 float device_scale_factor = 1.0f; |
140 if (!ui::IsXDisplaySizeBlackListed(output.width_mm, output.height_mm) && | 140 if (!ui::IsXDisplaySizeBlackListed(output.width_mm, output.height_mm) && |
141 (kInchInMm * mode_info->width / output.width_mm) > | 141 (kInchInMm * mode_info->width / output.width_mm) > |
142 kHighDensityDPIThreshold) { | 142 kHighDensityDPIThreshold) { |
143 device_scale_factor = 2.0f; | 143 device_scale_factor = 2.0f; |
144 } | 144 } |
145 gfx::Rect display_bounds( | 145 gfx::Rect display_bounds( |
146 output.x, output.y, mode_info->width, mode_info->height); | 146 output.x, output.y, mode_info->width, mode_info->height); |
147 | 147 |
148 std::vector<Resolution> resolutions; | 148 std::vector<Resolution> resolutions; |
149 if (!output.is_internal) | 149 if (output.type != chromeos::OUTPUT_TYPE_INTERNAL) |
150 resolutions = GetResolutionList(output); | 150 resolutions = GetResolutionList(output); |
151 | 151 |
152 std::string name = output.is_internal ? | 152 std::string name = output.type == chromeos::OUTPUT_TYPE_INTERNAL ? |
153 l10n_util::GetStringUTF8(IDS_ASH_INTERNAL_DISPLAY_NAME) : | 153 l10n_util::GetStringUTF8(IDS_ASH_INTERNAL_DISPLAY_NAME) : |
154 chromeos::GetDisplayName(output.output); | 154 chromeos::GetDisplayName(output.output); |
155 if (name.empty()) | 155 if (name.empty()) |
156 name = l10n_util::GetStringUTF8(IDS_ASH_STATUS_TRAY_UNKNOWN_DISPLAY_NAME); | 156 name = l10n_util::GetStringUTF8(IDS_ASH_STATUS_TRAY_UNKNOWN_DISPLAY_NAME); |
157 | 157 |
158 bool has_overscan = false; | 158 bool has_overscan = false; |
159 chromeos::GetOutputOverscanFlag(output.output, &has_overscan); | 159 chromeos::GetOutputOverscanFlag(output.output, &has_overscan); |
160 | 160 |
161 int64 id = output.display_id; | 161 int64 id = output.display_id; |
162 if (id == gfx::Display::kInvalidDisplayID || ids.find(id) != ids.end()) | 162 if (id == gfx::Display::kInvalidDisplayID || ids.find(id) != ids.end()) |
(...skipping 17 matching lines...) Expand all Loading... |
180 void DisplayChangeObserver::OnAppTerminating() { | 180 void DisplayChangeObserver::OnAppTerminating() { |
181 #if defined(USE_ASH) | 181 #if defined(USE_ASH) |
182 // Stop handling display configuration events once the shutdown | 182 // Stop handling display configuration events once the shutdown |
183 // process starts. crbug.com/177014. | 183 // process starts. crbug.com/177014. |
184 Shell::GetInstance()->output_configurator()->Stop(); | 184 Shell::GetInstance()->output_configurator()->Stop(); |
185 #endif | 185 #endif |
186 } | 186 } |
187 | 187 |
188 } // namespace internal | 188 } // namespace internal |
189 } // namespace ash | 189 } // namespace ash |
OLD | NEW |