OLD | NEW |
1 // Copyright 2017 The Chromium Authors. All rights reserved. | 1 // Copyright 2017 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_SHARED_CHROME_BROWSER_UI_COMMANDS_COMMAND_DISPATCHER_H_ | 5 #ifndef IOS_SHARED_CHROME_BROWSER_UI_COMMANDS_COMMAND_DISPATCHER_H_ |
6 #define IOS_SHARED_CHROME_BROWSER_UI_COMMANDS_COMMAND_DISPATCHER_H_ | 6 #define IOS_SHARED_CHROME_BROWSER_UI_COMMANDS_COMMAND_DISPATCHER_H_ |
7 | 7 |
8 #import <Foundation/Foundation.h> | 8 #import <Foundation/Foundation.h> |
9 | 9 |
10 // CommandDispatcher allows coordinators to register as command handlers for | 10 // CommandDispatcher allows coordinators to register as command handlers for |
11 // specific selectors. Other objects can call these methods on the dispatcher, | 11 // specific selectors. Other objects can call these methods on the dispatcher, |
12 // which in turn will forward the call to the registered handler. | 12 // which in turn will forward the call to the registered handler. |
13 @interface CommandDispatcher : NSObject | 13 @interface CommandDispatcher : NSObject |
14 | 14 |
15 // Registers the given |target| to receive forwarded messages for the given | 15 // Registers the given |target| to receive forwarded messages for the given |
16 // |selector|. | 16 // |selector|. |
17 - (void)startDispatchingToTarget:(id)target forSelector:(SEL)selector; | 17 - (void)startDispatchingToTarget:(id)target forSelector:(SEL)selector; |
18 | 18 |
| 19 // Registers the given |target| to receive forwarded messages for the methods of |
| 20 // the given |protocol|. Only required instance methods are registered. The |
| 21 // other definitions in the protocol are ignored. |
| 22 - (void)startDispatchingToTarget:(id)target forProtocol:(Protocol*)protocol; |
| 23 |
19 // Removes forwarding registration for the given |selector|. | 24 // Removes forwarding registration for the given |selector|. |
20 - (void)stopDispatchingForSelector:(SEL)selector; | 25 - (void)stopDispatchingForSelector:(SEL)selector; |
21 | 26 |
| 27 // Removes forwarding registration for the given |selector|. Only dispatching to |
| 28 // required instance methods is removed. The other definitions in the protocol |
| 29 // are ignored. |
| 30 - (void)stopDispatchingForProtocol:(Protocol*)protocol; |
| 31 |
22 // Removes all forwarding registrations for the given |target|. | 32 // Removes all forwarding registrations for the given |target|. |
23 - (void)stopDispatchingToTarget:(id)target; | 33 - (void)stopDispatchingToTarget:(id)target; |
24 | 34 |
25 @end | 35 @end |
26 | 36 |
27 #endif // IOS_SHARED_CHROME_BROWSER_UI_COMMANDS_COMMAND_DISPATCHER_H_ | 37 #endif // IOS_SHARED_CHROME_BROWSER_UI_COMMANDS_COMMAND_DISPATCHER_H_ |
OLD | NEW |