diff options
author | pinkerton@chromium.org <pinkerton@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-04-09 18:44:51 +0000 |
---|---|---|
committer | pinkerton@chromium.org <pinkerton@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-04-09 18:44:51 +0000 |
commit | 16e785bf7ae2d1910d38e0e5843acd4648d50b21 (patch) | |
tree | 083c57b51daa703772ada68ed65a19e616a59e4a /chrome/browser/cocoa/command_observer_bridge.h | |
parent | 95b9162bf10740841d7803bcb978b87f52bfea3e (diff) | |
download | chromium_src-16e785bf7ae2d1910d38e0e5843acd4648d50b21.zip chromium_src-16e785bf7ae2d1910d38e0e5843acd4648d50b21.tar.gz chromium_src-16e785bf7ae2d1910d38e0e5843acd4648d50b21.tar.bz2 |
Flatten down to a single toolbar per window, significantly simplifying the tab strip as it now no longer needs to forward messages for everything. Created a toolbar controller to encapsulate much of the toolbar logic that was in the tab contents controller. Better parameterized the tab strip controller so that it could switch any view, not just the main window's content view, when switching tabs.
Review URL: http://codereview.chromium.org/65011
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@13441 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/cocoa/command_observer_bridge.h')
-rw-r--r-- | chrome/browser/cocoa/command_observer_bridge.h | 41 |
1 files changed, 41 insertions, 0 deletions
diff --git a/chrome/browser/cocoa/command_observer_bridge.h b/chrome/browser/cocoa/command_observer_bridge.h new file mode 100644 index 0000000..042c0d1 --- /dev/null +++ b/chrome/browser/cocoa/command_observer_bridge.h @@ -0,0 +1,41 @@ +// Copyright (c) 2009 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#import <Cocoa/Cocoa.h> + +#include "chrome/browser/command_updater.h" + +@protocol CommandObserverProtocol; + +// A C++ bridge class that handles listening for updates to commands and +// passing them back to an object that supports the protocol delcared below. +// The observer will create one of these bridges, call ObserveCommand() on the +// command ids it cares about, and then wait for update notifications, +// delivered via -enabledStateChangedForCommand:enabled:. Destroying this +// bridge will handle automatically unregistering for updates, so there's no +// need to do that manually. + +class CommandObserverBridge : public CommandUpdater::CommandObserver { + public: + CommandObserverBridge(id<CommandObserverProtocol> observer, + CommandUpdater* commands); + virtual ~CommandObserverBridge(); + + // Register for updates about |command|. + void ObserveCommand(int command); + + protected: + // Overridden from CommandUpdater::CommandObserver + virtual void EnabledStateChangedForCommand(int command, bool enabled); + + private: + id<CommandObserverProtocol> observer_; // weak, owns me + CommandUpdater* commands_; // weak +}; + +// Implemented by the observing Objective-C object, called when there is a +// state change for the given command. +@protocol CommandObserverProtocol +- (void)enabledStateChangedForCommand:(NSInteger)command enabled:(BOOL)enabled; +@end |