Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(338)

Unified Diff: ash/display/display_change_observer_chromeos.cc

Issue 1289043002: Hookup device dpi for ChromeOS (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: review Created 5 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | ash/display/display_info.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ash/display/display_change_observer_chromeos.cc
diff --git a/ash/display/display_change_observer_chromeos.cc b/ash/display/display_change_observer_chromeos.cc
index fd2a66d1fa86e2aeb367725a758722e11a40b590..f167f9c10150fc27ee7ef8e96878f36294cd8580 100644
--- a/ash/display/display_change_observer_chromeos.cc
+++ b/ash/display/display_change_observer_chromeos.cc
@@ -187,12 +187,14 @@ void DisplayChangeObserver::OnDisplayModeChanged(
continue;
float device_scale_factor = 1.0f;
+ // Sets dpi only if the screen size is not blacklisted.
+ float dpi = ui::IsDisplaySizeBlackListed(state->physical_size())
+ ? 0
+ : kInchInMm * mode_info->size().width() /
+ state->physical_size().width();
if (state->type() == ui::DISPLAY_CONNECTION_TYPE_INTERNAL) {
- if (!ui::IsDisplaySizeBlackListed(state->physical_size())) {
- device_scale_factor =
- FindDeviceScaleFactor((kInchInMm * mode_info->size().width() /
- state->physical_size().width()));
- }
+ if (dpi)
+ device_scale_factor = FindDeviceScaleFactor(dpi);
} else {
DisplayMode mode;
if (Shell::GetInstance()->display_manager()->GetSelectedModeForDisplayId(
@@ -234,6 +236,8 @@ void DisplayChangeObserver::OnDisplayModeChanged(
new_info.set_native(true);
new_info.set_is_aspect_preserving_scaling(
state->is_aspect_preserving_scaling());
+ if (dpi)
+ new_info.set_device_dpi(dpi);
std::vector<DisplayMode> display_modes =
(state->type() == ui::DISPLAY_CONNECTION_TYPE_INTERNAL)
« no previous file with comments | « no previous file | ash/display/display_info.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698