| 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..0664542b930e689854a0b5d1196b06fa579e424a 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,37 @@ 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)
|
| + .SendError("Tab has no associated RenderViewHost");
|
| + }
|
| +}
|
| +
|
| void TestingAutomationProvider::GetCookiesJSON(
|
| DictionaryValue* args, IPC::Message* reply_message) {
|
| automation_util::GetCookiesJSON(this, args, reply_message);
|
|
|