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

Side by Side Diff: services/ui/ws/platform_display_default.h

Issue 2507943002: Move PlatformDisplayDefault into it's own file. (Closed)
Patch Set: Created 4 years, 1 month 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
« no previous file with comments | « services/ui/ws/platform_display.cc ('k') | services/ui/ws/platform_display_default.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 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 #ifndef SERVICES_UI_WS_PLATFORM_DISPLAY_H_ 5 #ifndef SERVICES_UI_WS_PLATFORM_DISPLAY_DEFAULT_H_
6 #define SERVICES_UI_WS_PLATFORM_DISPLAY_H_ 6 #define SERVICES_UI_WS_PLATFORM_DISPLAY_DEFAULT_H_
7
8 #include <stdint.h>
9 7
10 #include <memory> 8 #include <memory>
11 9
12 #include "base/macros.h" 10 #include "base/macros.h"
13 #include "base/memory/weak_ptr.h"
14 #include "base/strings/string16.h"
15 #include "build/build_config.h"
16 #include "services/ui/display/viewport_metrics.h" 11 #include "services/ui/display/viewport_metrics.h"
17 #include "services/ui/public/interfaces/cursor.mojom.h"
18 #include "services/ui/public/interfaces/window_manager.mojom.h"
19 #include "services/ui/public/interfaces/window_manager_constants.mojom.h"
20 #include "services/ui/public/interfaces/window_tree.mojom.h"
21 #include "services/ui/ws/frame_generator.h" 12 #include "services/ui/ws/frame_generator.h"
22 #include "services/ui/ws/frame_generator_delegate.h" 13 #include "services/ui/ws/frame_generator_delegate.h"
14 #include "services/ui/ws/platform_display.h"
23 #include "services/ui/ws/platform_display_delegate.h" 15 #include "services/ui/ws/platform_display_delegate.h"
24 #include "ui/display/display.h" 16 #include "ui/platform_window/platform_window.h"
msw 2016/11/16 22:52:08 optional nit: restore fwd decl and move include to
kylechar 2016/11/17 14:00:05 Done.
25 #include "ui/platform_window/platform_window_delegate.h" 17 #include "ui/platform_window/platform_window_delegate.h"
26 18
27 namespace gfx {
28 class Rect;
29 }
30
31 namespace gpu {
32 class GpuChannelHost;
33 }
34
35 namespace ui { 19 namespace ui {
36 20
37 class CursorLoader; 21 class CursorLoader;
38 class PlatformWindow;
39 struct TextInputState;
40 22
41 namespace ws { 23 namespace ws {
42 24
43 class PlatformDisplayFactory; 25 // PlatformDisplay implementation that connects to a PlatformWindow for CrOS
msw 2016/11/16 22:52:08 nit: trailing period
kylechar 2016/11/17 14:00:05 Done.
44 struct PlatformDisplayInitParams; 26 class PlatformDisplayDefault : public PlatformDisplay,
45 class ServerWindow;
46
47 // PlatformDisplay is used to connect the root ServerWindow to a display.
48 class PlatformDisplay {
49 public:
50 virtual ~PlatformDisplay() {}
51
52 static std::unique_ptr<PlatformDisplay> Create(
53 const PlatformDisplayInitParams& init_params);
54
55 virtual int64_t GetId() const = 0;
56
57 virtual void Init(PlatformDisplayDelegate* delegate) = 0;
58
59 virtual void SetViewportSize(const gfx::Size& size) = 0;
60
61 virtual void SetTitle(const base::string16& title) = 0;
62
63 virtual void SetCapture() = 0;
64
65 virtual void ReleaseCapture() = 0;
66
67 virtual void SetCursorById(mojom::Cursor cursor) = 0;
68
69 virtual void UpdateTextInputState(const ui::TextInputState& state) = 0;
70 virtual void SetImeVisibility(bool visible) = 0;
71
72 virtual gfx::Rect GetBounds() const = 0;
73
74 // Updates the viewport metrics for the display, returning true if any
75 // metrics have changed.
76 virtual bool UpdateViewportMetrics(
77 const display::ViewportMetrics& metrics) = 0;
78
79 virtual const display::ViewportMetrics& GetViewportMetrics() const = 0;
80
81 virtual bool IsPrimaryDisplay() const = 0;
82
83 // Notifies the PlatformDisplay that a connection to the gpu has been
84 // established.
85 virtual void OnGpuChannelEstablished(
86 scoped_refptr<gpu::GpuChannelHost> gpu_channel) = 0;
87
88 // Overrides factory for testing. Default (NULL) value indicates regular
89 // (non-test) environment.
90 static void set_factory_for_testing(PlatformDisplayFactory* factory) {
91 PlatformDisplay::factory_ = factory;
92 }
93
94 private:
95 // Static factory instance (always NULL for non-test).
96 static PlatformDisplayFactory* factory_;
97 };
98
99 // PlatformDisplay implementation that connects to the services necessary to
100 // actually display.
101 class DefaultPlatformDisplay : public PlatformDisplay,
102 public ui::PlatformWindowDelegate, 27 public ui::PlatformWindowDelegate,
103 private FrameGeneratorDelegate { 28 private FrameGeneratorDelegate {
104 public: 29 public:
105 explicit DefaultPlatformDisplay(const PlatformDisplayInitParams& init_params); 30 explicit PlatformDisplayDefault(const PlatformDisplayInitParams& init_params);
106 ~DefaultPlatformDisplay() override; 31 ~PlatformDisplayDefault() override;
107 32
108 // PlatformDisplay: 33 // PlatformDisplay:
109 void Init(PlatformDisplayDelegate* delegate) override; 34 void Init(PlatformDisplayDelegate* delegate) override;
110 int64_t GetId() const override; 35 int64_t GetId() const override;
111 void SetViewportSize(const gfx::Size& size) override; 36 void SetViewportSize(const gfx::Size& size) override;
112 void SetTitle(const base::string16& title) override; 37 void SetTitle(const base::string16& title) override;
113 void SetCapture() override; 38 void SetCapture() override;
114 void ReleaseCapture() override; 39 void ReleaseCapture() override;
115 void SetCursorById(mojom::Cursor cursor) override; 40 void SetCursorById(mojom::Cursor cursor) override;
116 void UpdateTextInputState(const ui::TextInputState& state) override; 41 void UpdateTextInputState(const ui::TextInputState& state) override;
(...skipping 21 matching lines...) Expand all
138 void OnWindowStateChanged(ui::PlatformWindowState new_state) override; 63 void OnWindowStateChanged(ui::PlatformWindowState new_state) override;
139 void OnLostCapture() override; 64 void OnLostCapture() override;
140 void OnAcceleratedWidgetAvailable(gfx::AcceleratedWidget widget, 65 void OnAcceleratedWidgetAvailable(gfx::AcceleratedWidget widget,
141 float device_scale_factor) override; 66 float device_scale_factor) override;
142 void OnAcceleratedWidgetDestroyed() override; 67 void OnAcceleratedWidgetDestroyed() override;
143 void OnActivationChanged(bool active) override; 68 void OnActivationChanged(bool active) override;
144 69
145 // FrameGeneratorDelegate: 70 // FrameGeneratorDelegate:
146 bool IsInHighContrastMode() override; 71 bool IsInHighContrastMode() override;
147 72
148 int64_t id_; 73 int64_t display_id_;
149 74
150 #if !defined(OS_ANDROID) 75 #if !defined(OS_ANDROID)
151 std::unique_ptr<ui::CursorLoader> cursor_loader_; 76 std::unique_ptr<ui::CursorLoader> cursor_loader_;
152 #endif 77 #endif
153 78
154 PlatformDisplayDelegate* delegate_ = nullptr; 79 PlatformDisplayDelegate* delegate_ = nullptr;
155 std::unique_ptr<FrameGenerator> frame_generator_; 80 std::unique_ptr<FrameGenerator> frame_generator_;
156 81
157 display::ViewportMetrics metrics_; 82 display::ViewportMetrics metrics_;
158 std::unique_ptr<ui::PlatformWindow> platform_window_; 83 std::unique_ptr<ui::PlatformWindow> platform_window_;
159 84
160 DISALLOW_COPY_AND_ASSIGN(DefaultPlatformDisplay); 85 DISALLOW_COPY_AND_ASSIGN(PlatformDisplayDefault);
161 }; 86 };
162 87
163 } // namespace ws 88 } // namespace ws
164
165 } // namespace ui 89 } // namespace ui
166 90 #endif // SERVICES_UI_WS_PLATFORM_DISPLAY_DEFAULT_H_
msw 2016/11/16 22:52:08 nit: blank line above
kylechar 2016/11/17 14:00:05 Done.
167 #endif // SERVICES_UI_WS_PLATFORM_DISPLAY_H_
OLDNEW
« no previous file with comments | « services/ui/ws/platform_display.cc ('k') | services/ui/ws/platform_display_default.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698