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

Unified Diff: mojo/services/native_viewport/native_viewport_impl.h

Issue 1049993002: Get mojo_shell building inside chromium checkout. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fix presubmit Created 5 years, 9 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « mojo/services/native_viewport/main.cc ('k') | mojo/services/native_viewport/native_viewport_impl.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: mojo/services/native_viewport/native_viewport_impl.h
diff --git a/mojo/services/native_viewport/native_viewport_impl.h b/mojo/services/native_viewport/native_viewport_impl.h
new file mode 100644
index 0000000000000000000000000000000000000000..3c2344a4d4595eab9f5e502834a5ae436291a400
--- /dev/null
+++ b/mojo/services/native_viewport/native_viewport_impl.h
@@ -0,0 +1,90 @@
+// Copyright 2014 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef SERVICES_NATIVE_VIEWPORT_NATIVE_VIEWPORT_IMPL_H_
+#define SERVICES_NATIVE_VIEWPORT_NATIVE_VIEWPORT_IMPL_H_
+
+#include <set>
+
+#include "base/macros.h"
+#include "base/memory/weak_ptr.h"
+#include "mojo/public/cpp/bindings/strong_binding.h"
+#include "mojo/services/native_viewport/onscreen_context_provider.h"
+#include "mojo/services/native_viewport/platform_viewport.h"
+#include "third_party/mojo_services/src/gpu/public/interfaces/gpu.mojom.h"
+#include "third_party/mojo_services/src/native_viewport/public/interfaces/native_viewport.mojom.h"
+#include "ui/gfx/geometry/rect.h"
+
+namespace gles2 {
+class GpuState;
+}
+
+namespace ui {
+class Event;
+}
+
+namespace native_viewport {
+
+// A NativeViewportImpl is bound to a message pipe and to a PlatformViewport.
+// The NativeViewportImpl's lifetime ends when either the message pipe is closed
+// or the PlatformViewport informs the NativeViewportImpl that it has been
+// destroyed.
+class NativeViewportImpl : public mojo::NativeViewport,
+ public PlatformViewport::Delegate,
+ public mojo::ErrorHandler {
+ public:
+ NativeViewportImpl(bool is_headless,
+ const scoped_refptr<gles2::GpuState>& gpu_state,
+ mojo::InterfaceRequest<mojo::NativeViewport> request);
+ ~NativeViewportImpl() override;
+
+ // NativeViewport implementation.
+ void Create(mojo::SizePtr size, const CreateCallback& callback) override;
+ void RequestMetrics(const RequestMetricsCallback& callback) override;
+ void Show() override;
+ void Hide() override;
+ void Close() override;
+ void SetSize(mojo::SizePtr size) override;
+ void GetContextProvider(
+ mojo::InterfaceRequest<mojo::ContextProvider> request) override;
+ void SetEventDispatcher(
+ mojo::NativeViewportEventDispatcherPtr dispatcher) override;
+
+ // PlatformViewport::Delegate implementation.
+ void OnMetricsChanged(mojo::ViewportMetricsPtr metrics) override;
+ void OnAcceleratedWidgetAvailable(gfx::AcceleratedWidget widget) override;
+ void OnAcceleratedWidgetDestroyed() override;
+ bool OnEvent(mojo::EventPtr event) override;
+ void OnDestroyed() override;
+
+ // mojo::ErrorHandler implementation.
+ void OnConnectionError() override;
+
+ private:
+ // Callback when the dispatcher has processed a message we're waiting on
+ // an ack from. |pointer_id| identifies the pointer the message was associated
+ // with.
+ void AckEvent(int32 pointer_id);
+
+ bool is_headless_;
+ scoped_ptr<PlatformViewport> platform_viewport_;
+ OnscreenContextProvider context_provider_;
+ bool sent_metrics_;
+ mojo::ViewportMetricsPtr metrics_;
+ CreateCallback create_callback_;
+ RequestMetricsCallback metrics_callback_;
+ mojo::NativeViewportEventDispatcherPtr event_dispatcher_;
+ mojo::Binding<mojo::NativeViewport> binding_;
+
+ // Set of pointer_ids we've sent a move to and are waiting on an ack.
+ std::set<int32> pointers_waiting_on_ack_;
+
+ base::WeakPtrFactory<NativeViewportImpl> weak_factory_;
+
+ DISALLOW_COPY_AND_ASSIGN(NativeViewportImpl);
+};
+
+} // namespace native_viewport
+
+#endif // SERVICES_NATIVE_VIEWPORT_NATIVE_VIEWPORT_IMPL_H_
« no previous file with comments | « mojo/services/native_viewport/main.cc ('k') | mojo/services/native_viewport/native_viewport_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698