Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(533)

Unified Diff: chrome/browser/automation/testing_automation_provider.cc

Issue 5572001: Send screenshots back to the client for debugging (Closed) Base URL: http://git.chromium.org/git/chromium.git@trunk
Patch Set: changed PageSnapshotTaker to use JSON interface Created 9 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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);

Powered by Google App Engine
This is Rietveld 408576698