Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(107)

Side by Side Diff: services/ui/display/screen_manager_stub_internal.cc

Issue 2829733002: mus: Changes SetDisplayRoot() to create actual display (Closed)
Patch Set: unnecessary get Created 3 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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/screen_manager_stub_internal.h" 5 #include "services/ui/display/screen_manager_stub_internal.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/service_manager/public/cpp/binder_registry.h" 13 #include "services/service_manager/public/cpp/binder_registry.h"
14 #include "services/ui/display/viewport_metrics.h" 14 #include "services/ui/display/viewport_metrics.h"
15 #include "ui/display/screen_base.h"
15 #include "ui/gfx/geometry/dip_util.h" 16 #include "ui/gfx/geometry/dip_util.h"
16 #include "ui/gfx/geometry/rect.h" 17 #include "ui/gfx/geometry/rect.h"
17 #include "ui/gfx/geometry/size.h" 18 #include "ui/gfx/geometry/size.h"
18 19
19 namespace display { 20 namespace display {
20 namespace { 21 namespace {
21 22
22 constexpr gfx::Size kDisplayPixelSize(1024, 768); 23 constexpr gfx::Size kDisplayPixelSize(1024, 768);
23 24
24 // Build a 1024x768 pixel display. 25 // Build a 1024x768 pixel display.
(...skipping 14 matching lines...) Expand all
39 } 40 }
40 41
41 } // namespace 42 } // namespace
42 43
43 // static 44 // static
44 std::unique_ptr<ScreenManager> ScreenManager::Create() { 45 std::unique_ptr<ScreenManager> ScreenManager::Create() {
45 return base::MakeUnique<ScreenManagerStubInternal>(); 46 return base::MakeUnique<ScreenManagerStubInternal>();
46 } 47 }
47 48
48 ScreenManagerStubInternal::ScreenManagerStubInternal() 49 ScreenManagerStubInternal::ScreenManagerStubInternal()
49 : weak_ptr_factory_(this) {} 50 : screen_(base::MakeUnique<display::ScreenBase>()),
51 weak_ptr_factory_(this) {}
50 52
51 ScreenManagerStubInternal::~ScreenManagerStubInternal() {} 53 ScreenManagerStubInternal::~ScreenManagerStubInternal() {}
52 54
53 void ScreenManagerStubInternal::FixedSizeScreenConfiguration() { 55 void ScreenManagerStubInternal::FixedSizeScreenConfiguration() {
54 ViewportMetrics metrics; 56 ViewportMetrics metrics;
55 metrics.bounds_in_pixels = gfx::Rect(kDisplayPixelSize); 57 metrics.bounds_in_pixels = gfx::Rect(kDisplayPixelSize);
56 metrics.device_scale_factor = display_.device_scale_factor(); 58 metrics.device_scale_factor = display_.device_scale_factor();
57 metrics.ui_scale_factor = 1.f; 59 metrics.ui_scale_factor = 1.f;
58 60
59 delegate_->OnDisplayAdded(display_, metrics); 61 delegate_->OnDisplayAdded(display_, metrics);
(...skipping 13 matching lines...) Expand all
73 } 75 }
74 76
75 void ScreenManagerStubInternal::RequestCloseDisplay(int64_t display_id) { 77 void ScreenManagerStubInternal::RequestCloseDisplay(int64_t display_id) {
76 if (display_id == display_.id()) { 78 if (display_id == display_.id()) {
77 base::ThreadTaskRunnerHandle::Get()->PostTask( 79 base::ThreadTaskRunnerHandle::Get()->PostTask(
78 FROM_HERE, base::Bind(&ScreenManagerDelegate::OnDisplayRemoved, 80 FROM_HERE, base::Bind(&ScreenManagerDelegate::OnDisplayRemoved,
79 base::Unretained(delegate_), display_id)); 81 base::Unretained(delegate_), display_id));
80 } 82 }
81 } 83 }
82 84
85 display::ScreenBase* ScreenManagerStubInternal::GetScreen() {
86 return screen_.get();
87 }
88
83 } // namespace display 89 } // namespace display
OLDNEW
« no previous file with comments | « services/ui/display/screen_manager_stub_internal.h ('k') | services/ui/public/interfaces/window_manager.mojom » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698