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

Unified 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: Simplified headless logic 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 side-by-side diff with in-line comments
Download patch
Index: components/view_manager/native_viewport/native_viewport.h
diff --git a/components/view_manager/native_viewport/native_viewport.h b/components/view_manager/native_viewport/native_viewport.h
new file mode 100644
index 0000000000000000000000000000000000000000..d0485858120e16e1b322fae3af4cf60f26618092
--- /dev/null
+++ b/components/view_manager/native_viewport/native_viewport.h
@@ -0,0 +1,80 @@
+// Copyright 2015 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 COMPONENTS_VIEW_MANAGER_NATIVE_VIEWPORT_NATIVE_VIEWPORT_H_
+#define COMPONENTS_VIEW_MANAGER_NATIVE_VIEWPORT_NATIVE_VIEWPORT_H_
+
+#include "base/callback.h"
+#include "base/memory/ref_counted.h"
+#include "components/view_manager/native_viewport/onscreen_context_provider.h"
+#include "components/view_manager/native_viewport/platform_viewport.h"
+#include "components/view_manager/public/interfaces/gpu.mojom.h"
+
+namespace gles2 {
+class GpuState;
+} // namespace gles2
+
+namespace gfx {
+class Size;
+} // namespace gfx
+
+namespace view_manager {
+
+class EventDispatcher;
+
+class NativeViewport : public native_viewport::PlatformViewport::Delegate {
+ public:
+ class Delegate {
+ public:
+ virtual ~Delegate() {}
sky 2015/06/05 23:25:50 nit: protected
Fady Samuel 2015/06/05 23:34:52 Native viewport wasn't doing much so I just got ri
+
+ virtual void OnMetricsChanged(const gfx::Size& size,
+ float device_scale_factor) {}
+ // TODO(fsamuel): I don't think this bool does anything event in
+ // PlatformViewport. We should just remove it.
+ virtual bool OnEvent(mojo::EventPtr event) = 0;
+ virtual void OnViewDestroyed() = 0;
+ };
+
+ using ViewDestroyedCallback = mojo::Callback<void()>;
+
+ NativeViewport(Delegate* delegate,
+ const gfx::Size& size,
+ bool is_headless,
+ const scoped_refptr<gles2::GpuState>& gpu_state);
+ ~NativeViewport() override;
+
+ void Show();
+
+ void Hide();
+
+ void Close();
+
+ void SetSize(const gfx::Size& size);
+
+ void GetContextProvider(
+ mojo::InterfaceRequest<mojo::ContextProvider> request);
+
+ // PlatformViewport::Delegate implementation.
+ void OnMetricsChanged(const gfx::Size& size,
+ float device_scale_factor) override;
+ void OnAcceleratedWidgetAvailable(gfx::AcceleratedWidget widget,
+ float device_pixel_ratio) override;
+ void OnAcceleratedWidgetDestroyed() override;
+ bool OnEvent(mojo::EventPtr event) override;
+ void OnDestroyed() override;
+
+ private:
+ Delegate* delegate_;
+
+ scoped_ptr<native_viewport::PlatformViewport> platform_viewport_;
+ scoped_ptr<native_viewport::OnscreenContextProvider> context_provider_;
+
+ gfx::Size size_;
+
+ DISALLOW_COPY_AND_ASSIGN(NativeViewport);
+};
+} // namespace view_manager
+
+#endif // COMPONENTS_VIEW_MANAGER_NATIVE_VIEWPORT_NATIVE_VIEWPORT_H_

Powered by Google App Engine
This is Rietveld 408576698