OLD | NEW |
---|---|
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 "ui/display/chromeos/output_configurator.h" | 5 #include "ui/display/chromeos/output_configurator.h" |
6 | 6 |
7 #include <stdint.h> | |
8 | |
7 #include <cmath> | 9 #include <cmath> |
8 #include <cstdarg> | 10 #include <cstdarg> |
9 #include <map> | 11 #include <map> |
10 #include <string> | 12 #include <string> |
11 #include <vector> | 13 #include <vector> |
12 | 14 |
13 #include "base/basictypes.h" | |
14 #include "base/compiler_specific.h" | 15 #include "base/compiler_specific.h" |
15 #include "base/format_macros.h" | 16 #include "base/format_macros.h" |
16 #include "base/memory/scoped_vector.h" | 17 #include "base/memory/scoped_vector.h" |
17 #include "base/message_loop/message_loop.h" | 18 #include "base/message_loop/message_loop.h" |
18 #include "base/strings/stringprintf.h" | 19 #include "base/strings/stringprintf.h" |
19 #include "testing/gtest/include/gtest/gtest.h" | 20 #include "testing/gtest/include/gtest/gtest.h" |
20 #include "ui/display/chromeos/display_mode.h" | 21 #include "ui/display/chromeos/display_mode.h" |
21 #include "ui/display/chromeos/native_display_delegate.h" | 22 #include "ui/display/chromeos/native_display_delegate.h" |
22 #include "ui/display/chromeos/test/test_display_snapshot.h" | 23 #include "ui/display/chromeos/test/test_display_snapshot.h" |
23 | 24 |
(...skipping 12 matching lines...) Expand all Loading... | |
36 // String returned by TestNativeDisplayDelegate::GetActionsAndClear() if no | 37 // String returned by TestNativeDisplayDelegate::GetActionsAndClear() if no |
37 // actions were requested. | 38 // actions were requested. |
38 const char kNoActions[] = ""; | 39 const char kNoActions[] = ""; |
39 | 40 |
40 std::string DisplaySnapshotToString(const DisplaySnapshot& output) { | 41 std::string DisplaySnapshotToString(const DisplaySnapshot& output) { |
41 return base::StringPrintf("id=%" PRId64, output.display_id()); | 42 return base::StringPrintf("id=%" PRId64, output.display_id()); |
42 } | 43 } |
43 | 44 |
44 // Returns a string describing a TestNativeDisplayDelegate::SetBackgroundColor() | 45 // Returns a string describing a TestNativeDisplayDelegate::SetBackgroundColor() |
45 // call. | 46 // call. |
46 std::string GetBackgroundAction(uint32 color_argb) { | 47 std::string GetBackgroundAction(uint32_t color_argb) { |
47 return base::StringPrintf("background(0x%x)", color_argb); | 48 return base::StringPrintf("background(0x%x)", color_argb); |
48 } | 49 } |
49 | 50 |
50 // Returns a string describing a TestNativeDisplayDelegate::AddOutputMode() | 51 // Returns a string describing a TestNativeDisplayDelegate::AddOutputMode() |
51 // call. | 52 // call. |
52 std::string GetAddOutputModeAction(const DisplaySnapshot& output, | 53 std::string GetAddOutputModeAction(const DisplaySnapshot& output, |
53 const DisplayMode* mode) { | 54 const DisplayMode* mode) { |
54 return base::StringPrintf("add_mode(output=%" PRId64 ",mode=%s)", | 55 return base::StringPrintf("add_mode(output=%" PRId64 ",mode=%s)", |
55 output.display_id(), | 56 output.display_id(), |
56 mode->ToString().c_str()); | 57 mode->ToString().c_str()); |
(...skipping 148 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
205 max_configurable_pixels_ = pixels; | 206 max_configurable_pixels_ = pixels; |
206 } | 207 } |
207 | 208 |
208 void set_hdcp_state(HDCPState state) { hdcp_state_ = state; } | 209 void set_hdcp_state(HDCPState state) { hdcp_state_ = state; } |
209 | 210 |
210 // OutputConfigurator::Delegate overrides: | 211 // OutputConfigurator::Delegate overrides: |
211 virtual void Initialize() OVERRIDE { log_->AppendAction(kInitXRandR); } | 212 virtual void Initialize() OVERRIDE { log_->AppendAction(kInitXRandR); } |
212 virtual void GrabServer() OVERRIDE { log_->AppendAction(kGrab); } | 213 virtual void GrabServer() OVERRIDE { log_->AppendAction(kGrab); } |
213 virtual void UngrabServer() OVERRIDE { log_->AppendAction(kUngrab); } | 214 virtual void UngrabServer() OVERRIDE { log_->AppendAction(kUngrab); } |
214 virtual void SyncWithServer() OVERRIDE { log_->AppendAction(kSync); } | 215 virtual void SyncWithServer() OVERRIDE { log_->AppendAction(kSync); } |
215 virtual void SetBackgroundColor(uint32 color_argb) OVERRIDE { | 216 virtual void SetBackgroundColor(uint32_t color_argb) OVERRIDE { |
216 log_->AppendAction(GetBackgroundAction(color_argb)); | 217 log_->AppendAction(GetBackgroundAction(color_argb)); |
217 } | 218 } |
218 virtual void ForceDPMSOn() OVERRIDE { log_->AppendAction(kForceDPMS); } | 219 virtual void ForceDPMSOn() OVERRIDE { log_->AppendAction(kForceDPMS); } |
219 virtual std::vector<DisplaySnapshot*> GetOutputs() OVERRIDE { | 220 virtual std::vector<DisplaySnapshot*> GetOutputs() OVERRIDE { |
220 return outputs_; | 221 return outputs_; |
221 } | 222 } |
222 virtual void AddMode(const DisplaySnapshot& output, | 223 virtual void AddMode(const DisplaySnapshot& output, |
223 const DisplayMode* mode) OVERRIDE { | 224 const DisplayMode* mode) OVERRIDE { |
224 log_->AppendAction(GetAddOutputModeAction(output, mode)); | 225 log_->AppendAction(GetAddOutputModeAction(output, mode)); |
225 } | 226 } |
(...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
342 | 343 |
343 class TestStateController : public OutputConfigurator::StateController { | 344 class TestStateController : public OutputConfigurator::StateController { |
344 public: | 345 public: |
345 TestStateController() : state_(OUTPUT_STATE_DUAL_EXTENDED) {} | 346 TestStateController() : state_(OUTPUT_STATE_DUAL_EXTENDED) {} |
346 virtual ~TestStateController() {} | 347 virtual ~TestStateController() {} |
347 | 348 |
348 void set_state(OutputState state) { state_ = state; } | 349 void set_state(OutputState state) { state_ = state; } |
349 | 350 |
350 // OutputConfigurator::StateController overrides: | 351 // OutputConfigurator::StateController overrides: |
351 virtual OutputState GetStateForDisplayIds( | 352 virtual OutputState GetStateForDisplayIds( |
352 const std::vector<int64>& outputs) const OVERRIDE { | 353 const std::vector<int64_t>& outputs) const OVERRIDE { |
353 return state_; | 354 return state_; |
354 } | 355 } |
355 virtual bool GetResolutionForDisplayId(int64 display_id, | 356 virtual bool GetResolutionForDisplayId(int64_t display_id, |
Daniel Erat
2014/03/27 20:33:07
nit: not for this change, but it'd probably be nic
dnicoara
2014/03/27 21:12:21
OK, I'll take a look. We likely want to change ui/
| |
356 gfx::Size* size) const OVERRIDE { | 357 gfx::Size* size) const OVERRIDE { |
357 return false; | 358 return false; |
358 } | 359 } |
359 | 360 |
360 private: | 361 private: |
361 OutputState state_; | 362 OutputState state_; |
362 | 363 |
363 DISALLOW_COPY_AND_ASSIGN(TestStateController); | 364 DISALLOW_COPY_AND_ASSIGN(TestStateController); |
364 }; | 365 }; |
365 | 366 |
(...skipping 980 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1346 gfx::Point(0, | 1347 gfx::Point(0, |
1347 modes[0]->size().height() + | 1348 modes[0]->size().height() + |
1348 OutputConfigurator::kVerticalGap)) | 1349 OutputConfigurator::kVerticalGap)) |
1349 .c_str(), | 1350 .c_str(), |
1350 kUngrab, | 1351 kUngrab, |
1351 NULL), | 1352 NULL), |
1352 log_->GetActionsAndClear()); | 1353 log_->GetActionsAndClear()); |
1353 } | 1354 } |
1354 | 1355 |
1355 } // namespace ui | 1356 } // namespace ui |
OLD | NEW |