Chromium Code Reviews| 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 @required | |
|
sdefresne
2016/12/14 11:50:56
nit: @required is the default, please remove
rohitrao (ping after 24h)
2016/12/14 13:26:33
Done.
| |
| 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 | |
|
sdefresne
2016/12/14 11:50:56
nit: remove blank line
rohitrao (ping after 24h)
2016/12/14 13:26:33
Added a blank line above instead.
| |
| 25 @end | |
| 26 | |
| 27 @interface UpgradeCenter : NSObject | |
| 28 | |
| 29 // Returns the singleton instance of the class. | |
| 30 + (UpgradeCenter*)sharedInstance; | |
| 31 | |
| 32 // Register a client for the UpgradeCenter. The clients are not retained, | |
|
sdefresne
2016/12/14 11:50:56
nit: Registers?
rohitrao (ping after 24h)
2016/12/14 13:26:33
Done.
| |
| 33 // unregisterClient: must be called before the object goes away. | |
| 34 - (void)registerClient:(id<UpgradeCenterClientProtocol>)client; | |
| 35 | |
| 36 // Unregister a client. | |
|
sdefresne
2016/12/14 11:50:56
nit: Unregisters?
rohitrao (ping after 24h)
2016/12/14 13:26:33
Done.
| |
| 37 - (void)unregisterClient:(id<UpgradeCenterClientProtocol>)client; | |
| 38 | |
| 39 // For the client to call when -showUpgrade: is called or when a new tab is | |
| 40 // created. The infobar will not be created if is already there or if there is | |
|
sdefresne
2016/12/14 11:50:56
nit: "if is" -> "if it is"
rohitrao (ping after 24h)
2016/12/14 13:26:33
Done.
| |
| 41 // 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 |