Chromium Code Reviews| Index: ash/touch/touch_transformer_controller.cc |
| diff --git a/ash/touch/touch_transformer_controller.cc b/ash/touch/touch_transformer_controller.cc |
| index 67cbab2b5bdc57d6c1536bfc52270acf766a1773..7686760a746f195171f85fdf9bb04f691e3b4de2 100644 |
| --- a/ash/touch/touch_transformer_controller.cc |
| +++ b/ash/touch/touch_transformer_controller.cc |
| @@ -22,6 +22,17 @@ DisplayManager* GetDisplayManager() { |
| return Shell::GetInstance()->display_manager(); |
| } |
| +gfx::Size GetNativeModeSize(const DisplayInfo& display) { |
| + const std::vector<DisplayMode>& modes = display.display_modes(); |
| + for (size_t i = 0; i < modes.size(); ++i) { |
| + if (modes[i].native) { |
|
Daniel Erat
2014/06/17 21:59:18
nit: remove these curly brackets
dnicoara
2014/06/20 17:01:05
Done.
|
| + return modes[i].size; |
| + } |
| + } |
| + |
| + return gfx::Size(); |
| +} |
| + |
| } // namespace |
| // This function computes the extended mode TouchTransformer for |
| @@ -49,18 +60,20 @@ bool TouchTransformerController::ShouldComputeMirrorModeTouchTransformer( |
| if (touch_display.touch_device_id() == 0) |
| return false; |
| - const ui::DisplayConfigurator::DisplayState* state = NULL; |
| - const std::vector<ui::DisplayConfigurator::DisplayState>& cached_displays = |
| - Shell::GetInstance()->display_configurator()->cached_displays(); |
| - for (size_t i = 0; i < cached_displays.size(); i++) { |
| - if (cached_displays[i].touch_device_id == touch_display.touch_device_id()) { |
| - state = &cached_displays[i]; |
| + DisplayManager* display_manager = Shell::GetInstance()->display_manager(); |
| + const std::vector<gfx::Display>& displays = display_manager->displays(); |
| + const DisplayInfo* info = NULL; |
| + for (size_t i = 0; i < displays.size(); i++) { |
| + const DisplayInfo& current_info = |
| + display_manager->GetDisplayInfo(displays[i].id()); |
| + if (current_info.touch_device_id() == touch_display.touch_device_id()) { |
| + info = ¤t_info; |
| break; |
| } |
| } |
| - if (!state || state->mirror_mode == state->display->native_mode() || |
| - !state->display->is_aspect_preserving_scaling()) { |
| + if (!info || info->size_in_pixel() == GetNativeModeSize(*info) || |
| + !info->is_aspect_preserving_scaling()) { |
| return false; |
| } |
| return true; |