summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--chrome/browser/automation/automation_provider.cc10
-rw-r--r--chrome/browser/automation/automation_provider.h3
-rw-r--r--chrome/common/temp_scaffolding_stubs.cc4
-rw-r--r--chrome/test/automation/automation_messages_internal.h3
-rw-r--r--chrome/test/automation/tab_proxy.cc7
-rw-r--r--chrome/test/automation/tab_proxy.h3
6 files changed, 30 insertions, 0 deletions
diff --git a/chrome/browser/automation/automation_provider.cc b/chrome/browser/automation/automation_provider.cc
index f386960..49bd64f 100644
--- a/chrome/browser/automation/automation_provider.cc
+++ b/chrome/browser/automation/automation_provider.cc
@@ -1020,6 +1020,7 @@ void AutomationProvider::OnMessageReceived(const IPC::Message& message) {
IPC_MESSAGE_HANDLER(AutomationMsg_IsPageMenuCommandEnabled,
IsPageMenuCommandEnabled)
IPC_MESSAGE_HANDLER_DELAY_REPLY(AutomationMsg_PrintNow, PrintNow)
+ IPC_MESSAGE_HANDLER(AutomationMsg_PrintAsync, PrintAsync)
IPC_MESSAGE_HANDLER(AutomationMsg_SavePage, SavePage)
IPC_MESSAGE_HANDLER(AutomationMsg_AutocompleteEditGetText,
GetAutocompleteEditText)
@@ -2577,6 +2578,15 @@ void AutomationProvider::PrintNow(int tab_handle,
AutomationMsg_PrintNow::WriteReplyParams(reply_message, false);
Send(reply_message);
}
+
+void AutomationProvider::PrintAsync(int tab_handle) {
+ NavigationController* tab = NULL;
+ TabContents* tab_contents = GetTabContentsForHandle(tab_handle, &tab);
+ if (tab_contents) {
+ if (tab_contents->PrintNow())
+ return;
+ }
+}
#endif
void AutomationProvider::SavePage(int tab_handle,
diff --git a/chrome/browser/automation/automation_provider.h b/chrome/browser/automation/automation_provider.h
index 3d90d04..8c57e7a 100644
--- a/chrome/browser/automation/automation_provider.h
+++ b/chrome/browser/automation/automation_provider.h
@@ -357,6 +357,9 @@ class AutomationProvider : public base::RefCounted<AutomationProvider>,
// Prints the current tab immediately.
void PrintNow(int tab_handle, IPC::Message* reply_message);
+ // Asynchronous request for printing the current tab.
+ void PrintAsync(int tab_handle);
+
// Save the current web page.
void SavePage(int tab_handle,
const std::wstring& file_name,
diff --git a/chrome/common/temp_scaffolding_stubs.cc b/chrome/common/temp_scaffolding_stubs.cc
index b24fc9a..843517a 100644
--- a/chrome/common/temp_scaffolding_stubs.cc
+++ b/chrome/common/temp_scaffolding_stubs.cc
@@ -98,6 +98,10 @@ void AutomationProvider::PrintNow(int tab_handle,
NOTIMPLEMENTED();
}
+void AutomationProvider::PrintAsync(int tab_handle) {
+ NOTIMPLEMENTED();
+}
+
#if defined(OS_MACOSX)
void AutomationProvider::GetAutocompleteEditText(int autocomplete_edit_handle,
bool* success,
diff --git a/chrome/test/automation/automation_messages_internal.h b/chrome/test/automation/automation_messages_internal.h
index 1eac286..ac1b7deb 100644
--- a/chrome/test/automation/automation_messages_internal.h
+++ b/chrome/test/automation/automation_messages_internal.h
@@ -973,4 +973,7 @@ IPC_BEGIN_MESSAGES(Automation)
int /* request_id */,
URLRequestStatus /* status */)
+ IPC_MESSAGE_ROUTED1(AutomationMsg_PrintAsync,
+ int /* tab_handle */)
+
IPC_END_MESSAGES(Automation)
diff --git a/chrome/test/automation/tab_proxy.cc b/chrome/test/automation/tab_proxy.cc
index dea3a54..8d8ebf7 100644
--- a/chrome/test/automation/tab_proxy.cc
+++ b/chrome/test/automation/tab_proxy.cc
@@ -532,6 +532,13 @@ bool TabProxy::PrintNow() {
return succeeded;
}
+bool TabProxy::PrintAsync() {
+ if (!is_valid())
+ return false;
+
+ return sender_->Send(new AutomationMsg_PrintAsync(0, handle_));
+}
+
bool TabProxy::SavePage(const std::wstring& file_name,
const std::wstring& dir_path,
SavePackage::SavePackageType type) {
diff --git a/chrome/test/automation/tab_proxy.h b/chrome/test/automation/tab_proxy.h
index 0f7bcc5..200c5f9 100644
--- a/chrome/test/automation/tab_proxy.h
+++ b/chrome/test/automation/tab_proxy.h
@@ -250,6 +250,9 @@ class TabProxy : public AutomationResourceProxy {
// Prints the current page without user intervention.
bool PrintNow();
+ // Sends off an asynchronous request for printing.
+ bool PrintAsync();
+
// Save the current web page. |file_name| is the HTML file name, and
// |dir_path| is the directory for saving resource files. |type| indicates
// which type we're saving as: HTML only or the complete web page.