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

Unified Diff: ui/android/java/src/org/chromium/ui/ViewAndroid.java

Issue 70843003: ui: Android changes. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: dom_distiller fixes Created 7 years, 1 month 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/android/java/src/org/chromium/ui/ViewAndroid.java
diff --git a/ui/android/java/src/org/chromium/ui/ViewAndroid.java b/ui/android/java/src/org/chromium/ui/ViewAndroid.java
deleted file mode 100644
index 694f42195dd566d30a990da6b723a9c4ac5ea021..0000000000000000000000000000000000000000
--- a/ui/android/java/src/org/chromium/ui/ViewAndroid.java
+++ /dev/null
@@ -1,87 +0,0 @@
-// Copyright (c) 2013 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-package org.chromium.ui;
-
-import android.view.View;
-
-import org.chromium.base.JNINamespace;
-import org.chromium.ui.ViewAndroidDelegate;
-import org.chromium.ui.WindowAndroid;
-
-/**
- * From the Chromium architecture point of view, ViewAndroid and its native counterpart
- * serve purpose of representing Android view where Chrome expects to have a cross platform
- * handle to the system view type. As Views are Java object on Android, this ViewAndroid
- * and its native counterpart provide the expected abstractions on the C++ side and allow
- * it to be flexibly glued to an actual Android Java View at runtime.
- *
- * It should only be used where access to Android Views is needed from the C++ code.
- */
-@JNINamespace("ui")
-public class ViewAndroid {
- // Native pointer to the c++ ViewAndroid object.
- private long mNativeViewAndroid = 0;
- private final ViewAndroidDelegate mViewAndroidDelegate;
- private final WindowAndroid mWindowAndroid;
- private int mKeepScreenOnCount;
- private View mKeepScreenOnView;
-
- /**
- * Constructs a View object.
- */
- public ViewAndroid(WindowAndroid nativeWindow, ViewAndroidDelegate viewAndroidDelegate) {
- mWindowAndroid = nativeWindow;
- mViewAndroidDelegate = viewAndroidDelegate;
- mNativeViewAndroid = nativeInit(mWindowAndroid.getNativePointer());
- }
-
- public ViewAndroidDelegate getViewAndroidDelegate() {
- return mViewAndroidDelegate;
- }
-
- /**
- * Destroys the c++ ViewAndroid object if one has been created.
- */
- public void destroy() {
- if (mNativeViewAndroid != 0) {
- nativeDestroy(mNativeViewAndroid);
- mNativeViewAndroid = 0;
- }
- }
-
- /**
- * Returns a pointer to the c++ AndroidWindow object.
- * @return A pointer to the c++ AndroidWindow.
- */
- public long getNativePointer() {
- return mNativeViewAndroid;
- }
-
- /**
- * Set KeepScreenOn flag. If the flag already set, increase mKeepScreenOnCount.
- */
- public void incrementKeepScreenOnCount() {
- mKeepScreenOnCount++;
- if (mKeepScreenOnCount == 1) {
- mKeepScreenOnView = mViewAndroidDelegate.acquireAnchorView();
- mKeepScreenOnView.setKeepScreenOn(true);
- }
- }
-
- /**
- * Decrease mKeepScreenOnCount, if it is decreased to 0, remove the flag.
- */
- public void decrementKeepScreenOnCount() {
- assert mKeepScreenOnCount > 0;
- mKeepScreenOnCount--;
- if (mKeepScreenOnCount == 0) {
- mViewAndroidDelegate.releaseAnchorView(mKeepScreenOnView);
- mKeepScreenOnView = null;
- }
- }
-
- private native long nativeInit(long windowPtr);
- private native void nativeDestroy(long nativeViewAndroid);
-}

Powered by Google App Engine
This is Rietveld 408576698