| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "chrome/browser/automation/testing_automation_provider.h" | 5 #include "chrome/browser/automation/testing_automation_provider.h" |
| 6 | 6 |
| 7 #include <map> | 7 #include <map> |
| 8 #include <set> | 8 #include <set> |
| 9 #include <string> | 9 #include <string> |
| 10 #include <vector> | 10 #include <vector> |
| (...skipping 6173 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6184 return; | 6184 return; |
| 6185 } | 6185 } |
| 6186 DictionaryValue dict; | 6186 DictionaryValue dict; |
| 6187 dict.SetString("title", tab_contents->GetTitle()); | 6187 dict.SetString("title", tab_contents->GetTitle()); |
| 6188 reply.SendSuccess(&dict); | 6188 reply.SendSuccess(&dict); |
| 6189 } | 6189 } |
| 6190 | 6190 |
| 6191 void TestingAutomationProvider::CaptureEntirePageJSON( | 6191 void TestingAutomationProvider::CaptureEntirePageJSON( |
| 6192 DictionaryValue* args, | 6192 DictionaryValue* args, |
| 6193 IPC::Message* reply_message) { | 6193 IPC::Message* reply_message) { |
| 6194 #if defined(OS_LINUX) | |
| 6195 // See crbug.com/89777. | |
| 6196 AutomationJSONReply(this, reply_message).SendError( | |
| 6197 "Taking a page snapshot is not supported on this platform"); | |
| 6198 return; | |
| 6199 #endif | |
| 6200 if (SendErrorIfModalDialogActive(this, reply_message)) | 6194 if (SendErrorIfModalDialogActive(this, reply_message)) |
| 6201 return; | 6195 return; |
| 6202 | 6196 |
| 6203 TabContents* tab_contents; | 6197 TabContents* tab_contents; |
| 6204 std::string error; | 6198 std::string error; |
| 6205 | 6199 |
| 6206 if (!GetTabFromJSONArgs(args, &tab_contents, &error)) { | 6200 if (!GetTabFromJSONArgs(args, &tab_contents, &error)) { |
| 6207 AutomationJSONReply(this, reply_message).SendError(error); | 6201 AutomationJSONReply(this, reply_message).SendError(error); |
| 6208 return; | 6202 return; |
| 6209 } | 6203 } |
| 6210 | 6204 |
| 6211 FilePath::StringType path_str; | 6205 FilePath::StringType path_str; |
| 6212 if (!args->GetString("path", &path_str)) { | 6206 if (!args->GetString("path", &path_str)) { |
| 6213 AutomationJSONReply(this, reply_message) | 6207 AutomationJSONReply(this, reply_message) |
| 6214 .SendError("'path' missing or invalid"); | 6208 .SendError("'path' missing or invalid"); |
| 6215 return; | 6209 return; |
| 6216 } | 6210 } |
| 6217 | 6211 |
| 6218 RenderViewHost* render_view = tab_contents->render_view_host(); | 6212 RenderViewHost* render_view = tab_contents->render_view_host(); |
| 6219 if (render_view) { | 6213 if (render_view) { |
| 6220 FilePath path(path_str); | 6214 FilePath path(path_str); |
| 6221 // This will delete itself when finished. | 6215 // This will delete itself when finished. |
| 6222 PageSnapshotTaker* snapshot_taker = new PageSnapshotTaker( | 6216 PageSnapshotTaker* snapshot_taker = new PageSnapshotTaker( |
| 6223 this, reply_message, render_view, path); | 6217 this, reply_message, |
| 6218 TabContentsWrapper::GetCurrentWrapperForContents(tab_contents), path); |
| 6224 snapshot_taker->Start(); | 6219 snapshot_taker->Start(); |
| 6225 } else { | 6220 } else { |
| 6226 AutomationJSONReply(this, reply_message) | 6221 AutomationJSONReply(this, reply_message) |
| 6227 .SendError("Tab has no associated RenderViewHost"); | 6222 .SendError("Tab has no associated RenderViewHost"); |
| 6228 } | 6223 } |
| 6229 } | 6224 } |
| 6230 | 6225 |
| 6231 void TestingAutomationProvider::GetCookiesJSON( | 6226 void TestingAutomationProvider::GetCookiesJSON( |
| 6232 DictionaryValue* args, IPC::Message* reply_message) { | 6227 DictionaryValue* args, IPC::Message* reply_message) { |
| 6233 automation_util::GetCookiesJSON(this, args, reply_message); | 6228 automation_util::GetCookiesJSON(this, args, reply_message); |
| (...skipping 299 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6533 | 6528 |
| 6534 Send(reply_message_); | 6529 Send(reply_message_); |
| 6535 redirect_query_ = 0; | 6530 redirect_query_ = 0; |
| 6536 reply_message_ = NULL; | 6531 reply_message_ = NULL; |
| 6537 } | 6532 } |
| 6538 | 6533 |
| 6539 void TestingAutomationProvider::OnRemoveProvider() { | 6534 void TestingAutomationProvider::OnRemoveProvider() { |
| 6540 if (g_browser_process) | 6535 if (g_browser_process) |
| 6541 g_browser_process->GetAutomationProviderList()->RemoveProvider(this); | 6536 g_browser_process->GetAutomationProviderList()->RemoveProvider(this); |
| 6542 } | 6537 } |
| OLD | NEW |