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 173 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
184 if (state.display->type() == ui::DISPLAY_CONNECTION_TYPE_INTERNAL && | 184 if (state.display->type() == ui::DISPLAY_CONNECTION_TYPE_INTERNAL && |
185 gfx::Display::InternalDisplayId() == gfx::Display::kInvalidDisplayID) { | 185 gfx::Display::InternalDisplayId() == gfx::Display::kInvalidDisplayID) { |
186 gfx::Display::SetInternalDisplayId(state.display->display_id()); | 186 gfx::Display::SetInternalDisplayId(state.display->display_id()); |
187 } | 187 } |
188 | 188 |
189 const ui::DisplayMode* mode_info = state.display->current_mode(); | 189 const ui::DisplayMode* mode_info = state.display->current_mode(); |
190 if (!mode_info) | 190 if (!mode_info) |
191 continue; | 191 continue; |
192 | 192 |
193 float device_scale_factor = 1.0f; | 193 float device_scale_factor = 1.0f; |
194 if (!ui::IsDisplaySizeBlackListed(state.display->physical_size())) { | 194 if (state.display->type() == ui::DISPLAY_CONNECTION_TYPE_INTERNAL) { |
195 device_scale_factor = | 195 if (!ui::IsDisplaySizeBlackListed(state.display->physical_size())) { |
oshima
2014/08/07 23:03:49
internal display should not be black listed, so we
Jun Mukai
2014/08/08 00:57:33
Done.
| |
196 FindDeviceScaleFactor((kInchInMm * mode_info->size().width() / | 196 device_scale_factor = |
197 state.display->physical_size().width())); | 197 FindDeviceScaleFactor((kInchInMm * mode_info->size().width() / |
198 state.display->physical_size().width())); | |
199 } | |
200 } else { | |
201 DisplayMode mode; | |
202 if (Shell::GetInstance()->display_manager()->GetSelectedModeForDisplayId( | |
203 state.display->display_id(), &mode)) { | |
204 device_scale_factor = mode.device_scale_factor; | |
205 } | |
198 } | 206 } |
199 gfx::Rect display_bounds(state.display->origin(), mode_info->size()); | 207 gfx::Rect display_bounds(state.display->origin(), mode_info->size()); |
200 | 208 |
201 std::string name = | 209 std::string name = |
202 state.display->type() == ui::DISPLAY_CONNECTION_TYPE_INTERNAL ? | 210 state.display->type() == ui::DISPLAY_CONNECTION_TYPE_INTERNAL ? |
203 l10n_util::GetStringUTF8(IDS_ASH_INTERNAL_DISPLAY_NAME) : | 211 l10n_util::GetStringUTF8(IDS_ASH_INTERNAL_DISPLAY_NAME) : |
204 state.display->display_name(); | 212 state.display->display_name(); |
205 if (name.empty()) | 213 if (name.empty()) |
206 name = l10n_util::GetStringUTF8(IDS_ASH_STATUS_TRAY_UNKNOWN_DISPLAY_NAME); | 214 name = l10n_util::GetStringUTF8(IDS_ASH_STATUS_TRAY_UNKNOWN_DISPLAY_NAME); |
207 | 215 |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
248 // static | 256 // static |
249 float DisplayChangeObserver::FindDeviceScaleFactor(float dpi) { | 257 float DisplayChangeObserver::FindDeviceScaleFactor(float dpi) { |
250 for (size_t i = 0; i < arraysize(kThresholdTable); ++i) { | 258 for (size_t i = 0; i < arraysize(kThresholdTable); ++i) { |
251 if (dpi > kThresholdTable[i].dpi) | 259 if (dpi > kThresholdTable[i].dpi) |
252 return kThresholdTable[i].device_scale_factor; | 260 return kThresholdTable[i].device_scale_factor; |
253 } | 261 } |
254 return 1.0f; | 262 return 1.0f; |
255 } | 263 } |
256 | 264 |
257 } // namespace ash | 265 } // namespace ash |
OLD | NEW |