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}.
49 * @param didStartLoad Whether WebContentsObserver::DidStartProvisionalLoadForFrame() has
50 * already been called.
51 * @param didFinishLoad Whether WebContentsObserver::DidFinishLoad() has already been called.
53 void onWebContentsSwapped(TabBase tab, boolean didStartLoad, boolean didFinishLoad);
56 * Called when a context menu is shown for a {@link ContentView} owned by a {@link TabBase}.
57 * @param tab The notifying {@link TabBase}.
58 * @param menu The {@link ContextMenu} that is being shown.
60 void onContextMenuShown(TabBase tab, ContextMenu menu);
62 // WebContentsDelegateAndroid methods ---------------------------------------------------------
65 * Called when the load progress of a {@link TabBase} changes.
66 * @param tab The notifying {@link TabBase}.
67 * @param progress The new progress from [0,100].
69 void onLoadProgressChanged(TabBase tab, int progress);
72 * Called when the URL of a {@link TabBase} changes.
73 * @param tab The notifying {@link TabBase}.
74 * @param url The new URL.
76 void onUpdateUrl(TabBase tab, String url);
79 * Called when the {@link TabBase} should enter or leave fullscreen mode.
80 * @param tab The notifying {@link TabBase}.
81 * @param enable Whether or not to enter fullscreen mode.
83 void onToggleFullscreenMode(TabBase tab, boolean enable);
85 // WebContentsObserverAndroid methods ---------------------------------------------------------
88 * Called when an error occurs while loading a page and/or the page fails to load.
89 * @param tab The notifying {@link TabBase}.
90 * @param isProvisionalLoad Whether the failed load occurred during the provisional load.
91 * @param isMainFrame Whether failed load happened for the main frame.
92 * @param errorCode Code for the occurring error.
93 * @param description The description for the error.
94 * @param failingUrl The url that was loading when the error occurred.
96 void onDidFailLoad(TabBase tab, boolean isProvisionalLoad, boolean isMainFrame, int errorCode,
97 String description, String failingUrl);