| 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 3f44dbf845d378f3d33f5215a9e4a8507018c6d0..e24484369082847057ddb270109fca962c7287ab 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"
|
| @@ -1993,7 +1994,7 @@ void TestingAutomationProvider::CaptureEntirePageAsPNG(
|
| if (render_view) {
|
| // This will delete itself when finished.
|
| PageSnapshotTaker* snapshot_taker = new PageSnapshotTaker(
|
| - this, reply_message, render_view, path);
|
| + this, reply_message, render_view, path, false);
|
| snapshot_taker->Start();
|
| } else {
|
| LOG(ERROR) << "Could not get render view for tab handle";
|
| @@ -2050,6 +2051,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"] =
|
| @@ -4954,6 +4957,40 @@ 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, true);
|
| + snapshot_taker->Start();
|
| + } else {
|
| + AutomationJSONReply(this, reply_message)
|
| + .SendError("Could not get render view for tab handle");
|
| + AutomationMsg_CaptureEntirePageAsPNG::WriteReplyParams(reply_message,
|
| + false);
|
| + Send(reply_message);
|
| + }
|
| +}
|
| +
|
| void TestingAutomationProvider::GetCookiesJSON(
|
| DictionaryValue* args, IPC::Message* reply_message) {
|
| automation_util::GetCookiesJSON(this, args, reply_message);
|
|
|