OLD | NEW |
1 // Copyright 2012 The Chromium Authors. All rights reserved. | 1 // Copyright 2012 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 package org.chromium.content.browser; | 5 package org.chromium.content.browser; |
6 | 6 |
7 import org.chromium.base.CalledByNative; | 7 import org.chromium.base.CalledByNative; |
8 import org.chromium.base.JNINamespace; | 8 import org.chromium.base.JNINamespace; |
9 import org.chromium.base.ThreadUtils; | 9 import org.chromium.base.ThreadUtils; |
10 import org.chromium.content_public.browser.WebContents; | 10 import org.chromium.content_public.browser.WebContents; |
11 | 11 |
12 /** | 12 /** |
13 * This class receives callbacks that act as hooks for various a native web cont
ents events related | 13 * This class receives callbacks that act as hooks for various a native web cont
ents events related |
14 * to loading a url. A single web contents can have multiple WebContentObserverA
ndroids. | 14 * to loading a url. A single web contents can have multiple WebContentObservers
. |
15 */ | 15 */ |
16 @JNINamespace("content") | 16 @JNINamespace("content") |
17 public abstract class WebContentsObserverAndroid { | 17 public abstract class WebContentsObserver { |
18 private long mNativeWebContentsObserverAndroid; | 18 private long mNativeWebContentsObserverAndroid; |
19 | 19 |
20 public WebContentsObserverAndroid(WebContents webContents) { | 20 public WebContentsObserver(WebContents webContents) { |
21 ThreadUtils.assertOnUiThread(); | 21 ThreadUtils.assertOnUiThread(); |
22 mNativeWebContentsObserverAndroid = nativeInit(webContents); | 22 mNativeWebContentsObserverAndroid = nativeInit(webContents); |
23 } | 23 } |
24 | 24 |
25 @CalledByNative | 25 @CalledByNative |
26 public void renderProcessGone(boolean wasOomProtected) { | 26 public void renderProcessGone(boolean wasOomProtected) { |
27 } | 27 } |
28 | 28 |
29 /** | 29 /** |
30 * Called when the a page starts loading. | 30 * Called when the a page starts loading. |
(...skipping 156 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
187 public void detachFromWebContents() { | 187 public void detachFromWebContents() { |
188 if (mNativeWebContentsObserverAndroid != 0) { | 188 if (mNativeWebContentsObserverAndroid != 0) { |
189 nativeDestroy(mNativeWebContentsObserverAndroid); | 189 nativeDestroy(mNativeWebContentsObserverAndroid); |
190 mNativeWebContentsObserverAndroid = 0; | 190 mNativeWebContentsObserverAndroid = 0; |
191 } | 191 } |
192 } | 192 } |
193 | 193 |
194 private native long nativeInit(WebContents webContents); | 194 private native long nativeInit(WebContents webContents); |
195 private native void nativeDestroy(long nativeWebContentsObserverAndroid); | 195 private native void nativeDestroy(long nativeWebContentsObserverAndroid); |
196 } | 196 } |
OLD | NEW |