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/display/display_info.h" | 9 #include "ash/display/display_info.h" |
10 #include "ash/display/display_manager.h" | 10 #include "ash/display/display_manager.h" |
11 #include "ash/shell.h" | 11 #include "ash/shell.h" |
12 #include "base/strings/string_split.h" | 12 #include "base/strings/string_split.h" |
13 #include "ui/aura/window_event_dispatcher.h" | 13 #include "ui/aura/window_event_dispatcher.h" |
14 #include "ui/gfx/display.h" | 14 #include "ui/gfx/display.h" |
15 | 15 |
16 namespace ash { | 16 namespace ash { |
17 namespace test { | 17 namespace test { |
18 typedef std::vector<gfx::Display> DisplayList; | 18 typedef std::vector<gfx::Display> DisplayList; |
19 typedef internal::DisplayInfo DisplayInfo; | 19 typedef DisplayInfo DisplayInfo; |
20 typedef std::vector<DisplayInfo> DisplayInfoList; | 20 typedef std::vector<DisplayInfo> DisplayInfoList; |
21 | 21 |
22 namespace { | 22 namespace { |
23 | 23 |
24 std::vector<DisplayInfo> CreateDisplayInfoListFromString( | 24 std::vector<DisplayInfo> CreateDisplayInfoListFromString( |
25 const std::string specs, | 25 const std::string specs, |
26 internal::DisplayManager* display_manager) { | 26 DisplayManager* display_manager) { |
27 std::vector<DisplayInfo> display_info_list; | 27 std::vector<DisplayInfo> display_info_list; |
28 std::vector<std::string> parts; | 28 std::vector<std::string> parts; |
29 base::SplitString(specs, ',', &parts); | 29 base::SplitString(specs, ',', &parts); |
30 size_t index = 0; | 30 size_t index = 0; |
31 for (std::vector<std::string>::const_iterator iter = parts.begin(); | 31 for (std::vector<std::string>::const_iterator iter = parts.begin(); |
32 iter != parts.end(); ++iter, ++index) { | 32 iter != parts.end(); ++iter, ++index) { |
33 int64 id = index < display_manager->GetNumDisplays() ? | 33 int64 id = index < display_manager->GetNumDisplays() ? |
34 display_manager->GetDisplayAt(index).id() : | 34 display_manager->GetDisplayAt(index).id() : |
35 gfx::Display::kInvalidDisplayID; | 35 gfx::Display::kInvalidDisplayID; |
36 display_info_list.push_back( | 36 display_info_list.push_back( |
37 DisplayInfo::CreateFromSpecWithID(*iter, id)); | 37 DisplayInfo::CreateFromSpecWithID(*iter, id)); |
38 } | 38 } |
39 return display_info_list; | 39 return display_info_list; |
40 } | 40 } |
41 | 41 |
42 } // namespace | 42 } // namespace |
43 | 43 |
44 DisplayManagerTestApi::DisplayManagerTestApi( | 44 DisplayManagerTestApi::DisplayManagerTestApi(DisplayManager* display_manager) |
45 internal::DisplayManager* display_manager) | 45 : display_manager_(display_manager) {} |
46 : display_manager_(display_manager) { | |
47 } | |
48 | 46 |
49 DisplayManagerTestApi::~DisplayManagerTestApi() {} | 47 DisplayManagerTestApi::~DisplayManagerTestApi() {} |
50 | 48 |
51 void DisplayManagerTestApi::UpdateDisplay( | 49 void DisplayManagerTestApi::UpdateDisplay( |
52 const std::string& display_specs) { | 50 const std::string& display_specs) { |
53 std::vector<DisplayInfo> display_info_list = | 51 std::vector<DisplayInfo> display_info_list = |
54 CreateDisplayInfoListFromString(display_specs, display_manager_); | 52 CreateDisplayInfoListFromString(display_specs, display_manager_); |
55 bool is_host_origin_set = false; | 53 bool is_host_origin_set = false; |
56 for (size_t i = 0; i < display_info_list.size(); ++i) { | 54 for (size_t i = 0; i < display_info_list.size(); ++i) { |
57 const DisplayInfo& display_info = display_info_list[i]; | 55 const DisplayInfo& display_info = display_info_list[i]; |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
94 | 92 |
95 void DisplayManagerTestApi::SetAvailableColorProfiles( | 93 void DisplayManagerTestApi::SetAvailableColorProfiles( |
96 int64 display_id, | 94 int64 display_id, |
97 const std::vector<ui::ColorCalibrationProfile>& profiles) { | 95 const std::vector<ui::ColorCalibrationProfile>& profiles) { |
98 display_manager_->display_info_[display_id].set_available_color_profiles( | 96 display_manager_->display_info_[display_id].set_available_color_profiles( |
99 profiles); | 97 profiles); |
100 } | 98 } |
101 | 99 |
102 } // namespace test | 100 } // namespace test |
103 } // namespace ash | 101 } // namespace ash |
OLD | NEW |