| 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 "ui/views/mus/screen_mus.h" | 5 #include "ui/views/mus/screen_mus.h" |
| 6 | 6 |
| 7 #include "mojo/converters/geometry/geometry_type_converters.h" | 7 #include "mojo/converters/geometry/geometry_type_converters.h" |
| 8 #include "services/shell/public/cpp/connection.h" | 8 #include "services/shell/public/cpp/connection.h" |
| 9 #include "services/shell/public/cpp/connector.h" | 9 #include "services/shell/public/cpp/connector.h" |
| 10 #include "ui/display/display_observer.h" | 10 #include "ui/display/display_observer.h" |
| (...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 99 // from running on the calling thread. http://crbug.com/594852. | 99 // from running on the calling thread. http://crbug.com/594852. |
| 100 bool success = display_manager_observer_binding_.WaitForIncomingMethodCall(); | 100 bool success = display_manager_observer_binding_.WaitForIncomingMethodCall(); |
| 101 | 101 |
| 102 // The WaitForIncomingMethodCall() should have supplied the set of Displays, | 102 // The WaitForIncomingMethodCall() should have supplied the set of Displays, |
| 103 // unless mus is going down, in which case encountered_error() is true, or the | 103 // unless mus is going down, in which case encountered_error() is true, or the |
| 104 // call to WaitForIncomingMethodCall() failed. | 104 // call to WaitForIncomingMethodCall() failed. |
| 105 if (displays_.empty()) { | 105 if (displays_.empty()) { |
| 106 DCHECK(display_manager_.encountered_error() || !success); | 106 DCHECK(display_manager_.encountered_error() || !success); |
| 107 // In this case we install a default display and assume the process is | 107 // In this case we install a default display and assume the process is |
| 108 // going to exit shortly so that the real value doesn't matter. | 108 // going to exit shortly so that the real value doesn't matter. |
| 109 displays_.push_back(gfx::Display(0xFFFFFFFF, gfx::Rect(0, 0, 801, 802))); | 109 displays_.push_back( |
| 110 display::Display(0xFFFFFFFF, gfx::Rect(0, 0, 801, 802))); |
| 110 } | 111 } |
| 111 } | 112 } |
| 112 | 113 |
| 113 int ScreenMus::FindDisplayIndexById(int64_t id) const { | 114 int ScreenMus::FindDisplayIndexById(int64_t id) const { |
| 114 for (size_t i = 0; i < displays_.size(); ++i) { | 115 for (size_t i = 0; i < displays_.size(); ++i) { |
| 115 if (displays_[i].id() == id) | 116 if (displays_[i].id() == id) |
| 116 return static_cast<int>(i); | 117 return static_cast<int>(i); |
| 117 } | 118 } |
| 118 return -1; | 119 return -1; |
| 119 } | 120 } |
| (...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 259 DCHECK_NE(-1, index); | 260 DCHECK_NE(-1, index); |
| 260 // Another display must become primary before the existing primary is | 261 // Another display must become primary before the existing primary is |
| 261 // removed. | 262 // removed. |
| 262 DCHECK_NE(index, primary_display_index_); | 263 DCHECK_NE(index, primary_display_index_); |
| 263 const display::Display display = displays_[index]; | 264 const display::Display display = displays_[index]; |
| 264 FOR_EACH_OBSERVER(display::DisplayObserver, observers_, | 265 FOR_EACH_OBSERVER(display::DisplayObserver, observers_, |
| 265 OnDisplayRemoved(display)); | 266 OnDisplayRemoved(display)); |
| 266 } | 267 } |
| 267 | 268 |
| 268 } // namespace views | 269 } // namespace views |
| OLD | NEW |