| 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> |
| 11 | 11 |
| 12 #include "ash/ash_switches.h" | 12 #include "ash/ash_switches.h" |
| 13 #include "ash/display/display_info.h" | 13 #include "ash/display/display_info.h" |
| 14 #include "ash/display/display_layout_store.h" | 14 #include "ash/display/display_layout_store.h" |
| 15 #include "ash/display/display_manager.h" | 15 #include "ash/display/display_manager.h" |
| 16 #include "ash/shell.h" | 16 #include "ash/shell.h" |
| 17 #include "base/command_line.h" | 17 #include "base/command_line.h" |
| 18 #include "base/logging.h" | 18 #include "base/logging.h" |
| 19 #include "chromeos/display/output_util.h" | |
| 20 #include "grit/ash_strings.h" | 19 #include "grit/ash_strings.h" |
| 21 #include "ui/base/l10n/l10n_util.h" | 20 #include "ui/base/l10n/l10n_util.h" |
| 22 #include "ui/base/x/x11_util.h" | 21 #include "ui/base/x/x11_util.h" |
| 23 #include "ui/compositor/dip_util.h" | 22 #include "ui/compositor/dip_util.h" |
| 23 #include "ui/display/chromeos/x11/display_util.h" |
| 24 #include "ui/gfx/display.h" | 24 #include "ui/gfx/display.h" |
| 25 | 25 |
| 26 namespace ash { | 26 namespace ash { |
| 27 namespace internal { | 27 namespace internal { |
| 28 | 28 |
| 29 using chromeos::OutputConfigurator; | 29 using ui::OutputConfigurator; |
| 30 | 30 |
| 31 namespace { | 31 namespace { |
| 32 | 32 |
| 33 // The DPI threshold to detect high density screen. | 33 // The DPI threshold to detect high density screen. |
| 34 // Higher DPI than this will use device_scale_factor=2. | 34 // Higher DPI than this will use device_scale_factor=2. |
| 35 const unsigned int kHighDensityDPIThreshold = 170; | 35 const unsigned int kHighDensityDPIThreshold = 170; |
| 36 | 36 |
| 37 // 1 inch in mm. | 37 // 1 inch in mm. |
| 38 const float kInchInMm = 25.4f; | 38 const float kInchInMm = 25.4f; |
| 39 | 39 |
| (...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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<DisplayMode> display_modes = GetDisplayModeList(output); | 148 std::vector<DisplayMode> display_modes = GetDisplayModeList(output); |
| 149 | 149 |
| 150 std::string name = | 150 std::string name = |
| 151 output.type == ui::OUTPUT_TYPE_INTERNAL | 151 output.type == ui::OUTPUT_TYPE_INTERNAL |
| 152 ? l10n_util::GetStringUTF8(IDS_ASH_INTERNAL_DISPLAY_NAME) | 152 ? l10n_util::GetStringUTF8(IDS_ASH_INTERNAL_DISPLAY_NAME) : |
| 153 : chromeos::GetDisplayName(output.output); | 153 ui::GetDisplayName(output); |
| 154 if (name.empty()) | 154 if (name.empty()) |
| 155 name = l10n_util::GetStringUTF8(IDS_ASH_STATUS_TRAY_UNKNOWN_DISPLAY_NAME); | 155 name = l10n_util::GetStringUTF8(IDS_ASH_STATUS_TRAY_UNKNOWN_DISPLAY_NAME); |
| 156 | 156 |
| 157 bool has_overscan = false; | 157 bool has_overscan = false; |
| 158 chromeos::GetOutputOverscanFlag(output.output, &has_overscan); | 158 ui::GetOutputOverscanFlag(output, &has_overscan); |
| 159 | 159 |
| 160 int64 id = output.display_id; | 160 int64 id = output.display_id; |
| 161 if (id == gfx::Display::kInvalidDisplayID || ids.find(id) != ids.end()) | 161 if (id == gfx::Display::kInvalidDisplayID || ids.find(id) != ids.end()) |
| 162 id = output.index; | 162 id = output.index; |
| 163 ids.insert(id); | 163 ids.insert(id); |
| 164 | 164 |
| 165 displays.push_back(DisplayInfo(id, name, has_overscan)); | 165 displays.push_back(DisplayInfo(id, name, has_overscan)); |
| 166 displays.back().set_device_scale_factor(device_scale_factor); | 166 displays.back().set_device_scale_factor(device_scale_factor); |
| 167 displays.back().SetBounds(display_bounds); | 167 displays.back().SetBounds(display_bounds); |
| 168 displays.back().set_native(true); | 168 displays.back().set_native(true); |
| (...skipping 10 matching lines...) Expand all Loading... |
| 179 void DisplayChangeObserver::OnAppTerminating() { | 179 void DisplayChangeObserver::OnAppTerminating() { |
| 180 #if defined(USE_ASH) | 180 #if defined(USE_ASH) |
| 181 // Stop handling display configuration events once the shutdown | 181 // Stop handling display configuration events once the shutdown |
| 182 // process starts. crbug.com/177014. | 182 // process starts. crbug.com/177014. |
| 183 Shell::GetInstance()->output_configurator()->PrepareForExit(); | 183 Shell::GetInstance()->output_configurator()->PrepareForExit(); |
| 184 #endif | 184 #endif |
| 185 } | 185 } |
| 186 | 186 |
| 187 } // namespace internal | 187 } // namespace internal |
| 188 } // namespace ash | 188 } // namespace ash |
| OLD | NEW |