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 3f44dbf845d378f3d33f5215a9e4a8507018c6d0..8bf6b778cb5284ca73b795df888639fbf233e7a8 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["GetScreenShot"] = |
|
kkania
2011/03/17 18:35:11
change this
Joe
2011/03/18 00:33:32
Done.
|
| + &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) |
|
kkania
2011/03/17 18:35:11
space after comma
Joe
2011/03/18 00:33:32
Done.
kkania
2011/03/18 19:18:22
hmm, for some reason there are now two spaces afte
|
| + .SendError("Could not get render view for tab handle"); |
| + AutomationMsg_CaptureEntirePageAsPNG::WriteReplyParams(reply_message, |
|
kkania
2011/03/17 18:35:11
remove this and the following Send. We are already
Joe
2011/03/18 00:33:32
Is there any documentation with instructions on ho
kkania
2011/03/18 19:18:22
you can take a look at what Nirnimesh wrote a whil
|
| + false); |
| + Send(reply_message); |
| + } |
| +} |
| + |
| void TestingAutomationProvider::GetCookiesJSON( |
| DictionaryValue* args, IPC::Message* reply_message) { |
| automation_util::GetCookiesJSON(this, args, reply_message); |