OLD | NEW |
---|---|
(Empty) | |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | |
Mark Mentovai
2015/02/10 23:21:24
2015
stuartmorgan
2015/02/11 08:13:02
We're upstreaming existing files; I thought we wer
| |
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 BASE_IOS_CRB_PROTOCOL_OBSERVERS_H_ | |
6 #define BASE_IOS_CRB_PROTOCOL_OBSERVERS_H_ | |
7 | |
8 #import <Foundation/Foundation.h> | |
9 | |
10 typedef void (^ExecutionWithObserverBlock)(id); | |
11 | |
12 // Implements a container for observers that implement a specific Objective-C | |
13 // protocol. The container forwards method invocations to its contained | |
14 // observers, so that sending a message to all the observers is as simple as | |
15 // sending the message to the container. | |
16 @interface CRBProtocolObservers : NSObject | |
17 | |
18 // The Objective-C protocol that the observers in this container conform to. | |
19 @property(nonatomic, readonly) Protocol* protocol; | |
20 | |
21 // Returns a CRBProtocolObservers container for observers that conform to | |
22 // |protocol|. | |
23 + (CRBProtocolObservers*)observersWithProtocol:(Protocol*)protocol; | |
24 | |
25 // Adds |observer| to this container. | |
26 - (void)addObserver:(id)observer; | |
27 | |
28 // Remove |observer| from this container. | |
29 - (void)removeObserver:(id)observer; | |
30 | |
31 // Executes callback on every observer. |callback| cannot be nil. | |
32 - (void)executeOnObservers:(ExecutionWithObserverBlock)callback; | |
33 | |
34 @end | |
35 | |
36 #endif // BASE_IOS_CRB_PROTOCOL_OBSERVERS_H_ | |
OLD | NEW |