summaryrefslogtreecommitdiffstats
path: root/chrome/browser/automation
diff options
context:
space:
mode:
authorben@chromium.org <ben@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-01-20 23:03:14 +0000
committerben@chromium.org <ben@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-01-20 23:03:14 +0000
commit1fc025209fbaeb2eb91cfeac8dbced8bc493f3b2 (patch)
tree13faf73a68138e0cd30e7b628a677ebb0422aa8c /chrome/browser/automation
parent91f57782b0dd7a847b8d31020003f00099366545 (diff)
downloadchromium_src-1fc025209fbaeb2eb91cfeac8dbced8bc493f3b2.zip
chromium_src-1fc025209fbaeb2eb91cfeac8dbced8bc493f3b2.tar.gz
chromium_src-1fc025209fbaeb2eb91cfeac8dbced8bc493f3b2.tar.bz2
Rework the command updater to not be dependent on views::Button (needed for porting).
TEST=make sure back/forward buttons still enable/disable correctly depending on the length of the back/forward navigation list. Review URL: http://codereview.chromium.org/18343 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@8332 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/automation')
-rw-r--r--chrome/browser/automation/automation_provider.cc20
-rw-r--r--chrome/browser/automation/automation_provider.h1
2 files changed, 11 insertions, 10 deletions
diff --git a/chrome/browser/automation/automation_provider.cc b/chrome/browser/automation/automation_provider.cc
index 36cec74..4d82ab1 100644
--- a/chrome/browser/automation/automation_provider.cc
+++ b/chrome/browser/automation/automation_provider.cc
@@ -922,7 +922,7 @@ void AutomationProvider::GoBack(const IPC::Message& message, int handle) {
if (tab_tracker_->ContainsHandle(handle)) {
NavigationController* tab = tab_tracker_->GetResource(handle);
Browser* browser = FindAndActivateTab(tab);
- if (browser && browser->IsCommandEnabled(IDC_BACK)) {
+ if (browser && browser->command_updater()->IsCommandEnabled(IDC_BACK)) {
AddNavigationStatusListener(tab,
new AutomationMsg_GoBackResponse(
message.routing_id(), AUTOMATION_MSG_NAVIGATION_SUCCESS),
@@ -940,7 +940,7 @@ void AutomationProvider::GoForward(const IPC::Message& message, int handle) {
if (tab_tracker_->ContainsHandle(handle)) {
NavigationController* tab = tab_tracker_->GetResource(handle);
Browser* browser = FindAndActivateTab(tab);
- if (browser && browser->IsCommandEnabled(IDC_FORWARD)) {
+ if (browser && browser->command_updater()->IsCommandEnabled(IDC_FORWARD)) {
AddNavigationStatusListener(tab,
new AutomationMsg_GoForwardResponse(
message.routing_id(), AUTOMATION_MSG_NAVIGATION_SUCCESS),
@@ -958,7 +958,7 @@ void AutomationProvider::Reload(const IPC::Message& message, int handle) {
if (tab_tracker_->ContainsHandle(handle)) {
NavigationController* tab = tab_tracker_->GetResource(handle);
Browser* browser = FindAndActivateTab(tab);
- if (browser && browser->IsCommandEnabled(IDC_RELOAD)) {
+ if (browser && browser->command_updater()->IsCommandEnabled(IDC_RELOAD)) {
AddNavigationStatusListener(tab,
new AutomationMsg_ReloadResponse(
message.routing_id(), AUTOMATION_MSG_NAVIGATION_SUCCESS),
@@ -1182,8 +1182,8 @@ void AutomationProvider::ExecuteBrowserCommand(const IPC::Message& message,
bool success = false;
if (browser_tracker_->ContainsHandle(handle)) {
Browser* browser = browser_tracker_->GetResource(handle);
- if (browser->SupportsCommand(command) &&
- browser->IsCommandEnabled(command)) {
+ if (browser->command_updater()->SupportsCommand(command) &&
+ browser->command_updater()->IsCommandEnabled(command)) {
browser->ExecuteCommand(command);
success = true;
}
@@ -1651,7 +1651,7 @@ void AutomationProvider::GetTabProcessID(
void AutomationProvider::ApplyAccelerator(int handle, int id) {
if (browser_tracker_->ContainsHandle(handle)) {
Browser* browser = browser_tracker_->GetResource(handle);
- browser->controller()->ExecuteCommand(id);
+ browser->ExecuteCommand(id);
}
}
@@ -2211,7 +2211,7 @@ void AutomationProvider::IsPageMenuCommandEnabled(const IPC::Message& message,
if (browser_tracker_->ContainsHandle(browser_handle)) {
Browser* browser = browser_tracker_->GetResource(browser_handle);
bool menu_item_enabled =
- browser->controller()->IsCommandEnabled(message_num);
+ browser->command_updater()->IsCommandEnabled(message_num);
Send(new AutomationMsg_IsPageMenuCommandEnabledResponse(
message.routing_id(), menu_item_enabled));
} else {
@@ -2246,7 +2246,7 @@ void AutomationProvider::SavePage(const IPC::Message& message,
NavigationController* nav = tab_tracker_->GetResource(tab_handle);
Browser* browser = FindAndActivateTab(nav);
DCHECK(browser);
- if (!browser->IsCommandEnabled(IDC_SAVE_PAGE)) {
+ if (!browser->command_updater()->IsCommandEnabled(IDC_SAVE_PAGE)) {
Send(new AutomationMsg_SavePageResponse(message.routing_id(), false));
return;
}
@@ -2547,7 +2547,7 @@ void AutomationProvider::GetPageCurrentEncoding(const IPC::Message& message,
Browser* browser = FindAndActivateTab(nav);
DCHECK(browser);
- if (browser->IsCommandEnabled(IDC_ENCODING_MENU)) {
+ if (browser->command_updater()->IsCommandEnabled(IDC_ENCODING_MENU)) {
TabContents* tab_contents = nav->active_contents();
DCHECK(tab_contents->type() == TAB_CONTENTS_WEB);
current_encoding = tab_contents->AsWebContents()->encoding();
@@ -2567,7 +2567,7 @@ void AutomationProvider::OverrideEncoding(const IPC::Message& message,
Browser* browser = FindAndActivateTab(nav);
DCHECK(browser);
- if (browser->IsCommandEnabled(IDC_ENCODING_MENU)) {
+ if (browser->command_updater()->IsCommandEnabled(IDC_ENCODING_MENU)) {
TabContents* tab_contents = nav->active_contents();
DCHECK(tab_contents->type() == TAB_CONTENTS_WEB);
int selected_encoding_id =
diff --git a/chrome/browser/automation/automation_provider.h b/chrome/browser/automation/automation_provider.h
index 5467b79..0022369 100644
--- a/chrome/browser/automation/automation_provider.h
+++ b/chrome/browser/automation/automation_provider.h
@@ -25,6 +25,7 @@
#include "chrome/common/ipc_channel_proxy.h"
#include "chrome/common/ipc_message.h"
#include "chrome/common/notification_service.h"
+#include "chrome/views/event.h"
class LoginHandler;
class NavigationControllerRestoredObserver;