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 WebContentObserverA ndroids. | 14 * to loading a url. A single web contents can have multiple WebContentObserverA ndroids. |
| 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 132 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 163 */ | 163 */ |
| 164 @CalledByNative | 164 @CalledByNative |
| 165 public void didChangeThemeColor(int color) { | 165 public void didChangeThemeColor(int color) { |
| 166 } | 166 } |
| 167 | 167 |
| 168 /** | 168 /** |
| 169 * Destroy the corresponding native object. | 169 * Destroy the corresponding native object. |
| 170 */ | 170 */ |
| 171 @CalledByNative | 171 @CalledByNative |
| 172 public void detachFromWebContents() { | 172 public void detachFromWebContents() { |
| 173 if (mNativeWebContentsObserverAndroid != 0) { | 173 if (mNativeWebContentsObserverAndroid != 0) { |
|
jdduke (slow)
2014/09/25 14:59:41
Don't you also want to rename the native pointer?
wajahat
2014/09/25 15:10:16
This parameter name still needs to be nativeWebCon
| |
| 174 nativeDestroy(mNativeWebContentsObserverAndroid); | 174 nativeDestroy(mNativeWebContentsObserverAndroid); |
| 175 mNativeWebContentsObserverAndroid = 0; | 175 mNativeWebContentsObserverAndroid = 0; |
| 176 } | 176 } |
| 177 } | 177 } |
| 178 | 178 |
| 179 private native long nativeInit(WebContents webContents); | 179 private native long nativeInit(WebContents webContents); |
| 180 private native void nativeDestroy(long nativeWebContentsObserverAndroid); | 180 private native void nativeDestroy(long nativeWebContentsObserverAndroid); |
| 181 } | 181 } |
| OLD | NEW |