summaryrefslogtreecommitdiffstats
path: root/ios/chrome/browser/installation_notifier.h
blob: 55f74d169580ee37391ce2572ab1bbfe5c1d131a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
// Copyright 2013 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_INSTALLATION_NOTIFIER_H_
#define IOS_CHROME_BROWSER_INSTALLATION_NOTIFIER_H_

#import <Foundation/Foundation.h>

class GURL;

// Protocol used to mock the delayed dispatching for the unit tests.
// Calls |block| after |delayInNSec|.
@protocol DispatcherProtocol<NSObject>
- (void)dispatchAfter:(int64_t)delayInNSec withBlock:(dispatch_block_t)block;
@end

@interface InstallationNotifier : NSObject
// Returns singleton instance.
+ (InstallationNotifier*)sharedInstance;

// Registers |observer| to be sent a notification named |scheme| when a URL
// with |scheme| can be opened. |observer| must not be nil. If |scheme| is nil
// or an empty string, |observer| is not registered for anything.
- (void)registerForInstallationNotifications:(id)observer
                                withSelector:(SEL)notificationSelector
                                   forScheme:(NSString*)scheme;

// Unregisters all the NSNotifications ever asked by |observer|.
- (void)unregisterForNotifications:(id)observer;

// Performs a check for installed apps right away and restarts the polling.
// There is usually no need for registered observers to call this method, unless
// registered observers need to know the accurate state of installed native
// apps.
- (void)checkNow;
@end

#endif  // IOS_CHROME_BROWSER_INSTALLATION_NOTIFIER_H_