Pin Chrome's shortcut to the Win10 Start menu on install and OS upgrade.
[chromium-blink-merge.git] / ui / platform_window / android / platform_window_android.h
blob0e330682be5685627b6dffb0fa1e801409f584b0
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 UI_PLATFORM_WINDOW_ANDROID_PLATFORM_WINDOW_ANDROID_H_
6 #define UI_PLATFORM_WINDOW_ANDROID_PLATFORM_WINDOW_ANDROID_H_
8 #include "base/android/jni_weak_ref.h"
9 #include "base/macros.h"
10 #include "base/memory/weak_ptr.h"
11 #include "ui/events/event_constants.h"
12 #include "ui/gfx/geometry/rect.h"
13 #include "ui/gfx/geometry/size.h"
14 #include "ui/gfx/sequential_id_generator.h"
15 #include "ui/platform_window/platform_window.h"
17 struct ANativeWindow;
19 namespace ui {
21 class PlatformWindowAndroid : public PlatformWindow {
22 public:
23 static bool Register(JNIEnv* env);
25 explicit PlatformWindowAndroid(PlatformWindowDelegate* delegate);
26 ~PlatformWindowAndroid() override;
28 void Destroy(JNIEnv* env, jobject obj);
29 void SurfaceCreated(JNIEnv* env,
30 jobject obj,
31 jobject jsurface,
32 float device_pixel_ratio);
33 void SurfaceDestroyed(JNIEnv* env, jobject obj);
34 void SurfaceSetSize(JNIEnv* env,
35 jobject obj,
36 jint width,
37 jint height,
38 jfloat density);
39 bool TouchEvent(JNIEnv* env,
40 jobject obj,
41 jlong time_ms,
42 jint masked_action,
43 jint pointer_id,
44 jfloat x,
45 jfloat y,
46 jfloat pressure,
47 jfloat touch_major,
48 jfloat touch_minor,
49 jfloat orientation,
50 jfloat h_wheel,
51 jfloat v_wheel);
52 bool KeyEvent(JNIEnv* env,
53 jobject obj,
54 bool pressed,
55 jint key_code,
56 jint unicode_character);
57 private:
58 void ReleaseWindow();
60 // Overridden from PlatformWindow:
61 void Show() override;
62 void Hide() override;
63 void Close() override;
64 void SetBounds(const gfx::Rect& bounds) override;
65 gfx::Rect GetBounds() override;
66 void SetCapture() override;
67 void ReleaseCapture() override;
68 void ToggleFullscreen() override;
69 void Maximize() override;
70 void Minimize() override;
71 void Restore() override;
72 void SetCursor(PlatformCursor cursor) override;
73 void MoveCursorTo(const gfx::Point& location) override;
74 void ConfineCursorToBounds(const gfx::Rect& bounds) override;
76 PlatformWindowDelegate* delegate_;
78 JavaObjectWeakGlobalRef java_platform_window_android_;
79 ANativeWindow* window_;
80 ui::SequentialIDGenerator id_generator_;
82 gfx::Size size_; // Origin is always (0,0)
84 base::WeakPtrFactory<PlatformWindowAndroid> weak_factory_;
86 DISALLOW_COPY_AND_ASSIGN(PlatformWindowAndroid);
89 } // namespace ui
91 #endif // UI_PLATFORM_WINDOW_ANDROID_PLATFORM_WINDOW_ANDROID_H_