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; | |
| 8 import org.chromium.base.JNINamespace; | |
| 9 import org.chromium.base.ThreadUtils; | |
| 10 import org.chromium.content_public.browser.WebContents; | 7 import org.chromium.content_public.browser.WebContents; |
| 11 | 8 |
| 12 /** | 9 /** |
| 10 * @deprecated This class has been renamed to {@link WebContentsObserver} and | |
| 11 * will be removed when all usages have been removed. See http://crbug.com/3961 18. | |
| 12 */ | |
| 13 @Deprecated | |
| 14 /** | |
| 13 * This class receives callbacks that act as hooks for various a native web cont ents events related | 15 * This class receives callbacks that act as hooks for various a native web cont ents events related |
|
nyquist
2014/10/02 21:03:26
Can you remove this description? Just keep the @de
wajahat
2014/10/07 10:29:43
Done.
| |
| 14 * to loading a url. A single web contents can have multiple WebContentObserverA ndroids. | 16 * to loading a url. A single web contents can have multiple WebContentObserverA ndroids. |
| 15 */ | 17 */ |
| 16 @JNINamespace("content") | 18 public abstract class WebContentsObserverAndroid extends WebContentsObserver { |
| 17 public abstract class WebContentsObserverAndroid { | |
| 18 private long mNativeWebContentsObserverAndroid; | |
| 19 | 19 |
| 20 public WebContentsObserverAndroid(WebContents webContents) { | 20 public WebContentsObserverAndroid(WebContents webContents) { |
| 21 ThreadUtils.assertOnUiThread(); | 21 super(webContents); |
| 22 mNativeWebContentsObserverAndroid = nativeInit(webContents); | |
| 23 } | 22 } |
| 24 | |
| 25 @CalledByNative | |
| 26 public void renderProcessGone(boolean wasOomProtected) { | |
| 27 } | |
| 28 | |
| 29 /** | |
| 30 * Called when the a page starts loading. | |
| 31 * @param url The validated url for the loading page. | |
| 32 */ | |
| 33 @CalledByNative | |
| 34 public void didStartLoading(String url) { | |
| 35 } | |
| 36 | |
| 37 /** | |
| 38 * Called when the a page finishes loading. | |
| 39 * @param url The validated url for the page. | |
| 40 */ | |
| 41 @CalledByNative | |
| 42 public void didStopLoading(String url) { | |
| 43 } | |
| 44 | |
| 45 /** | |
| 46 * Called when an error occurs while loading a page and/or the page fails to load. | |
| 47 * @param errorCode Error code for the occurring error. | |
| 48 * @param description The description for the error. | |
| 49 * @param failingUrl The url that was loading when the error occurred. | |
| 50 */ | |
| 51 @CalledByNative | |
| 52 public void didFailLoad(boolean isProvisionalLoad, | |
| 53 boolean isMainFrame, int errorCode, String description, String faili ngUrl) { | |
| 54 } | |
| 55 | |
| 56 /** | |
| 57 * Called when the main frame of the page has committed. | |
| 58 * @param url The validated url for the page. | |
| 59 * @param baseUrl The validated base url for the page. | |
| 60 * @param isNavigationToDifferentPage Whether the main frame navigated to a different page. | |
| 61 * @param isFragmentNavigation Whether the main frame navigation did not cau se changes to the | |
| 62 * document (for example scrolling to a named an chor or PopState). | |
| 63 */ | |
| 64 @CalledByNative | |
| 65 public void didNavigateMainFrame(String url, String baseUrl, | |
| 66 boolean isNavigationToDifferentPage, boolean isFragmentNavigation) { | |
| 67 } | |
| 68 | |
| 69 /** | |
| 70 * Called when the page had painted something non-empty. | |
| 71 */ | |
| 72 @CalledByNative | |
| 73 public void didFirstVisuallyNonEmptyPaint() { | |
| 74 } | |
| 75 | |
| 76 /** | |
| 77 * Similar to didNavigateMainFrame but also called on subframe navigations. | |
| 78 * @param url The validated url for the page. | |
| 79 * @param baseUrl The validated base url for the page. | |
| 80 * @param isReload True if this navigation is a reload. | |
| 81 */ | |
| 82 @CalledByNative | |
| 83 public void didNavigateAnyFrame(String url, String baseUrl, boolean isReload ) { | |
| 84 } | |
| 85 | |
| 86 /** | |
| 87 * Notifies that a load is started for a given frame. | |
| 88 * @param frameId A positive, non-zero integer identifying the navigating fr ame. | |
| 89 * @param parentFrameId The frame identifier of the frame containing the nav igating frame, | |
| 90 * or -1 if the frame is not contained in another frame . | |
| 91 * @param isMainFrame Whether the load is happening for the main frame. | |
| 92 * @param validatedUrl The validated URL that is being navigated to. | |
| 93 * @param isErrorPage Whether this is navigating to an error page. | |
| 94 * @param isIframeSrcdoc Whether this is navigating to about:srcdoc. | |
| 95 */ | |
| 96 @CalledByNative | |
| 97 public void didStartProvisionalLoadForFrame( | |
| 98 long frameId, | |
| 99 long parentFrameId, | |
| 100 boolean isMainFrame, | |
| 101 String validatedUrl, | |
| 102 boolean isErrorPage, | |
| 103 boolean isIframeSrcdoc) { | |
| 104 } | |
| 105 | |
| 106 /** | |
| 107 * Notifies that the provisional load was successfully committed. The Render ViewHost is now | |
| 108 * the current RenderViewHost of the WebContents. | |
| 109 * @param frameId A positive, non-zero integer identifying the navigating fr ame. | |
| 110 * @param isMainFrame Whether the load is happening for the main frame. | |
| 111 * @param url The committed URL being navigated to. | |
| 112 * @param transitionType The transition type as defined in | |
| 113 * {@link org.chromium.ui.base.PageTransitionTypes} for the load. | |
| 114 */ | |
| 115 @CalledByNative | |
| 116 public void didCommitProvisionalLoadForFrame( | |
| 117 long frameId, boolean isMainFrame, String url, int transitionType) { | |
| 118 | |
| 119 } | |
| 120 | |
| 121 /** | |
| 122 * Notifies that a load has finished for a given frame. | |
| 123 * @param frameId A positive, non-zero integer identifying the navigating fr ame. | |
| 124 * @param validatedUrl The validated URL that is being navigated to. | |
| 125 * @param isMainFrame Whether the load is happening for the main frame. | |
| 126 */ | |
| 127 @CalledByNative | |
| 128 public void didFinishLoad(long frameId, String validatedUrl, boolean isMainF rame) { | |
| 129 } | |
| 130 | |
| 131 /** | |
| 132 * Notifies that the document has finished loading for the given frame. | |
| 133 * @param frameId A positive, non-zero integer identifying the navigating fr ame. | |
| 134 */ | |
| 135 @CalledByNative | |
| 136 public void documentLoadedInFrame(long frameId) { | |
| 137 } | |
| 138 | |
| 139 /** | |
| 140 * Notifies that a navigation entry has been committed. | |
| 141 */ | |
| 142 @CalledByNative | |
| 143 public void navigationEntryCommitted() { | |
| 144 } | |
| 145 | |
| 146 /** | |
| 147 * Called when an interstitial page gets attached to the tab content. | |
| 148 */ | |
| 149 @CalledByNative | |
| 150 public void didAttachInterstitialPage() { | |
| 151 } | |
| 152 | |
| 153 /** | |
| 154 * Called when an interstitial page gets detached from the tab content. | |
| 155 */ | |
| 156 @CalledByNative | |
| 157 public void didDetachInterstitialPage() { | |
| 158 } | |
| 159 | |
| 160 /** | |
| 161 * Called when the theme color was changed. | |
| 162 * @param color the new color in ARGB format | |
| 163 */ | |
| 164 @CalledByNative | |
| 165 public void didChangeThemeColor(int color) { | |
| 166 } | |
| 167 | |
| 168 /** | |
| 169 * Destroy the corresponding native object. | |
| 170 */ | |
| 171 @CalledByNative | |
| 172 public void detachFromWebContents() { | |
| 173 if (mNativeWebContentsObserverAndroid != 0) { | |
| 174 nativeDestroy(mNativeWebContentsObserverAndroid); | |
| 175 mNativeWebContentsObserverAndroid = 0; | |
| 176 } | |
| 177 } | |
| 178 | |
| 179 private native long nativeInit(WebContents webContents); | |
| 180 private native void nativeDestroy(long nativeWebContentsObserverAndroid); | |
| 181 } | 23 } |
| OLD | NEW |