Index: ios/chrome/browser/upgrade/upgrade_center.h |
diff --git a/ios/chrome/browser/upgrade/upgrade_center.h b/ios/chrome/browser/upgrade/upgrade_center.h |
new file mode 100644 |
index 0000000000000000000000000000000000000000..915586ac2219b561f1a8652185d90be5c91a0851 |
--- /dev/null |
+++ b/ios/chrome/browser/upgrade/upgrade_center.h |
@@ -0,0 +1,62 @@ |
+// Copyright (c) 2012 The Chromium Authors. All rights reserved. |
+// Use of this source code is governed by a BSD-style license that can be |
+// found in the LICENSE file. |
+ |
+#ifndef IOS_CHROME_BROWSER_UPGRADE_UPGRADE_CENTER_H_ |
+#define IOS_CHROME_BROWSER_UPGRADE_UPGRADE_CENTER_H_ |
+ |
+#import <UIKit/UIKit.h> |
+ |
+#include "ios/chrome/browser/upgrade/upgrade_recommended_details.h" |
+ |
+@class UpgradeCenter; |
+ |
+namespace infobars { |
+class InfoBarManager; |
+} |
+ |
+@protocol UpgradeCenterClientProtocol |
+@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.
|
+// This is expected to call -addInfoBarToHelper:forTabId: for each tab to place |
+// the infobars in the UI. The client must not unregister itself while in this |
+// method. |
+- (void)showUpgrade:(UpgradeCenter*)center; |
+ |
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.
|
+@end |
+ |
+@interface UpgradeCenter : NSObject |
+ |
+// Returns the singleton instance of the class. |
++ (UpgradeCenter*)sharedInstance; |
+ |
+// 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.
|
+// unregisterClient: must be called before the object goes away. |
+- (void)registerClient:(id<UpgradeCenterClientProtocol>)client; |
+ |
+// Unregister a client. |
sdefresne
2016/12/14 11:50:56
nit: Unregisters?
rohitrao (ping after 24h)
2016/12/14 13:26:33
Done.
|
+- (void)unregisterClient:(id<UpgradeCenterClientProtocol>)client; |
+ |
+// For the client to call when -showUpgrade: is called or when a new tab is |
+// 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.
|
+// no need to do so. |
+- (void)addInfoBarToManager:(infobars::InfoBarManager*)infoBarManager |
+ forTabId:(NSString*)tabId; |
+ |
+// For the UpgradeCenter to make the distinction between an infobar closed by |
+// the user directly and an infobar dismissed because the Tab it is on is |
+// removed. |
+- (void)tabWillClose:(NSString*)tabId; |
+ |
+// Called when a notification is received from one of the upgrade mechanism. |
+- (void)upgradeNotificationDidOccur:(const UpgradeRecommendedDetails&)details; |
+ |
+@end |
+ |
+@interface UpgradeCenter (UsedForTests) |
+// Reset everything (forget clients, remove the infobar everywhere...) |
+- (void)resetForTests; |
+// Simulate the minimum display interval having elapsed. |
+- (void)setLastDisplayToPast; |
+@end |
+ |
+#endif // IOS_CHROME_BROWSER_UPGRADE_UPGRADE_CENTER_H_ |