| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 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 | 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.chrome.browser; | 5 package org.chromium.chrome.browser; |
| 6 | 6 |
| 7 import android.view.ContextMenu; | 7 import android.view.ContextMenu; |
| 8 | 8 |
| 9 import org.chromium.content.browser.ContentView; | 9 import org.chromium.content.browser.ContentView; |
| 10 | 10 |
| 11 /** | 11 /** |
| 12 * An observer that is notified of changes to a {@link TabBase} object. | 12 * An observer that is notified of changes to a {@link Tab} object. |
| 13 */ | 13 */ |
| 14 public interface TabObserver { | 14 public interface TabObserver { |
| 15 | 15 |
| 16 /** | 16 /** |
| 17 * Called when a {@link TabBase} is being destroyed. | 17 * Called when a {@link Tab} is being destroyed. |
| 18 * @param tab The notifying {@link TabBase}. | 18 * @param tab The notifying {@link Tab}. |
| 19 */ | 19 */ |
| 20 void onDestroyed(TabBase tab); | 20 void onDestroyed(Tab tab); |
| 21 | 21 |
| 22 /** | 22 /** |
| 23 * Called when the tab content changes (to/from native pages or swapping nat
ive WebContents). | 23 * Called when the tab content changes (to/from native pages or swapping nat
ive WebContents). |
| 24 * @param tab The notifying {@link TabBase}. | 24 * @param tab The notifying {@link Tab}. |
| 25 */ | 25 */ |
| 26 void onContentChanged(TabBase tab); | 26 void onContentChanged(Tab tab); |
| 27 | 27 |
| 28 /** | 28 /** |
| 29 * Called when the favicon of a {@link TabBase} has been updated. | 29 * Called when the favicon of a {@link Tab} has been updated. |
| 30 * @param tab The notifying {@link TabBase}. | 30 * @param tab The notifying {@link Tab}. |
| 31 */ | 31 */ |
| 32 void onFaviconUpdated(TabBase tab); | 32 void onFaviconUpdated(Tab tab); |
| 33 | 33 |
| 34 /** | 34 /** |
| 35 * Called when the title of a {@link TabBase} changes. | 35 * Called when the title of a {@link Tab} changes. |
| 36 * @param tab The notifying {@link TabBase}. | 36 * @param tab The notifying {@link Tab}. |
| 37 */ | 37 */ |
| 38 void onTitleUpdated(TabBase tab); | 38 void onTitleUpdated(Tab tab); |
| 39 | 39 |
| 40 /** | 40 /** |
| 41 * Called when the URL of a {@link TabBase} changes. | 41 * Called when the URL of a {@link Tab} changes. |
| 42 * @param tab The notifying {@link TabBase}. | 42 * @param tab The notifying {@link Tab}. |
| 43 */ | 43 */ |
| 44 void onUrlUpdated(TabBase tab); | 44 void onUrlUpdated(Tab tab); |
| 45 | 45 |
| 46 /** | 46 /** |
| 47 * Called when the WebContents of a {@link TabBase} have been swapped. | 47 * Called when the WebContents of a {@link Tab} have been swapped. |
| 48 * @param tab The notifying {@link TabBase}. | 48 * @param tab The notifying {@link Tab}. |
| 49 * @param didStartLoad Whether WebContentsObserver::DidStartProvisionalLoadF
orFrame() has | 49 * @param didStartLoad Whether WebContentsObserver::DidStartProvisionalLoadF
orFrame() has |
| 50 * already been called. | 50 * already been called. |
| 51 * @param didFinishLoad Whether WebContentsObserver::DidFinishLoad() has alr
eady been called. | 51 * @param didFinishLoad Whether WebContentsObserver::DidFinishLoad() has alr
eady been called. |
| 52 */ | 52 */ |
| 53 void onWebContentsSwapped(TabBase tab, boolean didStartLoad, boolean didFini
shLoad); | 53 void onWebContentsSwapped(Tab tab, boolean didStartLoad, boolean didFinishLo
ad); |
| 54 | 54 |
| 55 /** | 55 /** |
| 56 * Called when a context menu is shown for a {@link ContentView} owned by a
{@link TabBase}. | 56 * Called when a context menu is shown for a {@link ContentView} owned by a
{@link Tab}. |
| 57 * @param tab The notifying {@link TabBase}. | 57 * @param tab The notifying {@link Tab}. |
| 58 * @param menu The {@link ContextMenu} that is being shown. | 58 * @param menu The {@link ContextMenu} that is being shown. |
| 59 */ | 59 */ |
| 60 void onContextMenuShown(TabBase tab, ContextMenu menu); | 60 void onContextMenuShown(Tab tab, ContextMenu menu); |
| 61 | 61 |
| 62 // WebContentsDelegateAndroid methods --------------------------------------
------------------- | 62 // WebContentsDelegateAndroid methods --------------------------------------
------------------- |
| 63 | 63 |
| 64 /** | 64 /** |
| 65 * Called when the load progress of a {@link TabBase} changes. | 65 * Called when the load progress of a {@link Tab} changes. |
| 66 * @param tab The notifying {@link TabBase}. | 66 * @param tab The notifying {@link Tab}. |
| 67 * @param progress The new progress from [0,100]. | 67 * @param progress The new progress from [0,100]. |
| 68 */ | 68 */ |
| 69 void onLoadProgressChanged(TabBase tab, int progress); | 69 void onLoadProgressChanged(Tab tab, int progress); |
| 70 | 70 |
| 71 /** | 71 /** |
| 72 * Called when the URL of a {@link TabBase} changes. | 72 * Called when the URL of a {@link Tab} changes. |
| 73 * @param tab The notifying {@link TabBase}. | 73 * @param tab The notifying {@link Tab}. |
| 74 * @param url The new URL. | 74 * @param url The new URL. |
| 75 */ | 75 */ |
| 76 void onUpdateUrl(TabBase tab, String url); | 76 void onUpdateUrl(Tab tab, String url); |
| 77 | 77 |
| 78 /** | 78 /** |
| 79 * Called when the {@link TabBase} should enter or leave fullscreen mode. | 79 * Called when the {@link Tab} should enter or leave fullscreen mode. |
| 80 * @param tab The notifying {@link TabBase}. | 80 * @param tab The notifying {@link Tab}. |
| 81 * @param enable Whether or not to enter fullscreen mode. | 81 * @param enable Whether or not to enter fullscreen mode. |
| 82 */ | 82 */ |
| 83 void onToggleFullscreenMode(TabBase tab, boolean enable); | 83 void onToggleFullscreenMode(Tab tab, boolean enable); |
| 84 | 84 |
| 85 // WebContentsObserverAndroid methods --------------------------------------
------------------- | 85 // WebContentsObserverAndroid methods --------------------------------------
------------------- |
| 86 | 86 |
| 87 /** | 87 /** |
| 88 * Called when an error occurs while loading a page and/or the page fails to
load. | 88 * Called when an error occurs while loading a page and/or the page fails to
load. |
| 89 * @param tab The notifying {@link TabBase}. | 89 * @param tab The notifying {@link Tab}. |
| 90 * @param isProvisionalLoad Whether the failed load occurred during the prov
isional load. | 90 * @param isProvisionalLoad Whether the failed load occurred during the prov
isional load. |
| 91 * @param isMainFrame Whether failed load happened for the main frame. | 91 * @param isMainFrame Whether failed load happened for the main frame. |
| 92 * @param errorCode Code for the occurring error. | 92 * @param errorCode Code for the occurring error. |
| 93 * @param description The description for the error. | 93 * @param description The description for the error. |
| 94 * @param failingUrl The url that was loading when the error occurred
. | 94 * @param failingUrl The url that was loading when the error occurred
. |
| 95 */ | 95 */ |
| 96 void onDidFailLoad(TabBase tab, boolean isProvisionalLoad, boolean isMainFra
me, int errorCode, | 96 void onDidFailLoad( |
| 97 Tab tab, boolean isProvisionalLoad, boolean isMainFrame, int errorCo
de, |
| 97 String description, String failingUrl); | 98 String description, String failingUrl); |
| 98 | 99 |
| 99 } | 100 } |
| OLD | NEW |