Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef UI_BASE_ANDROID_WINDOW_ANDROID_H_ | 5 #ifndef UI_BASE_ANDROID_WINDOW_ANDROID_H_ |
| 6 #define UI_BASE_ANDROID_WINDOW_ANDROID_H_ | 6 #define UI_BASE_ANDROID_WINDOW_ANDROID_H_ |
| 7 | 7 |
| 8 #include <jni.h> | 8 #include <jni.h> |
| 9 #include <vector> | 9 #include <vector> |
| 10 #include "base/android/jni_helper.h" | 10 #include "base/android/jni_helper.h" |
| 11 #include "base/android/scoped_java_ref.h" | 11 #include "base/android/scoped_java_ref.h" |
| 12 #include "base/observer_list.h" | |
| 12 #include "ui/base/ui_export.h" | 13 #include "ui/base/ui_export.h" |
| 13 #include "ui/gfx/vector2d_f.h" | 14 #include "ui/gfx/vector2d_f.h" |
| 14 | 15 |
| 16 namespace content { | |
| 17 class Compositor; | |
|
no sievers
2013/11/15 20:15:20
remove this
powei
2013/11/15 22:41:28
Done.
| |
| 18 } // namespace content | |
| 19 | |
| 15 namespace ui { | 20 namespace ui { |
| 16 | 21 |
| 22 class WindowAndroidObserver; | |
| 23 | |
| 17 // Android implementation of the activity window. | 24 // Android implementation of the activity window. |
| 18 class UI_EXPORT WindowAndroid { | 25 class UI_EXPORT WindowAndroid { |
| 19 public: | 26 public: |
| 20 WindowAndroid(JNIEnv* env, jobject obj); | 27 WindowAndroid(JNIEnv* env, jobject obj); |
| 21 | 28 |
| 22 void Destroy(JNIEnv* env, jobject obj); | 29 void Destroy(JNIEnv* env, jobject obj); |
| 23 | 30 |
| 24 base::android::ScopedJavaLocalRef<jobject> GetJavaObject(); | 31 base::android::ScopedJavaLocalRef<jobject> GetJavaObject(); |
| 25 | 32 |
| 26 static bool RegisterWindowAndroid(JNIEnv* env); | 33 static bool RegisterWindowAndroid(JNIEnv* env); |
| 27 | 34 |
| 28 // The content offset is used to translate snapshots to the correct part of | 35 // The content offset is used to translate snapshots to the correct part of |
| 29 // the window. | 36 // the window. |
| 30 void set_content_offset(const gfx::Vector2dF& content_offset) { | 37 void set_content_offset(const gfx::Vector2dF& content_offset) { |
| 31 content_offset_ = content_offset; | 38 content_offset_ = content_offset; |
| 32 } | 39 } |
| 33 | 40 |
| 34 bool GrabSnapshot(int content_x, int content_y, int width, int height, | 41 bool GrabSnapshot(int content_x, int content_y, int width, int height, |
| 35 std::vector<unsigned char>* png_representation); | 42 std::vector<unsigned char>* png_representation); |
| 36 | 43 |
| 44 // Compositor callback relay. | |
| 45 void OnCompositingDidCommit(); | |
| 46 | |
| 47 void AddObserver(WindowAndroidObserver* observer); | |
| 48 void RemoveObserver(WindowAndroidObserver* observer); | |
| 49 | |
| 37 private: | 50 private: |
| 38 ~WindowAndroid(); | 51 ~WindowAndroid(); |
| 39 | 52 |
| 40 JavaObjectWeakGlobalRef weak_java_window_; | 53 JavaObjectWeakGlobalRef weak_java_window_; |
| 41 gfx::Vector2dF content_offset_; | 54 gfx::Vector2dF content_offset_; |
| 42 | 55 |
| 56 ObserverList<WindowAndroidObserver> observer_list_; | |
| 57 | |
| 43 DISALLOW_COPY_AND_ASSIGN(WindowAndroid); | 58 DISALLOW_COPY_AND_ASSIGN(WindowAndroid); |
| 44 }; | 59 }; |
| 45 | 60 |
| 46 } // namespace ui | 61 } // namespace ui |
| 47 | 62 |
| 48 #endif // UI_BASE_ANDROID_WINDOW_ANDROID_H_ | 63 #endif // UI_BASE_ANDROID_WINDOW_ANDROID_H_ |
| OLD | NEW |