| 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/gfx/display_finder.h" | 10 #include "ui/gfx/display_finder.h" |
| (...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 73 } | 73 } |
| 74 }; | 74 }; |
| 75 | 75 |
| 76 } // namespace mojo | 76 } // namespace mojo |
| 77 | 77 |
| 78 namespace views { | 78 namespace views { |
| 79 | 79 |
| 80 ScreenMus::ScreenMus(ScreenMusDelegate* delegate) | 80 ScreenMus::ScreenMus(ScreenMusDelegate* delegate) |
| 81 : delegate_(delegate), | 81 : delegate_(delegate), |
| 82 primary_display_index_(0), | 82 primary_display_index_(0), |
| 83 display_manager_observer_binding_(this) {} | 83 display_manager_observer_binding_(this) { |
| 84 } |
| 84 | 85 |
| 85 ScreenMus::~ScreenMus() {} | 86 ScreenMus::~ScreenMus() {} |
| 86 | 87 |
| 87 void ScreenMus::Init(shell::Connector* connector) { | 88 void ScreenMus::Init(shell::Connector* connector) { |
| 88 gfx::Screen::SetScreenInstance(this); | 89 gfx::Screen::SetScreenInstance(this); |
| 89 | 90 |
| 90 connector->ConnectToInterface("mojo:mus", &display_manager_); | 91 connector->ConnectToInterface("mojo:mus", &display_manager_); |
| 91 | 92 |
| 92 display_manager_->AddObserver( | 93 display_manager_->AddObserver( |
| 93 display_manager_observer_binding_.CreateInterfacePtrAndBind()); | 94 display_manager_observer_binding_.CreateInterfacePtrAndBind()); |
| (...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 152 changed_display.device_scale_factor()) { | 153 changed_display.device_scale_factor()) { |
| 153 local_display->set_device_scale_factor( | 154 local_display->set_device_scale_factor( |
| 154 changed_display.device_scale_factor()); | 155 changed_display.device_scale_factor()); |
| 155 changed_values |= gfx::DisplayObserver::DISPLAY_METRIC_DEVICE_SCALE_FACTOR; | 156 changed_values |= gfx::DisplayObserver::DISPLAY_METRIC_DEVICE_SCALE_FACTOR; |
| 156 } | 157 } |
| 157 FOR_EACH_OBSERVER(gfx::DisplayObserver, observers_, | 158 FOR_EACH_OBSERVER(gfx::DisplayObserver, observers_, |
| 158 OnDisplayMetricsChanged(*local_display, changed_values)); | 159 OnDisplayMetricsChanged(*local_display, changed_values)); |
| 159 } | 160 } |
| 160 | 161 |
| 161 gfx::Point ScreenMus::GetCursorScreenPoint() { | 162 gfx::Point ScreenMus::GetCursorScreenPoint() { |
| 162 NOTIMPLEMENTED(); | 163 if (!delegate_) { |
| 163 return gfx::Point(); | 164 // TODO(erg): If we need the cursor point in the window manager, we'll need |
| 165 // to make |delegate_| required. It only recently changed to be optional. |
| 166 NOTIMPLEMENTED(); |
| 167 return gfx::Point(); |
| 168 } |
| 169 return delegate_->GetCursorScreenPoint(); |
| 164 } | 170 } |
| 165 | 171 |
| 166 gfx::NativeWindow ScreenMus::GetWindowUnderCursor() { | 172 gfx::NativeWindow ScreenMus::GetWindowUnderCursor() { |
| 167 NOTIMPLEMENTED(); | 173 NOTIMPLEMENTED(); |
| 168 return nullptr; | 174 return nullptr; |
| 169 } | 175 } |
| 170 | 176 |
| 171 gfx::NativeWindow ScreenMus::GetWindowAtScreenPoint(const gfx::Point& point) { | 177 gfx::NativeWindow ScreenMus::GetWindowAtScreenPoint(const gfx::Point& point) { |
| 172 NOTIMPLEMENTED(); | 178 NOTIMPLEMENTED(); |
| 173 return nullptr; | 179 return nullptr; |
| (...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 246 DCHECK_NE(-1, index); | 252 DCHECK_NE(-1, index); |
| 247 // Another display must become primary before the existing primary is | 253 // Another display must become primary before the existing primary is |
| 248 // removed. | 254 // removed. |
| 249 DCHECK_NE(index, primary_display_index_); | 255 DCHECK_NE(index, primary_display_index_); |
| 250 const gfx::Display display = displays_[index]; | 256 const gfx::Display display = displays_[index]; |
| 251 FOR_EACH_OBSERVER(gfx::DisplayObserver, observers_, | 257 FOR_EACH_OBSERVER(gfx::DisplayObserver, observers_, |
| 252 OnDisplayRemoved(display)); | 258 OnDisplayRemoved(display)); |
| 253 } | 259 } |
| 254 | 260 |
| 255 } // namespace views | 261 } // namespace views |
| OLD | NEW |