OLD | NEW |
(Empty) | |
| 1 // Copyright (c) 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_UPGRADE_UPGRADE_CENTER_H_ |
| 6 #define IOS_CHROME_BROWSER_UPGRADE_UPGRADE_CENTER_H_ |
| 7 |
| 8 #import <UIKit/UIKit.h> |
| 9 |
| 10 #include "ios/chrome/browser/upgrade/upgrade_recommended_details.h" |
| 11 |
| 12 @class UpgradeCenter; |
| 13 |
| 14 namespace infobars { |
| 15 class InfoBarManager; |
| 16 } |
| 17 |
| 18 @protocol UpgradeCenterClientProtocol |
| 19 |
| 20 // This is expected to call -addInfoBarToHelper:forTabId: for each tab to place |
| 21 // the infobars in the UI. The client must not unregister itself while in this |
| 22 // method. |
| 23 - (void)showUpgrade:(UpgradeCenter*)center; |
| 24 |
| 25 @end |
| 26 |
| 27 @interface UpgradeCenter : NSObject |
| 28 |
| 29 // Returns the singleton instance of the class. |
| 30 + (UpgradeCenter*)sharedInstance; |
| 31 |
| 32 // Registers a client for the UpgradeCenter. The clients are not retained, |
| 33 // unregisterClient: must be called before the object goes away. |
| 34 - (void)registerClient:(id<UpgradeCenterClientProtocol>)client; |
| 35 |
| 36 // Unregisters a client. |
| 37 - (void)unregisterClient:(id<UpgradeCenterClientProtocol>)client; |
| 38 |
| 39 // Clients should call this method when -showUpgrade: is called or when a new |
| 40 // tab is created. The infobar will not be created if it already exists or if |
| 41 // there is no need to do so. |
| 42 - (void)addInfoBarToManager:(infobars::InfoBarManager*)infoBarManager |
| 43 forTabId:(NSString*)tabId; |
| 44 |
| 45 // For the UpgradeCenter to make the distinction between an infobar closed by |
| 46 // the user directly and an infobar dismissed because the Tab it is on is |
| 47 // removed. |
| 48 - (void)tabWillClose:(NSString*)tabId; |
| 49 |
| 50 // Called when a notification is received from one of the upgrade mechanism. |
| 51 - (void)upgradeNotificationDidOccur:(const UpgradeRecommendedDetails&)details; |
| 52 |
| 53 @end |
| 54 |
| 55 @interface UpgradeCenter (UsedForTests) |
| 56 // Reset everything (forget clients, remove the infobar everywhere...) |
| 57 - (void)resetForTests; |
| 58 // Simulate the minimum display interval having elapsed. |
| 59 - (void)setLastDisplayToPast; |
| 60 @end |
| 61 |
| 62 #endif // IOS_CHROME_BROWSER_UPGRADE_UPGRADE_CENTER_H_ |
OLD | NEW |