| 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 6168 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6179 return; | 6179 return; |
| 6180 } | 6180 } |
| 6181 DictionaryValue dict; | 6181 DictionaryValue dict; |
| 6182 dict.SetString("title", tab_contents->GetTitle()); | 6182 dict.SetString("title", tab_contents->GetTitle()); |
| 6183 reply.SendSuccess(&dict); | 6183 reply.SendSuccess(&dict); |
| 6184 } | 6184 } |
| 6185 | 6185 |
| 6186 void TestingAutomationProvider::CaptureEntirePageJSON( | 6186 void TestingAutomationProvider::CaptureEntirePageJSON( |
| 6187 DictionaryValue* args, | 6187 DictionaryValue* args, |
| 6188 IPC::Message* reply_message) { | 6188 IPC::Message* reply_message) { |
| 6189 #if defined(OS_LINUX) | |
| 6190 // See crbug.com/89777. | |
| 6191 AutomationJSONReply(this, reply_message).SendError( | |
| 6192 "Taking a page snapshot is not supported on this platform"); | |
| 6193 return; | |
| 6194 #endif | |
| 6195 if (SendErrorIfModalDialogActive(this, reply_message)) | 6189 if (SendErrorIfModalDialogActive(this, reply_message)) |
| 6196 return; | 6190 return; |
| 6197 | 6191 |
| 6198 TabContents* tab_contents; | 6192 TabContents* tab_contents; |
| 6199 std::string error; | 6193 std::string error; |
| 6200 | 6194 |
| 6201 if (!GetTabFromJSONArgs(args, &tab_contents, &error)) { | 6195 if (!GetTabFromJSONArgs(args, &tab_contents, &error)) { |
| 6202 AutomationJSONReply(this, reply_message).SendError(error); | 6196 AutomationJSONReply(this, reply_message).SendError(error); |
| 6203 return; | 6197 return; |
| 6204 } | 6198 } |
| 6205 | 6199 |
| 6206 FilePath::StringType path_str; | 6200 FilePath::StringType path_str; |
| 6207 if (!args->GetString("path", &path_str)) { | 6201 if (!args->GetString("path", &path_str)) { |
| 6208 AutomationJSONReply(this, reply_message) | 6202 AutomationJSONReply(this, reply_message) |
| 6209 .SendError("'path' missing or invalid"); | 6203 .SendError("'path' missing or invalid"); |
| 6210 return; | 6204 return; |
| 6211 } | 6205 } |
| 6212 | 6206 |
| 6213 RenderViewHost* render_view = tab_contents->render_view_host(); | 6207 RenderViewHost* render_view = tab_contents->render_view_host(); |
| 6214 if (render_view) { | 6208 if (render_view) { |
| 6215 FilePath path(path_str); | 6209 FilePath path(path_str); |
| 6216 // This will delete itself when finished. | 6210 // This will delete itself when finished. |
| 6217 PageSnapshotTaker* snapshot_taker = new PageSnapshotTaker( | 6211 PageSnapshotTaker* snapshot_taker = new PageSnapshotTaker( |
| 6218 this, reply_message, render_view, path); | 6212 this, reply_message, |
| 6213 TabContentsWrapper::GetCurrentWrapperForContents(tab_contents), path); |
| 6219 snapshot_taker->Start(); | 6214 snapshot_taker->Start(); |
| 6220 } else { | 6215 } else { |
| 6221 AutomationJSONReply(this, reply_message) | 6216 AutomationJSONReply(this, reply_message) |
| 6222 .SendError("Tab has no associated RenderViewHost"); | 6217 .SendError("Tab has no associated RenderViewHost"); |
| 6223 } | 6218 } |
| 6224 } | 6219 } |
| 6225 | 6220 |
| 6226 void TestingAutomationProvider::GetCookiesJSON( | 6221 void TestingAutomationProvider::GetCookiesJSON( |
| 6227 DictionaryValue* args, IPC::Message* reply_message) { | 6222 DictionaryValue* args, IPC::Message* reply_message) { |
| 6228 automation_util::GetCookiesJSON(this, args, reply_message); | 6223 automation_util::GetCookiesJSON(this, args, reply_message); |
| (...skipping 299 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6528 | 6523 |
| 6529 Send(reply_message_); | 6524 Send(reply_message_); |
| 6530 redirect_query_ = 0; | 6525 redirect_query_ = 0; |
| 6531 reply_message_ = NULL; | 6526 reply_message_ = NULL; |
| 6532 } | 6527 } |
| 6533 | 6528 |
| 6534 void TestingAutomationProvider::OnRemoveProvider() { | 6529 void TestingAutomationProvider::OnRemoveProvider() { |
| 6535 if (g_browser_process) | 6530 if (g_browser_process) |
| 6536 g_browser_process->GetAutomationProviderList()->RemoveProvider(this); | 6531 g_browser_process->GetAutomationProviderList()->RemoveProvider(this); |
| 6537 } | 6532 } |
| OLD | NEW |