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

Side by Side Diff: ui/ozone/platform/headless/ozone_platform_headless.cc

Issue 1868363002: Replace scoped_ptr with std::unique_ptr in //ui (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@scopedptrcc
Patch Set: scopedptrui: rebase-make_scoped_ptr Created 4 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 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 "ui/base/cursor/ozone/bitmap_cursor_factory_ozone.h" 11 #include "ui/base/cursor/ozone/bitmap_cursor_factory_ozone.h"
11 #include "ui/events/ozone/layout/keyboard_layout_engine_manager.h" 12 #include "ui/events/ozone/layout/keyboard_layout_engine_manager.h"
12 #include "ui/events/ozone/layout/stub/stub_keyboard_layout_engine.h" 13 #include "ui/events/ozone/layout/stub/stub_keyboard_layout_engine.h"
13 #include "ui/events/platform/platform_event_source.h" 14 #include "ui/events/platform/platform_event_source.h"
14 #include "ui/ozone/common/native_display_delegate_ozone.h" 15 #include "ui/ozone/common/native_display_delegate_ozone.h"
15 #include "ui/ozone/common/stub_overlay_manager.h" 16 #include "ui/ozone/common/stub_overlay_manager.h"
16 #include "ui/ozone/platform/headless/headless_surface_factory.h" 17 #include "ui/ozone/platform/headless/headless_surface_factory.h"
17 #include "ui/ozone/platform/headless/headless_window.h" 18 #include "ui/ozone/platform/headless/headless_window.h"
18 #include "ui/ozone/platform/headless/headless_window_manager.h" 19 #include "ui/ozone/platform/headless/headless_window_manager.h"
19 #include "ui/ozone/public/cursor_factory_ozone.h" 20 #include "ui/ozone/public/cursor_factory_ozone.h"
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
59 } 60 }
60 InputController* GetInputController() override { 61 InputController* GetInputController() override {
61 return input_controller_.get(); 62 return input_controller_.get();
62 } 63 }
63 GpuPlatformSupport* GetGpuPlatformSupport() override { 64 GpuPlatformSupport* GetGpuPlatformSupport() override {
64 return gpu_platform_support_.get(); 65 return gpu_platform_support_.get();
65 } 66 }
66 GpuPlatformSupportHost* GetGpuPlatformSupportHost() override { 67 GpuPlatformSupportHost* GetGpuPlatformSupportHost() override {
67 return gpu_platform_support_host_.get(); 68 return gpu_platform_support_host_.get();
68 } 69 }
69 scoped_ptr<SystemInputInjector> CreateSystemInputInjector() override { 70 std::unique_ptr<SystemInputInjector> CreateSystemInputInjector() override {
70 return nullptr; // no input injection support. 71 return nullptr; // no input injection support.
71 } 72 }
72 scoped_ptr<PlatformWindow> CreatePlatformWindow( 73 std::unique_ptr<PlatformWindow> CreatePlatformWindow(
73 PlatformWindowDelegate* delegate, 74 PlatformWindowDelegate* delegate,
74 const gfx::Rect& bounds) override { 75 const gfx::Rect& bounds) override {
75 return make_scoped_ptr<PlatformWindow>( 76 return base::WrapUnique<PlatformWindow>(
76 new HeadlessWindow(delegate, window_manager_.get(), bounds)); 77 new HeadlessWindow(delegate, window_manager_.get(), bounds));
77 } 78 }
78 scoped_ptr<NativeDisplayDelegate> CreateNativeDisplayDelegate() override { 79 std::unique_ptr<NativeDisplayDelegate> CreateNativeDisplayDelegate()
79 return make_scoped_ptr(new NativeDisplayDelegateOzone()); 80 override {
81 return base::WrapUnique(new NativeDisplayDelegateOzone());
80 } 82 }
81 83
82 void InitializeUI() override { 84 void InitializeUI() override {
83 window_manager_.reset(new HeadlessWindowManager(file_path_)); 85 window_manager_.reset(new HeadlessWindowManager(file_path_));
84 window_manager_->Initialize(); 86 window_manager_->Initialize();
85 surface_factory_.reset(new HeadlessSurfaceFactory(window_manager_.get())); 87 surface_factory_.reset(new HeadlessSurfaceFactory(window_manager_.get()));
86 // This unbreaks tests that create their own. 88 // This unbreaks tests that create their own.
87 if (!PlatformEventSource::GetInstance()) 89 if (!PlatformEventSource::GetInstance())
88 platform_event_source_.reset(new HeadlessPlatformEventSource); 90 platform_event_source_.reset(new HeadlessPlatformEventSource);
89 KeyboardLayoutEngineManager::SetKeyboardLayoutEngine( 91 KeyboardLayoutEngineManager::SetKeyboardLayoutEngine(
90 make_scoped_ptr(new StubKeyboardLayoutEngine())); 92 base::WrapUnique(new StubKeyboardLayoutEngine()));
91 93
92 overlay_manager_.reset(new StubOverlayManager()); 94 overlay_manager_.reset(new StubOverlayManager());
93 input_controller_ = CreateStubInputController(); 95 input_controller_ = CreateStubInputController();
94 cursor_factory_ozone_.reset(new BitmapCursorFactoryOzone); 96 cursor_factory_ozone_.reset(new BitmapCursorFactoryOzone);
95 gpu_platform_support_host_.reset(CreateStubGpuPlatformSupportHost()); 97 gpu_platform_support_host_.reset(CreateStubGpuPlatformSupportHost());
96 } 98 }
97 99
98 void InitializeGPU() override { 100 void InitializeGPU() override {
99 if (!surface_factory_) 101 if (!surface_factory_)
100 surface_factory_.reset(new HeadlessSurfaceFactory()); 102 surface_factory_.reset(new HeadlessSurfaceFactory());
101 gpu_platform_support_.reset(CreateStubGpuPlatformSupport()); 103 gpu_platform_support_.reset(CreateStubGpuPlatformSupport());
102 } 104 }
103 105
104 private: 106 private:
105 scoped_ptr<HeadlessWindowManager> window_manager_; 107 std::unique_ptr<HeadlessWindowManager> window_manager_;
106 scoped_ptr<HeadlessSurfaceFactory> surface_factory_; 108 std::unique_ptr<HeadlessSurfaceFactory> surface_factory_;
107 scoped_ptr<PlatformEventSource> platform_event_source_; 109 std::unique_ptr<PlatformEventSource> platform_event_source_;
108 scoped_ptr<CursorFactoryOzone> cursor_factory_ozone_; 110 std::unique_ptr<CursorFactoryOzone> cursor_factory_ozone_;
109 scoped_ptr<InputController> input_controller_; 111 std::unique_ptr<InputController> input_controller_;
110 scoped_ptr<GpuPlatformSupport> gpu_platform_support_; 112 std::unique_ptr<GpuPlatformSupport> gpu_platform_support_;
111 scoped_ptr<GpuPlatformSupportHost> gpu_platform_support_host_; 113 std::unique_ptr<GpuPlatformSupportHost> gpu_platform_support_host_;
112 scoped_ptr<OverlayManagerOzone> overlay_manager_; 114 std::unique_ptr<OverlayManagerOzone> overlay_manager_;
113 base::FilePath file_path_; 115 base::FilePath file_path_;
114 116
115 DISALLOW_COPY_AND_ASSIGN(OzonePlatformHeadless); 117 DISALLOW_COPY_AND_ASSIGN(OzonePlatformHeadless);
116 }; 118 };
117 119
118 } // namespace 120 } // namespace
119 121
120 OzonePlatform* CreateOzonePlatformHeadless() { 122 OzonePlatform* CreateOzonePlatformHeadless() {
121 base::CommandLine* cmd = base::CommandLine::ForCurrentProcess(); 123 base::CommandLine* cmd = base::CommandLine::ForCurrentProcess();
122 base::FilePath location; 124 base::FilePath location;
123 if (cmd->HasSwitch(switches::kOzoneDumpFile)) 125 if (cmd->HasSwitch(switches::kOzoneDumpFile))
124 location = cmd->GetSwitchValuePath(switches::kOzoneDumpFile); 126 location = cmd->GetSwitchValuePath(switches::kOzoneDumpFile);
125 return new OzonePlatformHeadless(location); 127 return new OzonePlatformHeadless(location);
126 } 128 }
127 129
128 } // namespace ui 130 } // namespace ui
OLDNEW
« no previous file with comments | « ui/ozone/platform/headless/headless_window_manager.h ('k') | ui/ozone/platform/wayland/fake_server.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698