summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorananta@chromium.org <ananta@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-02-04 23:10:00 +0000
committerananta@chromium.org <ananta@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-02-04 23:10:00 +0000
commit673fd2c0970496cf45b4724510590c9bc2c313bc (patch)
treef7782e423be391ab2377c9bb2019e107a191ecfb
parentccd22a77a320bb0fc414a97d758fc002f40a907e (diff)
downloadchromium_src-673fd2c0970496cf45b4724510590c9bc2c313bc.zip
chromium_src-673fd2c0970496cf45b4724510590c9bc2c313bc.tar.gz
chromium_src-673fd2c0970496cf45b4724510590c9bc2c313bc.tar.bz2
Add support for the IE File->Save As command. This eventually ends up in Chrome via the new automation
message AutomationMsg_SaveAsAsync. Rest of the changes are to plumb this message across from IE to Chrome. Fixes bug http://code.google.com/p/chromium/issues/detail?id=24039 Bug=24039 Test=Launch IE with OptinUrls set to *. Navigate to google.com and select File->Save As. The dialog should popup. Review URL: http://codereview.chromium.org/563025 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@38145 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r--chrome/browser/automation/automation_provider.cc9
-rw-r--r--chrome/browser/automation/automation_provider.h1
-rw-r--r--chrome/browser/automation/chrome_frame_automation_provider.cc3
-rw-r--r--chrome/test/automation/automation_messages_internal.h3
-rw-r--r--chrome/test/automation/tab_proxy.cc4
-rw-r--r--chrome/test/automation/tab_proxy.h5
-rw-r--r--chrome_frame/chrome_active_document.cc1
-rw-r--r--chrome_frame/chrome_active_document.h1
8 files changed, 24 insertions, 3 deletions
diff --git a/chrome/browser/automation/automation_provider.cc b/chrome/browser/automation/automation_provider.cc
index a0c3d3c..9a02f04 100644
--- a/chrome/browser/automation/automation_provider.cc
+++ b/chrome/browser/automation/automation_provider.cc
@@ -462,6 +462,7 @@ void AutomationProvider::OnMessageReceived(const IPC::Message& message) {
LoadExpandedExtension)
IPC_MESSAGE_HANDLER(AutomationMsg_ShutdownSessionService,
ShutdownSessionService)
+ IPC_MESSAGE_HANDLER(AutomationMsg_SaveAsAsync, SaveAsAsync)
IPC_END_MESSAGE_MAP()
}
@@ -2236,3 +2237,11 @@ void AutomationProvider::LoadExpandedExtension(
Send(reply_message);
}
}
+
+void AutomationProvider::SaveAsAsync(int tab_handle) {
+ NavigationController* tab = NULL;
+ TabContents* tab_contents = GetTabContentsForHandle(tab_handle, &tab);
+ if (tab_contents)
+ tab_contents->OnSavePage();
+}
+
diff --git a/chrome/browser/automation/automation_provider.h b/chrome/browser/automation/automation_provider.h
index 08df2e2..de371f8 100644
--- a/chrome/browser/automation/automation_provider.h
+++ b/chrome/browser/automation/automation_provider.h
@@ -488,6 +488,7 @@ class AutomationProvider : public base::RefCounted<AutomationProvider>,
void ReloadAsync(int tab_handle);
void StopAsync(int tab_handle);
+ void SaveAsAsync(int tab_handle);
void WaitForBrowserWindowCountToBecome(int target_count,
IPC::Message* reply_message);
diff --git a/chrome/browser/automation/chrome_frame_automation_provider.cc b/chrome/browser/automation/chrome_frame_automation_provider.cc
index 08b5d5c..f9e82f7 100644
--- a/chrome/browser/automation/chrome_frame_automation_provider.cc
+++ b/chrome/browser/automation/chrome_frame_automation_provider.cc
@@ -59,7 +59,8 @@ bool ChromeFrameAutomationProvider::IsValidMessage(uint32 type) {
case AutomationMsg_HandleMessageFromExternalHost::ID:
case AutomationMsg_RequestStarted::ID:
case AutomationMsg_RequestData::ID:
- case AutomationMsg_RequestEnd::ID: {
+ case AutomationMsg_RequestEnd::ID:
+ case AutomationMsg_SaveAsAsync::ID: {
is_valid_message = true;
break;
}
diff --git a/chrome/test/automation/automation_messages_internal.h b/chrome/test/automation/automation_messages_internal.h
index 2103646..a3f4945 100644
--- a/chrome/test/automation/automation_messages_internal.h
+++ b/chrome/test/automation/automation_messages_internal.h
@@ -1189,4 +1189,7 @@ IPC_BEGIN_MESSAGES(Automation)
int /* browser_handle */,
bool /* result */)
+ IPC_MESSAGE_ROUTED1(AutomationMsg_SaveAsAsync,
+ int /* tab handle */)
+
IPC_END_MESSAGES(Automation)
diff --git a/chrome/test/automation/tab_proxy.cc b/chrome/test/automation/tab_proxy.cc
index 1b9b62d..ccef84a 100644
--- a/chrome/test/automation/tab_proxy.cc
+++ b/chrome/test/automation/tab_proxy.cc
@@ -734,6 +734,10 @@ void TabProxy::StopAsync() {
sender_->Send(new AutomationMsg_StopAsync(0, handle_));
}
+void TabProxy::SaveAsAsync() {
+ sender_->Send(new AutomationMsg_SaveAsAsync(0, handle_));
+}
+
void TabProxy::AddObserver(TabProxyDelegate* observer) {
AutoLock lock(list_lock_);
observers_list_.AddObserver(observer);
diff --git a/chrome/test/automation/tab_proxy.h b/chrome/test/automation/tab_proxy.h
index b811b70..d8055fa 100644
--- a/chrome/test/automation/tab_proxy.h
+++ b/chrome/test/automation/tab_proxy.h
@@ -370,10 +370,11 @@ class TabProxy : public AutomationResourceProxy {
void Copy();
void Paste();
- // These handlers issue asynchronous Reload and Stop notifications to the
- // chrome instance.
+ // These handlers issue asynchronous Reload, Stop and SaveAs notifications to
+ // the chrome instance.
void ReloadAsync();
void StopAsync();
+ void SaveAsAsync();
// Calls delegates
void AddObserver(TabProxyDelegate* observer);
diff --git a/chrome_frame/chrome_active_document.cc b/chrome_frame/chrome_active_document.cc
index 091f0ba..e212b9c 100644
--- a/chrome_frame/chrome_active_document.cc
+++ b/chrome_frame/chrome_active_document.cc
@@ -94,6 +94,7 @@ HRESULT ChromeActiveDocument::FinalConstruct() {
enabled_commands_map_[OLECMDID_COPY] = true;
enabled_commands_map_[OLECMDID_PASTE] = true;
enabled_commands_map_[OLECMDID_SELECTALL] = true;
+ enabled_commands_map_[OLECMDID_SAVEAS] = true;
return S_OK;
}
diff --git a/chrome_frame/chrome_active_document.h b/chrome_frame/chrome_active_document.h
index eed38e7..f2b26d6 100644
--- a/chrome_frame/chrome_active_document.h
+++ b/chrome_frame/chrome_active_document.h
@@ -162,6 +162,7 @@ BEGIN_EXEC_COMMAND_MAP(ChromeActiveDocument)
FORWARD_TAB_COMMAND(OLECMDID_PASTE, Paste)
FORWARD_TAB_COMMAND(OLECMDID_REFRESH, ReloadAsync)
FORWARD_TAB_COMMAND(OLECMDID_STOP, StopAsync)
+ FORWARD_TAB_COMMAND(OLECMDID_SAVEAS, SaveAsAsync)
EXEC_COMMAND_HANDLER(SBCMDID_MIXEDZONE, OnDetermineSecurityZone)
EXEC_COMMAND_HANDLER(IDM_BASELINEFONT1, SetPageFontSize)
EXEC_COMMAND_HANDLER(IDM_BASELINEFONT2, SetPageFontSize)