| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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 "services/ui/display/platform_screen_impl_ozone.h" | 5 #include "services/ui/display/platform_screen_impl_ozone.h" |
| 6 | 6 |
| 7 #include "base/memory/ptr_util.h" | 7 #include "base/memory/ptr_util.h" |
| 8 #include "base/sys_info.h" | 8 #include "base/sys_info.h" |
| 9 #include "base/threading/thread_task_runner_handle.h" | 9 #include "base/threading/thread_task_runner_handle.h" |
| 10 #include "third_party/skia/include/core/SkColor.h" | 10 #include "third_party/skia/include/core/SkColor.h" |
| (...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 65 } | 65 } |
| 66 } | 66 } |
| 67 | 67 |
| 68 void PlatformScreenImplOzone::OnDisplayModeChanged( | 68 void PlatformScreenImplOzone::OnDisplayModeChanged( |
| 69 const ui::DisplayConfigurator::DisplayStateList& displays) { | 69 const ui::DisplayConfigurator::DisplayStateList& displays) { |
| 70 // TODO(kylechar): Remove checks when multiple display support is added. | 70 // TODO(kylechar): Remove checks when multiple display support is added. |
| 71 CHECK(displays.size() == 1) << "Mus only supports one 1 display"; | 71 CHECK(displays.size() == 1) << "Mus only supports one 1 display"; |
| 72 CHECK(!callback_.is_null()); | 72 CHECK(!callback_.is_null()); |
| 73 | 73 |
| 74 gfx::Point origin; | 74 gfx::Point origin; |
| 75 for (auto display : displays) { | 75 for (auto* display : displays) { |
| 76 const ui::DisplayMode* current_mode = display->current_mode(); | 76 const ui::DisplayMode* current_mode = display->current_mode(); |
| 77 gfx::Rect bounds(origin, current_mode->size()); | 77 gfx::Rect bounds(origin, current_mode->size()); |
| 78 | 78 |
| 79 callback_.Run(display->display_id(), bounds); | 79 callback_.Run(display->display_id(), bounds); |
| 80 | 80 |
| 81 // Move the origin so that next display is to the right of current display. | 81 // Move the origin so that next display is to the right of current display. |
| 82 origin.Offset(current_mode->size().width(), 0); | 82 origin.Offset(current_mode->size().width(), 0); |
| 83 } | 83 } |
| 84 | 84 |
| 85 callback_.Reset(); | 85 callback_.Reset(); |
| 86 } | 86 } |
| 87 | 87 |
| 88 void PlatformScreenImplOzone::OnDisplayModeChangeFailed( | 88 void PlatformScreenImplOzone::OnDisplayModeChangeFailed( |
| 89 const ui::DisplayConfigurator::DisplayStateList& displays, | 89 const ui::DisplayConfigurator::DisplayStateList& displays, |
| 90 MultipleDisplayState failed_new_state) { | 90 MultipleDisplayState failed_new_state) { |
| 91 LOG(ERROR) << "OnDisplayModeChangeFailed from DisplayConfigurator"; | 91 LOG(ERROR) << "OnDisplayModeChangeFailed from DisplayConfigurator"; |
| 92 callback_.Reset(); | 92 callback_.Reset(); |
| 93 } | 93 } |
| 94 | 94 |
| 95 } // namespace display | 95 } // namespace display |
| 96 } // namespace ui | 96 } // namespace ui |
| OLD | NEW |