Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(505)

Unified Diff: ui/platform_window/android/platform_window_android.h

Issue 1180573004: android: Introduce a ui::PlatformWindow implementation for android. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fix-win-gn Created 5 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: ui/platform_window/android/platform_window_android.h
diff --git a/components/view_manager/native_viewport/platform_viewport_android.h b/ui/platform_window/android/platform_window_android.h
similarity index 61%
rename from components/view_manager/native_viewport/platform_viewport_android.h
rename to ui/platform_window/android/platform_window_android.h
index 3eba7ccaf4feeef772ea3f6f9a25a5427efa82ed..0e330682be5685627b6dffb0fa1e801409f584b0 100644
--- a/components/view_manager/native_viewport/platform_viewport_android.h
+++ b/ui/platform_window/android/platform_window_android.h
@@ -2,32 +2,28 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#ifndef COMPONENTS_VIEW_MANAGER_NATIVE_VIEWPORT_PLATFORM_VIEWPORT_ANDROID_H_
-#define COMPONENTS_VIEW_MANAGER_NATIVE_VIEWPORT_PLATFORM_VIEWPORT_ANDROID_H_
+#ifndef UI_PLATFORM_WINDOW_ANDROID_PLATFORM_WINDOW_ANDROID_H_
+#define UI_PLATFORM_WINDOW_ANDROID_PLATFORM_WINDOW_ANDROID_H_
#include "base/android/jni_weak_ref.h"
#include "base/macros.h"
#include "base/memory/weak_ptr.h"
-#include "components/view_manager/native_viewport/platform_viewport.h"
#include "ui/events/event_constants.h"
#include "ui/gfx/geometry/rect.h"
#include "ui/gfx/geometry/size.h"
#include "ui/gfx/sequential_id_generator.h"
-
-namespace gpu {
-class GLInProcessContext;
-}
+#include "ui/platform_window/platform_window.h"
struct ANativeWindow;
-namespace native_viewport {
+namespace ui {
-class PlatformViewportAndroid : public PlatformViewport {
+class PlatformWindowAndroid : public PlatformWindow {
public:
static bool Register(JNIEnv* env);
- explicit PlatformViewportAndroid(Delegate* delegate);
- ~PlatformViewportAndroid() override;
+ explicit PlatformWindowAndroid(PlatformWindowDelegate* delegate);
+ ~PlatformWindowAndroid() override;
void Destroy(JNIEnv* env, jobject obj);
void SurfaceCreated(JNIEnv* env,
@@ -58,30 +54,38 @@ class PlatformViewportAndroid : public PlatformViewport {
bool pressed,
jint key_code,
jint unicode_character);
-
private:
- // Overridden from PlatformViewport:
- void Init(const gfx::Rect& bounds) override;
+ void ReleaseWindow();
+
+ // Overridden from PlatformWindow:
void Show() override;
void Hide() override;
void Close() override;
- gfx::Size GetSize() override;
void SetBounds(const gfx::Rect& bounds) override;
-
- void ReleaseWindow();
-
- Delegate* const delegate_;
- JavaObjectWeakGlobalRef java_platform_viewport_android_;
+ gfx::Rect GetBounds() override;
+ void SetCapture() override;
+ void ReleaseCapture() override;
+ void ToggleFullscreen() override;
+ void Maximize() override;
+ void Minimize() override;
+ void Restore() override;
+ void SetCursor(PlatformCursor cursor) override;
+ void MoveCursorTo(const gfx::Point& location) override;
+ void ConfineCursorToBounds(const gfx::Rect& bounds) override;
+
+ PlatformWindowDelegate* delegate_;
+
+ JavaObjectWeakGlobalRef java_platform_window_android_;
ANativeWindow* window_;
ui::SequentialIDGenerator id_generator_;
- gfx::Size size_;
+ gfx::Size size_; // Origin is always (0,0)
- base::WeakPtrFactory<PlatformViewportAndroid> weak_factory_;
+ base::WeakPtrFactory<PlatformWindowAndroid> weak_factory_;
- DISALLOW_COPY_AND_ASSIGN(PlatformViewportAndroid);
+ DISALLOW_COPY_AND_ASSIGN(PlatformWindowAndroid);
};
-} // namespace native_viewport
+} // namespace ui
-#endif // COMPONENTS_VIEW_MANAGER_NATIVE_VIEWPORT_PLATFORM_VIEWPORT_ANDROID_H_
+#endif // UI_PLATFORM_WINDOW_ANDROID_PLATFORM_WINDOW_ANDROID_H_

Powered by Google App Engine
This is Rietveld 408576698