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

Unified Diff: chrome/android/java/src/org/chromium/chrome/browser/component/web_contents_delegate_android/WebContentsDelegateAndroid.java

Issue 10831060: Refactor the Android port to allow access to the chrome layer. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: nit fixed. Created 8 years, 4 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: chrome/android/java/src/org/chromium/chrome/browser/component/web_contents_delegate_android/WebContentsDelegateAndroid.java
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/component/web_contents_delegate_android/WebContentsDelegateAndroid.java b/chrome/android/java/src/org/chromium/chrome/browser/component/web_contents_delegate_android/WebContentsDelegateAndroid.java
new file mode 100644
index 0000000000000000000000000000000000000000..8572dabedbdd9c8b5671028ec119fa71e7fd9800
--- /dev/null
+++ b/chrome/android/java/src/org/chromium/chrome/browser/component/web_contents_delegate_android/WebContentsDelegateAndroid.java
@@ -0,0 +1,110 @@
+// Copyright (c) 2012 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.chrome.browser.component.web_contents_delegate_android;
+
+import android.graphics.Rect;
+import android.graphics.RectF;
+import android.view.KeyEvent;
+
+import org.chromium.base.CalledByNative;
+import org.chromium.base.JNINamespace;
+
+/**
+ * Java peer of the native class of the same name.
+ */
+@JNINamespace("web_contents_delegate_android")
+public class WebContentsDelegateAndroid {
+
+ // Equivalent of WebCore::WebConsoleMessage::LevelTip.
+ public static final int LOG_LEVEL_TIP = 0;
+ // Equivalent of WebCore::WebConsoleMessage::LevelLog.
+ public static final int LOG_LEVEL_LOG = 1;
+ // Equivalent of WebCore::WebConsoleMessage::LevelWarning.
+ public static final int LOG_LEVEL_WARNING = 2;
+ // Equivalent of WebCore::WebConsoleMessage::LevelError.
+ public static final int LOG_LEVEL_ERROR = 3;
+ // The most recent load progress callback received from WebContents, as a percentage.
+ // Initialize to 100 to indicate that we're not in a loading state.
+ private int mMostRecentProgress = 100;
+
+ public int getMostRecentProgress() {
+ return mMostRecentProgress;
+ }
+
+ @CalledByNative
+ public void openNewTab(String url, boolean incognito) {
+ }
+
+ @CalledByNative
+ public boolean addNewContents(int nativeSourceWebContents, int nativeWebContents,
+ int disposition, Rect initialPosition, boolean userGesture) {
+ return false;
+ }
+
+ @CalledByNative
+ public void closeContents() {
+ }
+
+ @CalledByNative
+ public void onUrlStarredChanged(boolean starred) {
+ }
+
+ @CalledByNative
+ public void onLoadStarted() {
+ }
+
+ @CalledByNative
+ public void onLoadStopped() {
+ }
+
+ @CalledByNative
+ public void onTabHeaderStateChanged() {
+ }
+
+ @SuppressWarnings("unused")
+ @CalledByNative
+ private final void onLoadProgressChanged(double progress) {
+ mMostRecentProgress = (int) (100.0 * progress);
+ onLoadProgressChanged(mMostRecentProgress);
+ }
+
+ public void onLoadProgressChanged(int progress) {
+ }
+
+ @CalledByNative
+ public void onUpdateUrl(String url) {
+ }
+
+ @CalledByNative
+ public boolean takeFocus(boolean reverse) {
+ return false;
+ }
+
+ @CalledByNative
+ public boolean shouldOverrideUrlLoading(String url) {
+ return false;
+ }
+
+ @CalledByNative
+ public void handleKeyboardEvent(KeyEvent event) {
+ // TODO(bulach): we probably want to re-inject the KeyEvent back into
+ // the system. Investigate if this is at all possible.
+ }
+
+ /**
+ * Report a JavaScript console message.
+ *
+ * @param level message level. One of WebContentsDelegateAndroid.LOG_LEVEL*.
+ * @param message the error message.
+ * @param lineNumber the line number int the source file at which the error is reported.
+ * @param sourceId the name of the source file that caused the error.
+ * @return true if the client will handle logging the message.
+ */
+ @CalledByNative
+ public boolean addMessageToConsole(int level, String message, int lineNumber,
+ String sourceId) {
+ return false;
+ }
+}

Powered by Google App Engine
This is Rietveld 408576698