Supervised user whitelists: Cleanup
[chromium-blink-merge.git] / ui / android / window_android.h
blob005f4d67cc1d2a829fafcbeb16633b92e2b90782
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_ANDROID_WINDOW_ANDROID_H_
6 #define UI_ANDROID_WINDOW_ANDROID_H_
8 #include <jni.h>
9 #include <vector>
11 #include "base/android/jni_weak_ref.h"
12 #include "base/android/scoped_java_ref.h"
13 #include "base/observer_list.h"
14 #include "base/time/time.h"
15 #include "ui/android/ui_android_export.h"
16 #include "ui/gfx/geometry/vector2d_f.h"
18 namespace ui {
20 class WindowAndroidCompositor;
21 class WindowAndroidObserver;
23 // Android implementation of the activity window.
24 class UI_ANDROID_EXPORT WindowAndroid {
25 public:
26 WindowAndroid(JNIEnv* env, jobject obj);
28 void Destroy(JNIEnv* env, jobject obj);
30 base::android::ScopedJavaLocalRef<jobject> GetJavaObject();
32 static bool RegisterWindowAndroid(JNIEnv* env);
34 // The content offset is used to translate snapshots to the correct part of
35 // the window.
36 void set_content_offset(const gfx::Vector2dF& content_offset) {
37 content_offset_ = content_offset;
40 gfx::Vector2dF content_offset() const {
41 return content_offset_;
44 // Compositor callback relay.
45 void OnCompositingDidCommit();
46 void OnVisibilityChanged(bool visible);
48 void AttachCompositor(WindowAndroidCompositor* compositor);
49 void DetachCompositor();
51 void AddObserver(WindowAndroidObserver* observer);
52 void RemoveObserver(WindowAndroidObserver* observer);
54 WindowAndroidCompositor* GetCompositor() { return compositor_; }
56 void RequestVSyncUpdate();
57 void SetNeedsAnimate();
58 void OnVSync(JNIEnv* env,
59 jobject obj,
60 jlong time_micros,
61 jlong period_micros);
62 void Animate(base::TimeTicks begin_frame_time);
63 void OnActivityPaused(JNIEnv* env, jobject obj);
64 void OnActivityResumed(JNIEnv* env, jobject obj);
66 private:
67 ~WindowAndroid();
69 base::android::ScopedJavaGlobalRef<jobject> java_window_;
70 gfx::Vector2dF content_offset_;
71 WindowAndroidCompositor* compositor_;
73 ObserverList<WindowAndroidObserver> observer_list_;
75 DISALLOW_COPY_AND_ASSIGN(WindowAndroid);
78 } // namespace ui
80 #endif // UI_ANDROID_WINDOW_ANDROID_H_