| 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" |
| 11 #include "base/memory/ptr_util.h" | 11 #include "base/memory/ptr_util.h" |
| 12 #include "base/threading/thread_task_runner_handle.h" | 12 #include "base/threading/thread_task_runner_handle.h" |
| 13 #include "services/shell/public/cpp/interface_registry.h" |
| 13 #include "ui/gfx/geometry/rect.h" | 14 #include "ui/gfx/geometry/rect.h" |
| 14 | 15 |
| 15 namespace display { | 16 namespace display { |
| 16 namespace { | 17 namespace { |
| 17 | 18 |
| 18 const int64_t kDisplayId = 1; | 19 const int64_t kDisplayId = 1; |
| 19 | 20 |
| 20 } // namespace | 21 } // namespace |
| 21 | 22 |
| 22 // static | 23 // static |
| 23 std::unique_ptr<PlatformScreen> PlatformScreen::Create() { | 24 std::unique_ptr<PlatformScreen> PlatformScreen::Create() { |
| 24 return base::MakeUnique<PlatformScreenStub>(); | 25 return base::MakeUnique<PlatformScreenStub>(); |
| 25 } | 26 } |
| 26 | 27 |
| 27 PlatformScreenStub::PlatformScreenStub() : weak_ptr_factory_(this) {} | 28 PlatformScreenStub::PlatformScreenStub() : weak_ptr_factory_(this) {} |
| 28 | 29 |
| 29 PlatformScreenStub::~PlatformScreenStub() {} | 30 PlatformScreenStub::~PlatformScreenStub() {} |
| 30 | 31 |
| 31 void PlatformScreenStub::FixedSizeScreenConfiguration() { | 32 void PlatformScreenStub::FixedSizeScreenConfiguration() { |
| 32 delegate_->OnDisplayAdded(kDisplayId, gfx::Rect(1024, 768)); | 33 delegate_->OnDisplayAdded(kDisplayId, gfx::Rect(1024, 768)); |
| 33 } | 34 } |
| 34 | 35 |
| 36 void PlatformScreenStub::AddInterfaces(shell::InterfaceRegistry* registry) {} |
| 37 |
| 35 void PlatformScreenStub::Init(PlatformScreenDelegate* delegate) { | 38 void PlatformScreenStub::Init(PlatformScreenDelegate* delegate) { |
| 36 DCHECK(delegate); | 39 DCHECK(delegate); |
| 37 delegate_ = delegate; | 40 delegate_ = delegate; |
| 38 base::ThreadTaskRunnerHandle::Get()->PostTask( | 41 base::ThreadTaskRunnerHandle::Get()->PostTask( |
| 39 FROM_HERE, base::Bind(&PlatformScreenStub::FixedSizeScreenConfiguration, | 42 FROM_HERE, base::Bind(&PlatformScreenStub::FixedSizeScreenConfiguration, |
| 40 weak_ptr_factory_.GetWeakPtr())); | 43 weak_ptr_factory_.GetWeakPtr())); |
| 41 } | 44 } |
| 42 | 45 |
| 43 int64_t PlatformScreenStub::GetPrimaryDisplayId() const { | 46 int64_t PlatformScreenStub::GetPrimaryDisplayId() const { |
| 44 return kDisplayId; | 47 return kDisplayId; |
| 45 } | 48 } |
| 46 | 49 |
| 47 } // namespace display | 50 } // namespace display |
| OLD | NEW |