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

Side by Side Diff: components/view_manager/native_viewport/native_viewport.h

Issue 1149083010: Mandoline: Remove native_viewport.mojom (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: More cleanup Created 5 years, 6 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
(Empty)
1 // Copyright 2015 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #ifndef COMPONENTS_VIEW_MANAGER_NATIVE_VIEWPORT_NATIVE_VIEWPORT_H_
6 #define COMPONENTS_VIEW_MANAGER_NATIVE_VIEWPORT_NATIVE_VIEWPORT_H_
7
8 #include "base/callback.h"
9 #include "base/memory/ref_counted.h"
10 #include "base/memory/weak_ptr.h"
11 #include "components/view_manager/native_viewport/onscreen_context_provider.h"
12 #include "components/view_manager/native_viewport/platform_viewport.h"
13 #include "components/view_manager/public/interfaces/gpu.mojom.h"
14
15 namespace gles2 {
16 class GpuState;
17 } // namespace gles2
18
19 namespace gfx {
20 class Size;
21 } // namespace gfx
22
23 namespace view_manager {
24
25 class EventDispatcher;
26
27 class NativeViewport : public native_viewport::PlatformViewport::Delegate {
28 public:
29 using ViewDestroyedCallback = mojo::Callback<void()>;
30
31 NativeViewport(const gfx::Size& size,
32 bool is_headless,
33 const scoped_refptr<gles2::GpuState>& gpu_state,
34 EventDispatcher* event_dispatcher,
sky 2015/06/04 22:37:58 I would prefer there to still be an interface and
Fady Samuel 2015/06/05 22:14:31 Done.
35 const ViewDestroyedCallback& view_destroyed_callback);
36 ~NativeViewport() override;
37
38 using RequestMetricsCallback = mojo::Callback<void (const gfx::Size&, float)>;
39 void RequestMetrics(const RequestMetricsCallback& callback);
40
41 void Show();
42
43 void Hide();
44
45 void Close();
46
47 void SetSize(const gfx::Size& size);
48
49 void GetContextProvider(
50 mojo::InterfaceRequest<mojo::ContextProvider> request);
51
52 // PlatformViewport::Delegate implementation.
53 void OnMetricsChanged(const gfx::Size& size,
54 float device_scale_factor) override;
55 void OnAcceleratedWidgetAvailable(gfx::AcceleratedWidget widget,
56 float device_pixel_ratio) override;
57 void OnAcceleratedWidgetDestroyed() override;
58 bool OnEvent(mojo::EventPtr event) override;
59 void OnDestroyed() override;
60
61 private:
62 // Callback when the dispatcher has processed a message we're waiting on
63 // an ack from. |pointer_id| identifies the pointer the message was associated
64 // with.
65 void AckEvent(int32 pointer_id);
66
67 scoped_ptr<native_viewport::PlatformViewport> platform_viewport_;
68 scoped_ptr<native_viewport::OnscreenContextProvider> context_provider_;
69
70 // Metrics members.
71 gfx::Size size_;
72 float device_scale_factor_;
73 bool metrics_ready_;
74 RequestMetricsCallback metrics_callback_;
75
76 EventDispatcher* event_dispatcher_;
77
78 ViewDestroyedCallback view_destroyed_callback_;
79
80 // Set of pointer_ids we've sent a move to and are waiting on an ack.
81 std::set<int32> pointers_waiting_on_ack_;
82
83 base::WeakPtrFactory<NativeViewport> weak_factory_;
84
85 DISALLOW_COPY_AND_ASSIGN(NativeViewport);
86 };
87 } // namespace view_manager
88
89 #endif // COMPONENTS_VIEW_MANAGER_NATIVE_VIEWPORT_NATIVE_VIEWPORT_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698