| 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_impl.h" | 5 #include "services/ui/display/platform_screen_impl.h" |
| 6 | 6 |
| 7 #include <memory> |
| 8 |
| 7 #include "base/bind.h" | 9 #include "base/bind.h" |
| 8 #include "base/location.h" | 10 #include "base/location.h" |
| 9 #include "base/memory/ptr_util.h" | 11 #include "base/memory/ptr_util.h" |
| 10 #include "base/threading/thread_task_runner_handle.h" | 12 #include "base/threading/thread_task_runner_handle.h" |
| 11 #include "ui/gfx/geometry/rect.h" | 13 #include "ui/gfx/geometry/rect.h" |
| 12 | 14 |
| 13 namespace display { | 15 namespace display { |
| 14 namespace { | 16 namespace { |
| 15 | 17 |
| 16 const int64_t kDisplayId = 1; | 18 const int64_t kDisplayId = 1; |
| 17 | 19 |
| 18 void FixedSizeScreenConfiguration( | |
| 19 const PlatformScreen::ConfiguredDisplayCallback& callback) { | |
| 20 callback.Run(kDisplayId, gfx::Rect(1024, 768)); | |
| 21 } | |
| 22 | |
| 23 } // namespace | 20 } // namespace |
| 24 | 21 |
| 25 // static | 22 // static |
| 26 std::unique_ptr<PlatformScreen> PlatformScreen::Create() { | 23 std::unique_ptr<PlatformScreen> PlatformScreen::Create() { |
| 27 return base::WrapUnique(new PlatformScreenImpl); | 24 return base::MakeUnique<PlatformScreenImpl>(); |
| 28 } | 25 } |
| 29 | 26 |
| 30 PlatformScreenImpl::PlatformScreenImpl() {} | 27 PlatformScreenImpl::PlatformScreenImpl() : weak_ptr_factory_(this) {} |
| 31 | 28 |
| 32 PlatformScreenImpl::~PlatformScreenImpl() {} | 29 PlatformScreenImpl::~PlatformScreenImpl() {} |
| 33 | 30 |
| 34 void PlatformScreenImpl::Init() {} | 31 void PlatformScreenImpl::FixedSizeScreenConfiguration() { |
| 32 delegate_->OnDisplayAdded(this, kDisplayId, gfx::Rect(1024, 768)); |
| 33 } |
| 35 | 34 |
| 36 void PlatformScreenImpl::ConfigurePhysicalDisplay( | 35 void PlatformScreenImpl::Init(PlatformScreenDelegate* delegate) { |
| 37 const PlatformScreen::ConfiguredDisplayCallback& callback) { | 36 DCHECK(delegate); |
| 37 delegate_ = delegate; |
| 38 base::ThreadTaskRunnerHandle::Get()->PostTask( | 38 base::ThreadTaskRunnerHandle::Get()->PostTask( |
| 39 FROM_HERE, base::Bind(&FixedSizeScreenConfiguration, callback)); | 39 FROM_HERE, base::Bind(&PlatformScreenImpl::FixedSizeScreenConfiguration, |
| 40 weak_ptr_factory_.GetWeakPtr())); |
| 40 } | 41 } |
| 41 | 42 |
| 42 int64_t PlatformScreenImpl::GetPrimaryDisplayId() const { | 43 int64_t PlatformScreenImpl::GetPrimaryDisplayId() const { |
| 43 return kDisplayId; | 44 return kDisplayId; |
| 44 } | 45 } |
| 45 | 46 |
| 46 } // namespace display | 47 } // namespace display |
| OLD | NEW |