| 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 "services/ui/display/platform_screen_stub.h" | 5 #include "services/ui/display/platform_screen_stub.h" |
| 6 | 6 |
| 7 #include <memory> | 7 #include <memory> |
| 8 | 8 |
| 9 #include "base/bind.h" | 9 #include "base/bind.h" |
| 10 #include "base/location.h" | 10 #include "base/location.h" |
| (...skipping 25 matching lines...) Expand all Loading... |
| 36 float device_scale_factor = 1.0f; | 36 float device_scale_factor = 1.0f; |
| 37 if (Display::HasForceDeviceScaleFactor()) | 37 if (Display::HasForceDeviceScaleFactor()) |
| 38 device_scale_factor = Display::GetForcedDeviceScaleFactor(); | 38 device_scale_factor = Display::GetForcedDeviceScaleFactor(); |
| 39 | 39 |
| 40 gfx::Size scaled_size = | 40 gfx::Size scaled_size = |
| 41 gfx::ScaleToRoundedSize(kDisplaySize, 1.0f / device_scale_factor); | 41 gfx::ScaleToRoundedSize(kDisplaySize, 1.0f / device_scale_factor); |
| 42 delegate_->OnDisplayAdded(kDisplayId, gfx::Rect(scaled_size), kDisplaySize, | 42 delegate_->OnDisplayAdded(kDisplayId, gfx::Rect(scaled_size), kDisplaySize, |
| 43 device_scale_factor); | 43 device_scale_factor); |
| 44 } | 44 } |
| 45 | 45 |
| 46 void PlatformScreenStub::AddInterfaces(shell::InterfaceRegistry* registry) {} | 46 void PlatformScreenStub::AddInterfaces( |
| 47 service_manager::InterfaceRegistry* registry) {} |
| 47 | 48 |
| 48 void PlatformScreenStub::Init(PlatformScreenDelegate* delegate) { | 49 void PlatformScreenStub::Init(PlatformScreenDelegate* delegate) { |
| 49 DCHECK(delegate); | 50 DCHECK(delegate); |
| 50 delegate_ = delegate; | 51 delegate_ = delegate; |
| 51 base::ThreadTaskRunnerHandle::Get()->PostTask( | 52 base::ThreadTaskRunnerHandle::Get()->PostTask( |
| 52 FROM_HERE, base::Bind(&PlatformScreenStub::FixedSizeScreenConfiguration, | 53 FROM_HERE, base::Bind(&PlatformScreenStub::FixedSizeScreenConfiguration, |
| 53 weak_ptr_factory_.GetWeakPtr())); | 54 weak_ptr_factory_.GetWeakPtr())); |
| 54 } | 55 } |
| 55 | 56 |
| 56 void PlatformScreenStub::RequestCloseDisplay(int64_t display_id) { | 57 void PlatformScreenStub::RequestCloseDisplay(int64_t display_id) { |
| 57 if (display_id == kDisplayId) { | 58 if (display_id == kDisplayId) { |
| 58 base::ThreadTaskRunnerHandle::Get()->PostTask( | 59 base::ThreadTaskRunnerHandle::Get()->PostTask( |
| 59 FROM_HERE, base::Bind(&PlatformScreenDelegate::OnDisplayRemoved, | 60 FROM_HERE, base::Bind(&PlatformScreenDelegate::OnDisplayRemoved, |
| 60 base::Unretained(delegate_), display_id)); | 61 base::Unretained(delegate_), display_id)); |
| 61 } | 62 } |
| 62 } | 63 } |
| 63 | 64 |
| 64 int64_t PlatformScreenStub::GetPrimaryDisplayId() const { | 65 int64_t PlatformScreenStub::GetPrimaryDisplayId() const { |
| 65 return kDisplayId; | 66 return kDisplayId; |
| 66 } | 67 } |
| 67 | 68 |
| 68 } // namespace display | 69 } // namespace display |
| OLD | NEW |