| 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 device_scale_factor = |
| 196 FindDeviceScaleFactor((kInchInMm * mode_info->size().width() / | 196 FindDeviceScaleFactor((kInchInMm * mode_info->size().width() / |
| 197 state.display->physical_size().width())); | 197 state.display->physical_size().width())); |
| 198 } else { |
| 199 DisplayMode mode; |
| 200 if (Shell::GetInstance()->display_manager()->GetSelectedModeForDisplayId( |
| 201 state.display->display_id(), &mode)) { |
| 202 device_scale_factor = mode.device_scale_factor; |
| 203 } |
| 198 } | 204 } |
| 199 gfx::Rect display_bounds(state.display->origin(), mode_info->size()); | 205 gfx::Rect display_bounds(state.display->origin(), mode_info->size()); |
| 200 | 206 |
| 201 std::string name = | 207 std::string name = |
| 202 state.display->type() == ui::DISPLAY_CONNECTION_TYPE_INTERNAL ? | 208 state.display->type() == ui::DISPLAY_CONNECTION_TYPE_INTERNAL ? |
| 203 l10n_util::GetStringUTF8(IDS_ASH_INTERNAL_DISPLAY_NAME) : | 209 l10n_util::GetStringUTF8(IDS_ASH_INTERNAL_DISPLAY_NAME) : |
| 204 state.display->display_name(); | 210 state.display->display_name(); |
| 205 if (name.empty()) | 211 if (name.empty()) |
| 206 name = l10n_util::GetStringUTF8(IDS_ASH_STATUS_TRAY_UNKNOWN_DISPLAY_NAME); | 212 name = l10n_util::GetStringUTF8(IDS_ASH_STATUS_TRAY_UNKNOWN_DISPLAY_NAME); |
| 207 | 213 |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 248 // static | 254 // static |
| 249 float DisplayChangeObserver::FindDeviceScaleFactor(float dpi) { | 255 float DisplayChangeObserver::FindDeviceScaleFactor(float dpi) { |
| 250 for (size_t i = 0; i < arraysize(kThresholdTable); ++i) { | 256 for (size_t i = 0; i < arraysize(kThresholdTable); ++i) { |
| 251 if (dpi > kThresholdTable[i].dpi) | 257 if (dpi > kThresholdTable[i].dpi) |
| 252 return kThresholdTable[i].device_scale_factor; | 258 return kThresholdTable[i].device_scale_factor; |
| 253 } | 259 } |
| 254 return 1.0f; | 260 return 1.0f; |
| 255 } | 261 } |
| 256 | 262 |
| 257 } // namespace ash | 263 } // namespace ash |
| OLD | NEW |