diff options
author | pinkerton@chromium.org <pinkerton@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-02-06 22:37:13 +0000 |
---|---|---|
committer | pinkerton@chromium.org <pinkerton@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-02-06 22:37:13 +0000 |
commit | a80edd4bf4e8f692fd02a7108a490d7921cc53b9 (patch) | |
tree | e54342b341a164b52068565e935f2e44f5c5e85c /chrome/browser/command_updater.cc | |
parent | 6b25d6342d294b0e9d53a87c469c2968b8ef338e (diff) | |
download | chromium_src-a80edd4bf4e8f692fd02a7108a490d7921cc53b9.zip chromium_src-a80edd4bf4e8f692fd02a7108a490d7921cc53b9.tar.gz chromium_src-a80edd4bf4e8f692fd02a7108a490d7921cc53b9.tar.bz2 |
Add a method to CommandUpdater to remove an observer from all commands at once.
Review URL: http://codereview.chromium.org/21140
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@9350 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/command_updater.cc')
-rw-r--r-- | chrome/browser/command_updater.cc | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/chrome/browser/command_updater.cc b/chrome/browser/command_updater.cc index 8839965..db34bbd 100644 --- a/chrome/browser/command_updater.cc +++ b/chrome/browser/command_updater.cc @@ -59,3 +59,13 @@ void CommandUpdater::AddCommandObserver(int id, CommandObserver* observer) { void CommandUpdater::RemoveCommandObserver(int id, CommandObserver* observer) { GetCommand(id, false)->observers.RemoveObserver(observer); } + +void CommandUpdater::RemoveCommandObserver(CommandObserver* observer) { + for (CommandMap::const_iterator it = commands_.begin(); + it != commands_.end(); + ++it) { + Command* command = it->second; + if (command) + command->observers.RemoveObserver(observer); + } +} |