Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1567)

Side by Side Diff: chrome/browser/ui/cocoa/command_observer_bridge.h

Issue 8603006: Add OVERRIDE to chrome/browser/ui/cocoa/. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 9 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2009 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 #pragma once 7 #pragma once
8 8
9 #import <Cocoa/Cocoa.h> 9 #import <Cocoa/Cocoa.h>
10 10
11 #include "base/compiler_specific.h"
11 #include "chrome/browser/command_updater.h" 12 #include "chrome/browser/command_updater.h"
12 13
13 @protocol CommandObserverProtocol; 14 @protocol CommandObserverProtocol;
14 15
15 // A C++ bridge class that handles listening for updates to commands and 16 // A C++ bridge class that handles listening for updates to commands and
16 // passing them back to an object that supports the protocol delcared below. 17 // passing them back to an object that supports the protocol delcared below.
17 // The observer will create one of these bridges, call ObserveCommand() on the 18 // The observer will create one of these bridges, call ObserveCommand() on the
18 // command ids it cares about, and then wait for update notifications, 19 // command ids it cares about, and then wait for update notifications,
19 // delivered via -enabledStateChangedForCommand:enabled:. Destroying this 20 // delivered via -enabledStateChangedForCommand:enabled:. Destroying this
20 // bridge will handle automatically unregistering for updates, so there's no 21 // bridge will handle automatically unregistering for updates, so there's no
21 // need to do that manually. 22 // need to do that manually.
22 23
23 class CommandObserverBridge : public CommandUpdater::CommandObserver { 24 class CommandObserverBridge : public CommandUpdater::CommandObserver {
24 public: 25 public:
25 CommandObserverBridge(id<CommandObserverProtocol> observer, 26 CommandObserverBridge(id<CommandObserverProtocol> observer,
26 CommandUpdater* commands); 27 CommandUpdater* commands);
27 virtual ~CommandObserverBridge(); 28 virtual ~CommandObserverBridge();
28 29
29 // Register for updates about |command|. 30 // Register for updates about |command|.
30 void ObserveCommand(int command); 31 void ObserveCommand(int command);
31 32
32 protected: 33 protected:
33 // Overridden from CommandUpdater::CommandObserver 34 // Overridden from CommandUpdater::CommandObserver
34 virtual void EnabledStateChangedForCommand(int command, bool enabled); 35 virtual void EnabledStateChangedForCommand(int command,
36 bool enabled) OVERRIDE;
35 37
36 private: 38 private:
37 id<CommandObserverProtocol> observer_; // weak, owns me 39 id<CommandObserverProtocol> observer_; // weak, owns me
38 CommandUpdater* commands_; // weak 40 CommandUpdater* commands_; // weak
39 }; 41 };
40 42
41 // Implemented by the observing Objective-C object, called when there is a 43 // Implemented by the observing Objective-C object, called when there is a
42 // state change for the given command. 44 // state change for the given command.
43 @protocol CommandObserverProtocol 45 @protocol CommandObserverProtocol
44 - (void)enabledStateChangedForCommand:(NSInteger)command enabled:(BOOL)enabled; 46 - (void)enabledStateChangedForCommand:(NSInteger)command enabled:(BOOL)enabled;
45 @end 47 @end
46 48
47 #endif // CHROME_BROWSER_UI_COCOA_COMMAND_OBSERVER_BRIDGE 49 #endif // CHROME_BROWSER_UI_COCOA_COMMAND_OBSERVER_BRIDGE
OLDNEW
« no previous file with comments | « chrome/browser/ui/cocoa/cocoa_profile_test.h ('k') | chrome/browser/ui/cocoa/constrained_window_mac.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698