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_EXAMPLES_SAMPLE_APP_GLES2_CLIENT_IMPL_H_ 6#define MOJO_EXAMPLES_SAMPLE_APP_GLES2_CLIENT_IMPL_H_ 7 8#include "base/time/time.h" 9#include "base/timer/timer.h" 10#include "mojo/examples/sample_app/spinning_cube.h" 11#include "mojo/public/bindings/lib/remote_ptr.h" 12#include "mojom/gles2.h" 13#include "mojom/native_viewport.h" 14#include "ui/gfx/point_f.h" 15 16namespace mojo { 17namespace examples { 18 19class GLES2ClientImpl : public GLES2ClientStub { 20 public: 21 explicit GLES2ClientImpl(ScopedMessagePipeHandle pipe); 22 virtual ~GLES2ClientImpl(); 23 24 void HandleInputEvent(const Event& event); 25 26 private: 27 virtual void DidCreateContext(uint64_t encoded, 28 uint32_t width, 29 uint32_t height) MOJO_OVERRIDE; 30 virtual void ContextLost() MOJO_OVERRIDE; 31 32 void Draw(); 33 void StartTimer(); 34 35 base::Time last_time_; 36 base::RepeatingTimer<GLES2ClientImpl> timer_; 37 SpinningCube cube_; 38 gfx::PointF capture_point_; 39 gfx::PointF last_drag_point_; 40 base::Time drag_start_time_; 41 42 RemotePtr<GLES2> service_; 43 44 MOJO_DISALLOW_COPY_AND_ASSIGN(GLES2ClientImpl); 45}; 46 47} // namespace examples 48} // namespace mojo 49 50#endif // MOJO_EXAMPLES_SAMPLE_APP_GLES2_CLIENT_IMPL_H_ 51