OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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/ozone/platform/headless/ozone_platform_headless.h" | 5 #include "ui/ozone/platform/headless/ozone_platform_headless.h" |
6 | 6 |
7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
8 #include "base/files/file_path.h" | 8 #include "base/files/file_path.h" |
9 #include "base/macros.h" | 9 #include "base/macros.h" |
10 #include "base/memory/ptr_util.h" | 10 #include "base/memory/ptr_util.h" |
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
71 return nullptr; // no input injection support. | 71 return nullptr; // no input injection support. |
72 } | 72 } |
73 std::unique_ptr<PlatformWindow> CreatePlatformWindow( | 73 std::unique_ptr<PlatformWindow> CreatePlatformWindow( |
74 PlatformWindowDelegate* delegate, | 74 PlatformWindowDelegate* delegate, |
75 const gfx::Rect& bounds) override { | 75 const gfx::Rect& bounds) override { |
76 return base::WrapUnique<PlatformWindow>( | 76 return base::WrapUnique<PlatformWindow>( |
77 new HeadlessWindow(delegate, window_manager_.get(), bounds)); | 77 new HeadlessWindow(delegate, window_manager_.get(), bounds)); |
78 } | 78 } |
79 std::unique_ptr<NativeDisplayDelegate> CreateNativeDisplayDelegate() | 79 std::unique_ptr<NativeDisplayDelegate> CreateNativeDisplayDelegate() |
80 override { | 80 override { |
81 return base::WrapUnique(new NativeDisplayDelegateOzone()); | 81 return base::MakeUnique<NativeDisplayDelegateOzone>(); |
82 } | 82 } |
83 | 83 |
84 void InitializeUI() override { | 84 void InitializeUI() override { |
85 window_manager_.reset(new HeadlessWindowManager(file_path_)); | 85 window_manager_.reset(new HeadlessWindowManager(file_path_)); |
86 window_manager_->Initialize(); | 86 window_manager_->Initialize(); |
87 surface_factory_.reset(new HeadlessSurfaceFactory(window_manager_.get())); | 87 surface_factory_.reset(new HeadlessSurfaceFactory(window_manager_.get())); |
88 // This unbreaks tests that create their own. | 88 // This unbreaks tests that create their own. |
89 if (!PlatformEventSource::GetInstance()) | 89 if (!PlatformEventSource::GetInstance()) |
90 platform_event_source_.reset(new HeadlessPlatformEventSource); | 90 platform_event_source_.reset(new HeadlessPlatformEventSource); |
91 KeyboardLayoutEngineManager::SetKeyboardLayoutEngine( | 91 KeyboardLayoutEngineManager::SetKeyboardLayoutEngine( |
92 base::WrapUnique(new StubKeyboardLayoutEngine())); | 92 base::MakeUnique<StubKeyboardLayoutEngine>()); |
93 | 93 |
94 overlay_manager_.reset(new StubOverlayManager()); | 94 overlay_manager_.reset(new StubOverlayManager()); |
95 input_controller_ = CreateStubInputController(); | 95 input_controller_ = CreateStubInputController(); |
96 cursor_factory_ozone_.reset(new BitmapCursorFactoryOzone); | 96 cursor_factory_ozone_.reset(new BitmapCursorFactoryOzone); |
97 gpu_platform_support_host_.reset(CreateStubGpuPlatformSupportHost()); | 97 gpu_platform_support_host_.reset(CreateStubGpuPlatformSupportHost()); |
98 } | 98 } |
99 | 99 |
100 void InitializeGPU() override { | 100 void InitializeGPU() override { |
101 if (!surface_factory_) | 101 if (!surface_factory_) |
102 surface_factory_.reset(new HeadlessSurfaceFactory()); | 102 surface_factory_.reset(new HeadlessSurfaceFactory()); |
(...skipping 18 matching lines...) Expand all Loading... |
121 | 121 |
122 OzonePlatform* CreateOzonePlatformHeadless() { | 122 OzonePlatform* CreateOzonePlatformHeadless() { |
123 base::CommandLine* cmd = base::CommandLine::ForCurrentProcess(); | 123 base::CommandLine* cmd = base::CommandLine::ForCurrentProcess(); |
124 base::FilePath location; | 124 base::FilePath location; |
125 if (cmd->HasSwitch(switches::kOzoneDumpFile)) | 125 if (cmd->HasSwitch(switches::kOzoneDumpFile)) |
126 location = cmd->GetSwitchValuePath(switches::kOzoneDumpFile); | 126 location = cmd->GetSwitchValuePath(switches::kOzoneDumpFile); |
127 return new OzonePlatformHeadless(location); | 127 return new OzonePlatformHeadless(location); |
128 } | 128 } |
129 | 129 |
130 } // namespace ui | 130 } // namespace ui |
OLD | NEW |