OLD | NEW |
(Empty) | |
| 1 // Copyright 2012 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 #ifndef IOS_CHROME_BROWSER_TABS_TAB_MODEL_OBSERVER_H_ |
| 6 #define IOS_CHROME_BROWSER_TABS_TAB_MODEL_OBSERVER_H_ |
| 7 |
| 8 #import <Foundation/Foundation.h> |
| 9 |
| 10 @class Tab; |
| 11 @class TabModel; |
| 12 |
| 13 // Observers implement these methods to be alerted to changes in the model. |
| 14 // These methods are all optional. |
| 15 @protocol TabModelObserver<NSObject> |
| 16 @optional |
| 17 |
| 18 // A tab was inserted at the given index. |
| 19 - (void)tabModel:(TabModel*)model |
| 20 didInsertTab:(Tab*)tab |
| 21 atIndex:(NSUInteger)index |
| 22 inForeground:(BOOL)fg; |
| 23 |
| 24 // The given tab will be removed. |
| 25 - (void)tabModel:(TabModel*)model willRemoveTab:(Tab*)tab; |
| 26 |
| 27 // A tab was removed at the given index. |
| 28 - (void)tabModel:(TabModel*)model |
| 29 didRemoveTab:(Tab*)tab |
| 30 atIndex:(NSUInteger)index; |
| 31 |
| 32 // A tab was moved to the given index. |fromIndex| is guaranteed to be |
| 33 // different than |toIndex| (moves to the same index do not trigger |
| 34 // notifications). This method is only called for moves that change the |
| 35 // relative order of tabs (for example, closing the first tab decrements all tab |
| 36 // indexes by one, but will not call this observer method). |
| 37 - (void)tabModel:(TabModel*)model |
| 38 didMoveTab:(Tab*)tab |
| 39 fromIndex:(NSUInteger)fromIndex |
| 40 toIndex:(NSUInteger)toIndex; |
| 41 |
| 42 // A Tab was replaced in the model, at the given index. |
| 43 - (void)tabModel:(TabModel*)model |
| 44 didReplaceTab:(Tab*)oldTab |
| 45 withTab:(Tab*)newTab |
| 46 atIndex:(NSUInteger)index; |
| 47 |
| 48 // A tab was activated. |
| 49 - (void)tabModel:(TabModel*)model |
| 50 didChangeActiveTab:(Tab*)newTab |
| 51 previousTab:(Tab*)previousTab |
| 52 atIndex:(NSUInteger)index; |
| 53 |
| 54 // The number of Tabs in this TabModel changed. |
| 55 - (void)tabModelDidChangeTabCount:(TabModel*)model; |
| 56 |
| 57 // Some properties about the given tab changed, such as the URL or title. |
| 58 - (void)tabModel:(TabModel*)model didChangeTab:(Tab*)tab; |
| 59 |
| 60 // The |tab|'s snapshot was changed to |image|. |
| 61 - (void)tabModel:(TabModel*)model |
| 62 didChangeTabSnapshot:(Tab*)tab |
| 63 withImage:image; |
| 64 |
| 65 @end |
| 66 |
| 67 #endif // IOS_CHROME_BROWSER_TABS_TAB_MODEL_OBSERVER_H_ |
OLD | NEW |