| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/test/display_manager_test_api.h" | 5 #include "ash/test/display_manager_test_api.h" |
| 6 | 6 |
| 7 #include <cstdarg> | 7 #include <cstdarg> |
| 8 #include <vector> | 8 #include <vector> |
| 9 | 9 |
| 10 #include "ash/common/ash_switches.h" | 10 #include "ash/common/ash_switches.h" |
| (...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 148 DisplayManagerTestApi().SetInternalDisplayId(id); | 148 DisplayManagerTestApi().SetInternalDisplayId(id); |
| 149 } | 149 } |
| 150 | 150 |
| 151 ScopedSetInternalDisplayId::~ScopedSetInternalDisplayId() { | 151 ScopedSetInternalDisplayId::~ScopedSetInternalDisplayId() { |
| 152 display::Display::SetInternalDisplayId(display::Display::kInvalidDisplayID); | 152 display::Display::SetInternalDisplayId(display::Display::kInvalidDisplayID); |
| 153 } | 153 } |
| 154 | 154 |
| 155 bool SetDisplayResolution(int64_t display_id, const gfx::Size& resolution) { | 155 bool SetDisplayResolution(int64_t display_id, const gfx::Size& resolution) { |
| 156 DisplayManager* display_manager = Shell::GetInstance()->display_manager(); | 156 DisplayManager* display_manager = Shell::GetInstance()->display_manager(); |
| 157 const DisplayInfo& info = display_manager->GetDisplayInfo(display_id); | 157 const DisplayInfo& info = display_manager->GetDisplayInfo(display_id); |
| 158 DisplayMode mode; | 158 scoped_refptr<DisplayMode> mode = |
| 159 if (!GetDisplayModeForResolution(info, resolution, &mode)) | 159 GetDisplayModeForResolution(info, resolution); |
| 160 if (!mode) |
| 160 return false; | 161 return false; |
| 161 return display_manager->SetDisplayMode(display_id, mode); | 162 return display_manager->SetDisplayMode(display_id, mode); |
| 162 } | 163 } |
| 163 | 164 |
| 164 void SwapPrimaryDisplay() { | 165 void SwapPrimaryDisplay() { |
| 165 if (display::Screen::GetScreen()->GetNumDisplays() <= 1) | 166 if (display::Screen::GetScreen()->GetNumDisplays() <= 1) |
| 166 return; | 167 return; |
| 167 Shell::GetInstance()->window_tree_host_manager()->SetPrimaryDisplayId( | 168 Shell::GetInstance()->window_tree_host_manager()->SetPrimaryDisplayId( |
| 168 ScreenUtil::GetSecondaryDisplay().id()); | 169 ScreenUtil::GetSecondaryDisplay().id()); |
| 169 } | 170 } |
| (...skipping 26 matching lines...) Expand all Loading... |
| 196 for (size_t i = 0; i < count; i++) { | 197 for (size_t i = 0; i < count; i++) { |
| 197 int64_t id = va_arg(args, int64_t); | 198 int64_t id = va_arg(args, int64_t); |
| 198 list.push_back(id); | 199 list.push_back(id); |
| 199 } | 200 } |
| 200 SortDisplayIdList(&list); | 201 SortDisplayIdList(&list); |
| 201 return list; | 202 return list; |
| 202 } | 203 } |
| 203 | 204 |
| 204 } // namespace test | 205 } // namespace test |
| 205 } // namespace ash | 206 } // namespace ash |
| OLD | NEW |