native_viewport_impl.h revision a3f6a49ab37290eeeb8db0f41ec0f1cb74a68be7
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 3// found in the LICENSE file. 4 5#ifndef MOJO_SERVICES_NATIVE_VIEWPORT_NATIVE_VIEWPORT_IMPL_H_ 6#define MOJO_SERVICES_NATIVE_VIEWPORT_NATIVE_VIEWPORT_IMPL_H_ 7 8#include <string> 9 10#include "mojo/public/bindings/lib/remote_ptr.h" 11#include "mojo/public/system/core_cpp.h" 12#include "mojo/services/native_viewport/native_viewport.h" 13#include "mojom/native_viewport.h" 14 15namespace gpu { 16class GLInProcessContext; 17} 18 19namespace mojo { 20namespace services { 21class GLES2Impl; 22 23class NativeViewportImpl : public NativeViewportStub, 24 public NativeViewportDelegate { 25 public: 26 NativeViewportImpl(shell::Context* context, 27 ScopedMessagePipeHandle pipe); 28 virtual ~NativeViewportImpl(); 29 30 // Overridden from NativeViewportStub: 31 virtual void Open() OVERRIDE; 32 virtual void Close() OVERRIDE; 33 virtual void CreateGLES2Context( 34 ScopedMessagePipeHandle gles2_client) OVERRIDE; 35 virtual void AckEvent(const Event& event) OVERRIDE; 36 37 private: 38 // Overridden from services::NativeViewportDelegate: 39 virtual void OnResized(const gfx::Size& size) OVERRIDE; 40 virtual void OnAcceleratedWidgetAvailable( 41 gfx::AcceleratedWidget widget) OVERRIDE; 42 virtual bool OnEvent(ui::Event* ui_event) OVERRIDE; 43 virtual void OnDestroyed() OVERRIDE; 44 45 void CreateGLES2ContextIfNeeded(); 46 47 shell::Context* context_; 48 gfx::AcceleratedWidget widget_; 49 scoped_ptr<services::NativeViewport> native_viewport_; 50 scoped_ptr<GLES2Impl> gles2_; 51 bool waiting_for_event_ack_; 52 int64 pending_event_timestamp_; 53 54 RemotePtr<NativeViewportClient> client_; 55 56 DISALLOW_COPY_AND_ASSIGN(NativeViewportImpl); 57}; 58 59} // namespace services 60} // namespace mojo 61 62#endif // MOJO_SERVICES_NATIVE_VIEWPORT_NATIVE_VIEWPORT_IMPL_H_ 63