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