blob: c967cc520595f5967438db292f290d3498aa0211 [file] [log] [blame]
Torne (Richard Coles)424c4d72013-08-30 15:14:49 +01001// 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.
4
5package org.chromium.chrome.browser;
6
7/**
8 * An observer that is notified of changes to a {@link TabBase} object.
9 */
10public interface TabObserver {
11
12 /**
Torne (Richard Coles)4e180b62013-10-18 15:46:22 +010013 * Called when a {@link TabBase} is being destroyed.
14 * @param tab The notifying {@link TabBase}.
15 */
16 void onDestroyed(TabBase tab);
17
18 /**
19 * Called when the tab content changes (to/from native pages or swapping native WebContents).
20 * @param tab The notifying {@link TabBase}.
21 */
22 void onContentChanged(TabBase tab);
23
24 /**
25 * Called when the favicon of a {@link TabBase} has been updated.
26 * @param tab The notifying {@link TabBase}.
27 */
28 void onFaviconUpdated(TabBase tab);
29
30 // WebContentsDelegateAndroid methods ---------------------------------------------------------
31
32 /**
Torne (Richard Coles)424c4d72013-08-30 15:14:49 +010033 * Called when the load progress of a {@link TabBase} changes.
34 * @param tab The notifying {@link TabBase}.
35 * @param progress The new progress from [0,100].
36 */
Torne (Richard Coles)4e180b62013-10-18 15:46:22 +010037 void onLoadProgressChanged(TabBase tab, int progress);
Torne (Richard Coles)424c4d72013-08-30 15:14:49 +010038
39 /**
40 * Called when the URL of a {@link TabBase} changes.
41 * @param tab The notifying {@link TabBase}.
42 * @param url The new URL.
43 */
Torne (Richard Coles)4e180b62013-10-18 15:46:22 +010044 void onUpdateUrl(TabBase tab, String url);
Torne (Richard Coles)424c4d72013-08-30 15:14:49 +010045
46 /**
Torne (Richard Coles)4e180b62013-10-18 15:46:22 +010047 * Called when the {@link TabBase} should enter or leave fullscreen mode.
48 * @param tab The notifying {@link TabBase}.
49 * @param enable Whether or not to enter fullscreen mode.
Torne (Richard Coles)424c4d72013-08-30 15:14:49 +010050 */
Torne (Richard Coles)4e180b62013-10-18 15:46:22 +010051 void onToggleFullscreenMode(TabBase tab, boolean enable);
52
53 // WebContentsObserverAndroid methods ---------------------------------------------------------
Torne (Richard Coles)424c4d72013-08-30 15:14:49 +010054
55 /**
Torne (Richard Coles)4e180b62013-10-18 15:46:22 +010056 * Called when an error occurs while loading a page and/or the page fails to load.
57 * @param tab The notifying {@link TabBase}.
58 * @param isProvisionalLoad Whether the failed load occurred during the provisional load.
59 * @param isMainFrame Whether failed load happened for the main frame.
60 * @param errorCode Code for the occurring error.
61 * @param description The description for the error.
62 * @param failingUrl The url that was loading when the error occurred.
Torne (Richard Coles)424c4d72013-08-30 15:14:49 +010063 */
Torne (Richard Coles)4e180b62013-10-18 15:46:22 +010064 void onDidFailLoad(TabBase tab, boolean isProvisionalLoad, boolean isMainFrame, int errorCode,
65 String description, String failingUrl);
Torne (Richard Coles)424c4d72013-08-30 15:14:49 +010066}