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
3 // found in the LICENSE file.
5 package org.chromium.content.browser.webcontents;
7 import org.chromium.base.CalledByNative;
8 import org.chromium.base.JNINamespace;
9 import org.chromium.content_public.browser.NavigationController;
10 import org.chromium.content_public.browser.WebContents;
13 * The WebContentsImpl Java wrapper to allow communicating with the native WebContentsImpl
16 @JNINamespace("content")
17 //TODO(tedchoc): Remove the package restriction once this class moves to a non-public content
18 // package whose visibility will be enforced via DEPS.
19 /* package */ class WebContentsImpl implements WebContents {
21 private long mNativeWebContentsAndroid;
22 private NavigationController mNavigationController;
24 private WebContentsImpl(
25 long nativeWebContentsAndroid, NavigationController navigationController) {
26 mNativeWebContentsAndroid = nativeWebContentsAndroid;
27 mNavigationController = navigationController;
31 private static WebContentsImpl create(
32 long nativeWebContentsAndroid, NavigationController navigationController) {
33 return new WebContentsImpl(nativeWebContentsAndroid, navigationController);
37 private void destroy() {
38 mNativeWebContentsAndroid = 0;
39 mNavigationController = null;
43 private long getNativePointer() {
44 return mNativeWebContentsAndroid;
48 public NavigationController getNavigationController() {
49 return mNavigationController;
53 public String getTitle() {
54 return nativeGetTitle(mNativeWebContentsAndroid);
58 public String getVisibleUrl() {
59 return nativeGetVisibleURL(mNativeWebContentsAndroid);
64 nativeStop(mNativeWebContentsAndroid);
67 private native String nativeGetTitle(long nativeWebContentsAndroid);
68 private native String nativeGetVisibleURL(long nativeWebContentsAndroid);
69 private native void nativeStop(long nativeWebContentsAndroid);