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

Unified Diff: chrome/android/java/src/org/chromium/chrome/browser/ContentViewDelegate.java

Issue 10702083: Add ContentViewDelegate (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: it builds (but other code in chrome/ doesn't...) Created 8 years, 5 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/ContentViewDelegate.java
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/ContentViewDelegate.java b/chrome/android/java/src/org/chromium/chrome/browser/ContentViewDelegate.java
new file mode 100644
index 0000000000000000000000000000000000000000..d7fc0130d16a2713948057857d1649df664d02ea
--- /dev/null
+++ b/chrome/android/java/src/org/chromium/chrome/browser/ContentViewDelegate.java
@@ -0,0 +1,42 @@
+// 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;
+
+import org.chromium.base.CalledByNative;
+
+import java.util.concurrent.atomic.AtomicReference;
+
+/**
+ * Delegate that lets the chrome/ layer talk to the ContentView embedder.
+ */
+public class ContentViewDelegate {
+ public interface ContentViewDelegateImpl {
+ boolean shouldOverrideUrlLoading(String url);
+ }
+ private AtomicReference<ContentViewDelegateImpl> mImpl =
+ new AtomicReference<ContentViewDelegateImpl>();
+
+ public ContentViewDelegate(int nativeWebContents, ContentViewDelegateImpl impl) {
+ mImpl.set(impl);
+ nativeInit(nativeWebContents);
+ }
+
+ @CalledByNative
+ private boolean shouldOverrideUrlLoading(String url) {
+ ContentViewDelegateImpl impl = mImpl.get();
+ if (impl == null) {
+ return false;
+ } else {
+ return impl.shouldOverrideUrlLoading(url);
+ }
+ }
+
+ @CalledByNative
+ private void onWebContentsDestroyed() {
+ mImpl.set(null);
+ }
+
+ private native void nativeInit(int webContents);
+}

Powered by Google App Engine
This is Rietveld 408576698