Torne (Richard Coles) | 424c4d7 | 2013-08-30 15:14:49 +0100 | [diff] [blame] | 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. |
| 4 | |
| 5 | package org.chromium.chrome.browser; |
| 6 | |
| 7 | /** |
| 8 | * An observer that is notified of changes to a {@link TabBase} object. |
| 9 | */ |
| 10 | public interface TabObserver { |
| 11 | |
| 12 | /** |
Torne (Richard Coles) | 4e180b6 | 2013-10-18 15:46:22 +0100 | [diff] [blame^] | 13 | * 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) | 424c4d7 | 2013-08-30 15:14:49 +0100 | [diff] [blame] | 33 | * 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) | 4e180b6 | 2013-10-18 15:46:22 +0100 | [diff] [blame^] | 37 | void onLoadProgressChanged(TabBase tab, int progress); |
Torne (Richard Coles) | 424c4d7 | 2013-08-30 15:14:49 +0100 | [diff] [blame] | 38 | |
| 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) | 4e180b6 | 2013-10-18 15:46:22 +0100 | [diff] [blame^] | 44 | void onUpdateUrl(TabBase tab, String url); |
Torne (Richard Coles) | 424c4d7 | 2013-08-30 15:14:49 +0100 | [diff] [blame] | 45 | |
| 46 | /** |
Torne (Richard Coles) | 4e180b6 | 2013-10-18 15:46:22 +0100 | [diff] [blame^] | 47 | * 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) | 424c4d7 | 2013-08-30 15:14:49 +0100 | [diff] [blame] | 50 | */ |
Torne (Richard Coles) | 4e180b6 | 2013-10-18 15:46:22 +0100 | [diff] [blame^] | 51 | void onToggleFullscreenMode(TabBase tab, boolean enable); |
| 52 | |
| 53 | // WebContentsObserverAndroid methods --------------------------------------------------------- |
Torne (Richard Coles) | 424c4d7 | 2013-08-30 15:14:49 +0100 | [diff] [blame] | 54 | |
| 55 | /** |
Torne (Richard Coles) | 4e180b6 | 2013-10-18 15:46:22 +0100 | [diff] [blame^] | 56 | * 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) | 424c4d7 | 2013-08-30 15:14:49 +0100 | [diff] [blame] | 63 | */ |
Torne (Richard Coles) | 4e180b6 | 2013-10-18 15:46:22 +0100 | [diff] [blame^] | 64 | void onDidFailLoad(TabBase tab, boolean isProvisionalLoad, boolean isMainFrame, int errorCode, |
| 65 | String description, String failingUrl); |
Torne (Richard Coles) | 424c4d7 | 2013-08-30 15:14:49 +0100 | [diff] [blame] | 66 | } |