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

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

Issue 65011: Flatten down to a single toolbar per window, significantly simplifying the ta... (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 11 years, 8 months 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
Property Changes:
Name: svn:eol-style
+ LF
OLDNEW
(Empty)
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #import <Cocoa/Cocoa.h>
6
7 #include "chrome/browser/command_updater.h"
8
9 @protocol CommandObserverProtocol;
10
11 // A C++ bridge class that handles listening for updates to commands and
12 // passing them back to an object that supports the protocol delcared below.
13 // The observer will create one of these bridges, call ObserveCommand() on the
14 // command ids it cares about, and then wait for update notifications,
15 // delivered via -enabledStateChangedForCommand:enabled:. Destroying this
16 // bridge will handle automatically unregistering for updates, so there's no
17 // need to do that manually.
18
19 class CommandObserverBridge : public CommandUpdater::CommandObserver {
20 public:
21 CommandObserverBridge(id<CommandObserverProtocol> observer,
22 CommandUpdater* commands);
23 virtual ~CommandObserverBridge();
24
25 // Register for updates about |command|.
26 void ObserveCommand(int command);
27
28 protected:
29 // Overridden from CommandUpdater::CommandObserver
30 virtual void EnabledStateChangedForCommand(int command, bool enabled);
31
32 private:
33 id<CommandObserverProtocol> observer_; // weak, owns me
34 CommandUpdater* commands_; // weak
35 };
36
37 // Implemented by the observing Objective-C object, called when there is a
38 // state change for the given command.
39 @protocol CommandObserverProtocol
40 - (void)enabledStateChangedForCommand:(NSInteger)command enabled:(BOOL)enabled;
41 @end
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698