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
3 // found in the LICENSE file.
5 package org.chromium.chrome.browser;
7 import android.view.ContextMenu;
9 import org.chromium.content.browser.ContentView;
12 * An observer that is notified of changes to a {@link TabBase} object.
14 public interface TabObserver {
17 * Called when a {@link TabBase} is being destroyed.
18 * @param tab The notifying {@link TabBase}.
20 void onDestroyed(TabBase tab);
23 * Called when the tab content changes (to/from native pages or swapping native WebContents).
24 * @param tab The notifying {@link TabBase}.
26 void onContentChanged(TabBase tab);
29 * Called when the favicon of a {@link TabBase} has been updated.
30 * @param tab The notifying {@link TabBase}.
32 void onFaviconUpdated(TabBase tab);
35 * Called when the title of a {@link TabBase} changes.
36 * @param tab The notifying {@link TabBase}.
38 void onTitleUpdated(TabBase tab);
41 * Called when the URL of a {@link TabBase} changes.
42 * @param tab The notifying {@link TabBase}.
44 void onUrlUpdated(TabBase tab);
47 * Called when the WebContents of a {@link TabBase} have been swapped.
48 * @param tab The notifying {@link TabBase}.
50 void onWebContentsSwapped(TabBase tab);
53 * Called when a context menu is shown for a {@link ContentView} owned by a {@link TabBase}.
54 * @param tab The notifying {@link TabBase}.
55 * @param menu The {@link ContextMenu} that is being shown.
57 void onContextMenuShown(TabBase tab, ContextMenu menu);
59 // WebContentsDelegateAndroid methods ---------------------------------------------------------
62 * Called when the load progress of a {@link TabBase} changes.
63 * @param tab The notifying {@link TabBase}.
64 * @param progress The new progress from [0,100].
66 void onLoadProgressChanged(TabBase tab, int progress);
69 * Called when the URL of a {@link TabBase} changes.
70 * @param tab The notifying {@link TabBase}.
71 * @param url The new URL.
73 void onUpdateUrl(TabBase tab, String url);
76 * Called when the {@link TabBase} should enter or leave fullscreen mode.
77 * @param tab The notifying {@link TabBase}.
78 * @param enable Whether or not to enter fullscreen mode.
80 void onToggleFullscreenMode(TabBase tab, boolean enable);
82 // WebContentsObserverAndroid methods ---------------------------------------------------------
85 * Called when an error occurs while loading a page and/or the page fails to load.
86 * @param tab The notifying {@link TabBase}.
87 * @param isProvisionalLoad Whether the failed load occurred during the provisional load.
88 * @param isMainFrame Whether failed load happened for the main frame.
89 * @param errorCode Code for the occurring error.
90 * @param description The description for the error.
91 * @param failingUrl The url that was loading when the error occurred.
93 void onDidFailLoad(TabBase tab, boolean isProvisionalLoad, boolean isMainFrame, int errorCode,
94 String description, String failingUrl);