Chromium Code Reviews| Index: chrome/browser/automation/testing_automation_provider.cc |
| diff --git a/chrome/browser/automation/testing_automation_provider.cc b/chrome/browser/automation/testing_automation_provider.cc |
| index 81c0294caf0e1cdef098d51834cff5f880624881..fdc74b42e288bdd4f92705863bf835dd464deaea 100644 |
| --- a/chrome/browser/automation/testing_automation_provider.cc |
| +++ b/chrome/browser/automation/testing_automation_provider.cc |
| @@ -9,6 +9,7 @@ |
| #include <vector> |
| #include "base/command_line.h" |
| +#include "base/file_path.h" |
| #include "base/json/json_reader.h" |
| #include "base/json/json_writer.h" |
| #include "base/json/string_escape.h" |
| @@ -2052,6 +2053,8 @@ void TestingAutomationProvider::SendJSONRequest(int handle, |
| &TestingAutomationProvider::GetTabURLJSON; |
| handler_map["GetTabTitle"] = |
| &TestingAutomationProvider::GetTabTitleJSON; |
| + handler_map["CaptureEntirePage"] = |
| + &TestingAutomationProvider::CaptureEntirePageJSON; |
| handler_map["GetCookies"] = |
| &TestingAutomationProvider::GetCookiesJSON; |
| handler_map["DeleteCookie"] = |
| @@ -4956,6 +4959,36 @@ void TestingAutomationProvider::GetTabTitleJSON( |
| reply.SendSuccess(&dict); |
| } |
| +void TestingAutomationProvider::CaptureEntirePageJSON( |
| + DictionaryValue* args, |
| + IPC::Message* reply_message) { |
| + TabContents* tab_contents; |
| + std::string error; |
| + |
| + if (!GetTabFromJSONArgs(args, &tab_contents, &error)) { |
| + AutomationJSONReply(this, reply_message).SendError(error); |
| + return; |
| + } |
| + |
| + FilePath::StringType path_str; |
| + if (!args->GetString("path", &path_str)) { |
| + AutomationJSONReply(this, reply_message) |
| + .SendError("'path' missing or invalid"); |
| + return; |
| + } |
| + |
| + RenderViewHost* render_view = tab_contents->render_view_host(); |
| + if (render_view) { |
| + FilePath path(path_str); |
| + // This will delete itself when finished. |
| + PageSnapshotTaker* snapshot_taker = new PageSnapshotTaker( |
| + this, reply_message, render_view, path); |
| + snapshot_taker->Start(); |
| + } else { |
| + AutomationJSONReply(this, reply_message).SendSuccess(NULL); |
|
kkania
2011/03/22 21:08:56
this should be SendError("Tab has no associated Re
Joe
2011/03/22 22:08:19
Done.
|
| + } |
| +} |
| + |
| void TestingAutomationProvider::GetCookiesJSON( |
| DictionaryValue* args, IPC::Message* reply_message) { |
| automation_util::GetCookiesJSON(this, args, reply_message); |