| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef IOS_CHROME_BROWSER_INSTALLATION_NOTIFIER_H_ | 5 #ifndef IOS_CHROME_BROWSER_INSTALLATION_NOTIFIER_H_ |
| 6 #define IOS_CHROME_BROWSER_INSTALLATION_NOTIFIER_H_ | 6 #define IOS_CHROME_BROWSER_INSTALLATION_NOTIFIER_H_ |
| 7 | 7 |
| 8 #import <Foundation/Foundation.h> | 8 #import <Foundation/Foundation.h> |
| 9 #include <stdint.h> | 9 #include <stdint.h> |
| 10 | 10 |
| 11 class GURL; | |
| 12 | |
| 13 // Protocol used to mock the delayed dispatching for the unit tests. | 11 // Protocol used to mock the delayed dispatching for the unit tests. |
| 14 // Calls |block| after |delayInNSec|. | 12 // Calls |block| after |delayInNSec|. |
| 15 @protocol DispatcherProtocol<NSObject> | 13 @protocol DispatcherProtocol<NSObject> |
| 16 - (void)dispatchAfter:(int64_t)delayInNSec withBlock:(dispatch_block_t)block; | 14 - (void)dispatchAfter:(int64_t)delayInNSec withBlock:(dispatch_block_t)block; |
| 17 @end | 15 @end |
| 18 | 16 |
| 19 @interface InstallationNotifier : NSObject | 17 @interface InstallationNotifier : NSObject |
| 20 // Returns singleton instance. | 18 // Returns singleton instance. |
| 21 + (InstallationNotifier*)sharedInstance; | 19 + (InstallationNotifier*)sharedInstance; |
| 22 | 20 |
| 23 // Registers |observer| to be sent a notification named |scheme| when a URL | 21 // Registers |observer| to be sent a notification named |scheme| when a URL |
| 24 // with |scheme| can be opened. |observer| must not be nil. If |scheme| is nil | 22 // with |scheme| can be opened. |observer| must not be nil. If |scheme| is nil |
| 25 // or an empty string, |observer| is not registered for anything. | 23 // or an empty string, |observer| is not registered for anything. |
| 26 - (void)registerForInstallationNotifications:(id)observer | 24 - (void)registerForInstallationNotifications:(id)observer |
| 27 withSelector:(SEL)notificationSelector | 25 withSelector:(SEL)notificationSelector |
| 28 forScheme:(NSString*)scheme; | 26 forScheme:(NSString*)scheme; |
| 29 | 27 |
| 30 // Unregisters all the NSNotifications ever asked by |observer|. | 28 // Unregisters all the NSNotifications ever asked by |observer|. |
| 31 - (void)unregisterForNotifications:(id)observer; | 29 - (void)unregisterForNotifications:(id)observer; |
| 32 | 30 |
| 33 // Performs a check for installed apps right away and restarts the polling. | 31 // Performs a check for installed apps right away and restarts the polling. |
| 34 // There is usually no need for registered observers to call this method, unless | 32 // There is usually no need for registered observers to call this method, unless |
| 35 // registered observers need to know the accurate state of installed native | 33 // registered observers need to know the accurate state of installed native |
| 36 // apps. | 34 // apps. |
| 37 - (void)checkNow; | 35 - (void)checkNow; |
| 38 @end | 36 @end |
| 39 | 37 |
| 40 #endif // IOS_CHROME_BROWSER_INSTALLATION_NOTIFIER_H_ | 38 #endif // IOS_CHROME_BROWSER_INSTALLATION_NOTIFIER_H_ |
| OLD | NEW |