| 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 "base/observer_list.h" |
| 13 #include "ui/base/ui_export.h" | 13 #include "ui/base/ui_export.h" |
| 14 #include "ui/gfx/vector2d_f.h" | 14 #include "ui/gfx/vector2d_f.h" |
| 15 | 15 |
| 16 namespace content { |
| 17 class Compositor; |
| 18 } |
| 19 |
| 16 namespace ui { | 20 namespace ui { |
| 17 | 21 |
| 18 class WindowAndroidObserver; | 22 class WindowAndroidObserver; |
| 19 | 23 |
| 20 // Android implementation of the activity window. | 24 // Android implementation of the activity window. |
| 21 class UI_EXPORT WindowAndroid { | 25 class UI_EXPORT WindowAndroid { |
| 22 public: | 26 public: |
| 23 WindowAndroid(JNIEnv* env, jobject obj); | 27 WindowAndroid(JNIEnv* env, jobject obj); |
| 24 | 28 |
| 25 void Destroy(JNIEnv* env, jobject obj); | 29 void Destroy(JNIEnv* env, jobject obj); |
| 26 | 30 |
| 27 base::android::ScopedJavaLocalRef<jobject> GetJavaObject(); | 31 base::android::ScopedJavaLocalRef<jobject> GetJavaObject(); |
| 28 | 32 |
| 29 static bool RegisterWindowAndroid(JNIEnv* env); | 33 static bool RegisterWindowAndroid(JNIEnv* env); |
| 30 | 34 |
| 31 // 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 |
| 32 // the window. | 36 // the window. |
| 33 void set_content_offset(const gfx::Vector2dF& content_offset) { | 37 void set_content_offset(const gfx::Vector2dF& content_offset) { |
| 34 content_offset_ = content_offset; | 38 content_offset_ = content_offset; |
| 35 } | 39 } |
| 36 | 40 |
| 37 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, |
| 38 std::vector<unsigned char>* png_representation); | 42 std::vector<unsigned char>* png_representation); |
| 39 | 43 |
| 40 // Compositor callback relay. | 44 // Compositor callback relay. |
| 41 void OnCompositingDidCommit(); | 45 void OnCompositingDidCommit(content::Compositor* compositor); |
| 42 | 46 |
| 43 void AttachCompositor(); | 47 void AttachCompositor(); |
| 44 void DetachCompositor(); | 48 void DetachCompositor(); |
| 45 | 49 |
| 46 void AddObserver(WindowAndroidObserver* observer); | 50 void AddObserver(WindowAndroidObserver* observer); |
| 47 void RemoveObserver(WindowAndroidObserver* observer); | 51 void RemoveObserver(WindowAndroidObserver* observer); |
| 48 | 52 |
| 49 private: | 53 private: |
| 50 ~WindowAndroid(); | 54 ~WindowAndroid(); |
| 51 | 55 |
| 52 JavaObjectWeakGlobalRef weak_java_window_; | 56 JavaObjectWeakGlobalRef weak_java_window_; |
| 53 gfx::Vector2dF content_offset_; | 57 gfx::Vector2dF content_offset_; |
| 54 | 58 |
| 55 ObserverList<WindowAndroidObserver> observer_list_; | 59 ObserverList<WindowAndroidObserver> observer_list_; |
| 56 | 60 |
| 57 DISALLOW_COPY_AND_ASSIGN(WindowAndroid); | 61 DISALLOW_COPY_AND_ASSIGN(WindowAndroid); |
| 58 }; | 62 }; |
| 59 | 63 |
| 60 } // namespace ui | 64 } // namespace ui |
| 61 | 65 |
| 62 #endif // UI_BASE_ANDROID_WINDOW_ANDROID_H_ | 66 #endif // UI_BASE_ANDROID_WINDOW_ANDROID_H_ |
| OLD | NEW |