OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 CHROME_BROWSER_UI_COCOA_COMMAND_OBSERVER_BRIDGE | 5 #ifndef CHROME_BROWSER_UI_COCOA_COMMAND_OBSERVER_BRIDGE |
6 #define CHROME_BROWSER_UI_COCOA_COMMAND_OBSERVER_BRIDGE | 6 #define CHROME_BROWSER_UI_COCOA_COMMAND_OBSERVER_BRIDGE |
7 | 7 |
8 #import <Cocoa/Cocoa.h> | 8 #import <Cocoa/Cocoa.h> |
9 | 9 |
10 #include "base/compiler_specific.h" | 10 #include "base/compiler_specific.h" |
(...skipping 16 matching lines...) Expand all Loading... |
27 CommandObserverBridge(id<CommandObserverProtocol> observer, | 27 CommandObserverBridge(id<CommandObserverProtocol> observer, |
28 CommandUpdater* commands); | 28 CommandUpdater* commands); |
29 virtual ~CommandObserverBridge(); | 29 virtual ~CommandObserverBridge(); |
30 | 30 |
31 // Register for updates about |command|. | 31 // Register for updates about |command|. |
32 void ObserveCommand(int command); | 32 void ObserveCommand(int command); |
33 | 33 |
34 protected: | 34 protected: |
35 // Overridden from CommandObserver | 35 // Overridden from CommandObserver |
36 virtual void EnabledStateChangedForCommand(int command, | 36 virtual void EnabledStateChangedForCommand(int command, |
37 bool enabled) OVERRIDE; | 37 bool enabled) override; |
38 | 38 |
39 private: | 39 private: |
40 id<CommandObserverProtocol> observer_; // weak, owns me | 40 id<CommandObserverProtocol> observer_; // weak, owns me |
41 CommandUpdater* commands_; // weak | 41 CommandUpdater* commands_; // weak |
42 }; | 42 }; |
43 | 43 |
44 // Implemented by the observing Objective-C object, called when there is a | 44 // Implemented by the observing Objective-C object, called when there is a |
45 // state change for the given command. | 45 // state change for the given command. |
46 @protocol CommandObserverProtocol | 46 @protocol CommandObserverProtocol |
47 - (void)enabledStateChangedForCommand:(NSInteger)command enabled:(BOOL)enabled; | 47 - (void)enabledStateChangedForCommand:(NSInteger)command enabled:(BOOL)enabled; |
48 @end | 48 @end |
49 | 49 |
50 #endif // CHROME_BROWSER_UI_COCOA_COMMAND_OBSERVER_BRIDGE | 50 #endif // CHROME_BROWSER_UI_COCOA_COMMAND_OBSERVER_BRIDGE |
OLD | NEW |