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 <vector> | 7 #include <vector> |
8 | 8 |
9 #include "ash/ash_switches.h" | 9 #include "ash/ash_switches.h" |
10 #include "ash/display/display_info.h" | 10 #include "ash/display/display_info.h" |
(...skipping 16 matching lines...) Expand all Loading... |
27 typedef std::vector<gfx::Display> DisplayList; | 27 typedef std::vector<gfx::Display> DisplayList; |
28 typedef DisplayInfo DisplayInfo; | 28 typedef DisplayInfo DisplayInfo; |
29 typedef std::vector<DisplayInfo> DisplayInfoList; | 29 typedef std::vector<DisplayInfo> DisplayInfoList; |
30 | 30 |
31 namespace { | 31 namespace { |
32 | 32 |
33 std::vector<DisplayInfo> CreateDisplayInfoListFromString( | 33 std::vector<DisplayInfo> CreateDisplayInfoListFromString( |
34 const std::string specs, | 34 const std::string specs, |
35 DisplayManager* display_manager) { | 35 DisplayManager* display_manager) { |
36 std::vector<DisplayInfo> display_info_list; | 36 std::vector<DisplayInfo> display_info_list; |
37 std::vector<std::string> parts; | 37 std::vector<std::string> parts = base::SplitString( |
38 base::SplitString(specs, ',', &parts); | 38 specs, ",", base::TRIM_WHITESPACE, base::SPLIT_WANT_ALL); |
39 size_t index = 0; | 39 size_t index = 0; |
40 | 40 |
41 DisplayManager::DisplayList list = | 41 DisplayManager::DisplayList list = |
42 display_manager->IsInUnifiedMode() | 42 display_manager->IsInUnifiedMode() |
43 ? display_manager->software_mirroring_display_list() | 43 ? display_manager->software_mirroring_display_list() |
44 : display_manager->active_display_list(); | 44 : display_manager->active_display_list(); |
45 | 45 |
46 for (std::vector<std::string>::const_iterator iter = parts.begin(); | 46 for (std::vector<std::string>::const_iterator iter = parts.begin(); |
47 iter != parts.end(); ++iter, ++index) { | 47 iter != parts.end(); ++iter, ++index) { |
48 int64 id = (index < list.size()) ? list[index].id() | 48 int64 id = (index < list.size()) ? list[index].id() |
(...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
159 DisplayManager* display_manager = Shell::GetInstance()->display_manager(); | 159 DisplayManager* display_manager = Shell::GetInstance()->display_manager(); |
160 const DisplayInfo& info = display_manager->GetDisplayInfo(display_id); | 160 const DisplayInfo& info = display_manager->GetDisplayInfo(display_id); |
161 DisplayMode mode; | 161 DisplayMode mode; |
162 if (!GetDisplayModeForResolution(info, resolution, &mode)) | 162 if (!GetDisplayModeForResolution(info, resolution, &mode)) |
163 return false; | 163 return false; |
164 return display_manager->SetDisplayMode(display_id, mode); | 164 return display_manager->SetDisplayMode(display_id, mode); |
165 } | 165 } |
166 | 166 |
167 } // namespace test | 167 } // namespace test |
168 } // namespace ash | 168 } // namespace ash |
OLD | NEW |