Chromium Code Reviews| 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 WebContentObservers . | 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 WebContentsObserver { | 17 public abstract class WebContentsObserver { |
| 18 private long mNativeWebContentsObserverAndroid; | 18 private long mNativeWebContentsObserverAndroid; |
| 19 | 19 |
| 20 public WebContentsObserver(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 renderViewReady() { | |
| 27 } | |
| 28 | |
| 29 @CalledByNative | |
| 26 public void renderProcessGone(boolean wasOomProtected) { | 30 public void renderProcessGone(boolean wasOomProtected) { |
| 27 } | 31 } |
| 28 | 32 |
| 29 /** | 33 /** |
| 30 * Called when the a page starts loading. | 34 * Called when the a page starts loading. |
| 31 * @param url The validated url for the loading page. | 35 * @param url The validated url for the loading page. |
| 32 */ | 36 */ |
| 33 @CalledByNative | 37 @CalledByNative |
| 34 public void didStartLoading(String url) { | 38 public void didStartLoading(String url) { |
| 35 } | 39 } |
| (...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 91 /** | 95 /** |
| 92 * Similar to didNavigateMainFrame but also called on subframe navigations. | 96 * Similar to didNavigateMainFrame but also called on subframe navigations. |
| 93 * @param url The validated url for the page. | 97 * @param url The validated url for the page. |
| 94 * @param baseUrl The validated base url for the page. | 98 * @param baseUrl The validated base url for the page. |
| 95 * @param isReload True if this navigation is a reload. | 99 * @param isReload True if this navigation is a reload. |
| 96 */ | 100 */ |
| 97 @CalledByNative | 101 @CalledByNative |
| 98 public void didNavigateAnyFrame(String url, String baseUrl, boolean isReload ) { | 102 public void didNavigateAnyFrame(String url, String baseUrl, boolean isReload ) { |
| 99 } | 103 } |
| 100 | 104 |
| 105 @CalledByNative | |
| 106 public void documentAvailableInMainFrame() { | |
|
Ted C
2014/11/05 16:26:03
Can you add javadoc to these new methods?
| |
| 107 } | |
| 108 | |
| 101 /** | 109 /** |
| 102 * Notifies that a load is started for a given frame. | 110 * Notifies that a load is started for a given frame. |
| 103 * @param frameId A positive, non-zero integer identifying the navigating fr ame. | 111 * @param frameId A positive, non-zero integer identifying the navigating fr ame. |
| 104 * @param parentFrameId The frame identifier of the frame containing the nav igating frame, | 112 * @param parentFrameId The frame identifier of the frame containing the nav igating frame, |
| 105 * or -1 if the frame is not contained in another frame . | 113 * or -1 if the frame is not contained in another frame . |
| 106 * @param isMainFrame Whether the load is happening for the main frame. | 114 * @param isMainFrame Whether the load is happening for the main frame. |
| 107 * @param validatedUrl The validated URL that is being navigated to. | 115 * @param validatedUrl The validated URL that is being navigated to. |
| 108 * @param isErrorPage Whether this is navigating to an error page. | 116 * @param isErrorPage Whether this is navigating to an error page. |
| 109 * @param isIframeSrcdoc Whether this is navigating to about:srcdoc. | 117 * @param isIframeSrcdoc Whether this is navigating to about:srcdoc. |
| 110 */ | 118 */ |
| (...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 187 public void detachFromWebContents() { | 195 public void detachFromWebContents() { |
| 188 if (mNativeWebContentsObserverAndroid != 0) { | 196 if (mNativeWebContentsObserverAndroid != 0) { |
| 189 nativeDestroy(mNativeWebContentsObserverAndroid); | 197 nativeDestroy(mNativeWebContentsObserverAndroid); |
| 190 mNativeWebContentsObserverAndroid = 0; | 198 mNativeWebContentsObserverAndroid = 0; |
| 191 } | 199 } |
| 192 } | 200 } |
| 193 | 201 |
| 194 private native long nativeInit(WebContents webContents); | 202 private native long nativeInit(WebContents webContents); |
| 195 private native void nativeDestroy(long nativeWebContentsObserverAndroid); | 203 private native void nativeDestroy(long nativeWebContentsObserverAndroid); |
| 196 } | 204 } |
| OLD | NEW |