Adds UMA histograms for WebRTC.DataChannelMaxRetransmits WebRTC.DataChannelMaxRetrans...
[chromium-blink-merge.git] / mojo / services / native_viewport / native_viewport_android.h
blobc24e38e7858a0d54e4f7d6d8280ed2ff6706666d
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.
5 #ifndef MOJO_SERVICES_NATIVE_VIEWPORT_NATIVE_VIEWPORT_ANDROID_H_
6 #define MOJO_SERVICES_NATIVE_VIEWPORT_NATIVE_VIEWPORT_ANDROID_H_
8 #include "base/android/jni_weak_ref.h"
9 #include "base/android/scoped_java_ref.h"
10 #include "base/memory/weak_ptr.h"
11 #include "mojo/services/native_viewport/native_viewport.h"
12 #include "mojo/services/native_viewport/native_viewport_export.h"
13 #include "ui/events/event_constants.h"
14 #include "ui/gfx/rect.h"
15 #include "ui/gfx/sequential_id_generator.h"
16 #include "ui/gfx/size.h"
18 namespace gpu {
19 class GLInProcessContext;
22 struct ANativeWindow;
24 namespace mojo {
25 namespace services {
27 class MOJO_NATIVE_VIEWPORT_EXPORT NativeViewportAndroid
28 : public NativeViewport {
29 public:
30 static MOJO_NATIVE_VIEWPORT_EXPORT bool Register(JNIEnv* env);
32 explicit NativeViewportAndroid(shell::Context* context,
33 NativeViewportDelegate* delegate);
34 virtual ~NativeViewportAndroid();
36 void Destroy(JNIEnv* env, jobject obj);
37 void SurfaceCreated(JNIEnv* env, jobject obj, jobject jsurface);
38 void SurfaceDestroyed(JNIEnv* env, jobject obj);
39 void SurfaceSetSize(JNIEnv* env, jobject obj, jint width, jint height);
40 bool TouchEvent(JNIEnv* env, jobject obj, jint pointer_id, jint action,
41 jfloat x, jfloat y, jlong time_ms);
43 private:
44 // Overridden from NativeViewport:
45 virtual void Init(const gfx::Rect& bounds) OVERRIDE;
46 virtual void Show() OVERRIDE;
47 virtual void Hide() OVERRIDE;
48 virtual void Close() OVERRIDE;
49 virtual gfx::Size GetSize() OVERRIDE;
50 virtual void SetBounds(const gfx::Rect& bounds) OVERRIDE;
51 virtual void SetCapture() OVERRIDE;
52 virtual void ReleaseCapture() OVERRIDE;
54 void ReleaseWindow();
56 NativeViewportDelegate* delegate_;
57 shell::Context* context_;
58 ANativeWindow* window_;
59 gfx::Rect bounds_;
60 ui::SequentialIDGenerator id_generator_;
62 base::WeakPtrFactory<NativeViewportAndroid> weak_factory_;
64 DISALLOW_COPY_AND_ASSIGN(NativeViewportAndroid);
68 } // namespace services
69 } // namespace mojo
71 #endif // MOJO_SERVICES_NATIVE_VIEWPORT_NATIVE_VIEWPORT_ANDROID_H_