diff options
author | ben@chromium.org <ben@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-06-27 22:57:40 +0000 |
---|---|---|
committer | ben@chromium.org <ben@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-06-27 22:57:40 +0000 |
commit | 5d9829491fa187db0fbbecb7f1e139d8367dcc16 (patch) | |
tree | 641f14f9285abae645efbb67da4cb378736f4e22 /chrome/browser/command_updater.cc | |
parent | b61a5d8a9a3eb306079743e73f592a6ac6c8c8b3 (diff) | |
download | chromium_src-5d9829491fa187db0fbbecb7f1e139d8367dcc16.zip chromium_src-5d9829491fa187db0fbbecb7f1e139d8367dcc16.tar.gz chromium_src-5d9829491fa187db0fbbecb7f1e139d8367dcc16.tar.bz2 |
Moves command handling from Browser to a new object, BrowserCommandController.
Notes:
. BrowserCommandController now owns the CommandUpdater.
. CommandHandler's ExecuteCommand API was massaged a little so that ExecuteCommand/IsCommandEnabled/SupportsCommand methods are always called on it, rather than the wrapping controller.
. The creation of BCC was performed as a svn cp so that history for the various Exec methods could be easily carried forward.
. Various "CanFoo" methods were extracted from the UpdateFooState() methods and moved to CanFoo(const Browser* browser) in browser_commands.
http://crbug.com/133576
TEST=none
Review URL: https://chromiumcodereview.appspot.com/10677009
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@144597 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/command_updater.cc')
-rw-r--r-- | chrome/browser/command_updater.cc | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/chrome/browser/command_updater.cc b/chrome/browser/command_updater.cc index 3642db4..a92b8cb 100644 --- a/chrome/browser/command_updater.cc +++ b/chrome/browser/command_updater.cc @@ -9,6 +9,7 @@ #include "base/logging.h" #include "base/observer_list.h" #include "base/stl_util.h" +#include "chrome/browser/command_observer.h" CommandUpdater::CommandUpdaterDelegate::~CommandUpdaterDelegate() { } @@ -40,18 +41,21 @@ bool CommandUpdater::SupportsCommand(int id) const { return commands_.find(id) != commands_.end(); } -void CommandUpdater::ExecuteCommand(int id) { - ExecuteCommandWithDisposition(id, CURRENT_TAB); +bool CommandUpdater::ExecuteCommand(int id) { + return ExecuteCommandWithDisposition(id, CURRENT_TAB); } -void CommandUpdater::ExecuteCommandWithDisposition( +bool CommandUpdater::ExecuteCommandWithDisposition( int id, WindowOpenDisposition disposition) { - if (IsCommandEnabled(id)) + if (SupportsCommand(id) && IsCommandEnabled(id)) { delegate_->ExecuteCommandWithDisposition(id, disposition); + return true; + } + return false; } -CommandUpdater::CommandObserver::~CommandObserver() { +CommandObserver::~CommandObserver() { } void CommandUpdater::UpdateCommandEnabled(int id, bool enabled) { |