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 |
6194 if (SendErrorIfModalDialogActive(this, reply_message)) | 6200 if (SendErrorIfModalDialogActive(this, reply_message)) |
6195 return; | 6201 return; |
6196 | 6202 |
6197 TabContents* tab_contents; | 6203 TabContents* tab_contents; |
6198 std::string error; | 6204 std::string error; |
6199 | 6205 |
6200 if (!GetTabFromJSONArgs(args, &tab_contents, &error)) { | 6206 if (!GetTabFromJSONArgs(args, &tab_contents, &error)) { |
6201 AutomationJSONReply(this, reply_message).SendError(error); | 6207 AutomationJSONReply(this, reply_message).SendError(error); |
6202 return; | 6208 return; |
6203 } | 6209 } |
6204 | 6210 |
6205 FilePath::StringType path_str; | 6211 FilePath::StringType path_str; |
6206 if (!args->GetString("path", &path_str)) { | 6212 if (!args->GetString("path", &path_str)) { |
6207 AutomationJSONReply(this, reply_message) | 6213 AutomationJSONReply(this, reply_message) |
6208 .SendError("'path' missing or invalid"); | 6214 .SendError("'path' missing or invalid"); |
6209 return; | 6215 return; |
6210 } | 6216 } |
6211 | 6217 |
6212 RenderViewHost* render_view = tab_contents->render_view_host(); | 6218 RenderViewHost* render_view = tab_contents->render_view_host(); |
6213 if (render_view) { | 6219 if (render_view) { |
6214 FilePath path(path_str); | 6220 FilePath path(path_str); |
6215 // This will delete itself when finished. | 6221 // This will delete itself when finished. |
6216 PageSnapshotTaker* snapshot_taker = new PageSnapshotTaker( | 6222 PageSnapshotTaker* snapshot_taker = new PageSnapshotTaker( |
6217 this, reply_message, | 6223 this, reply_message, render_view, path); |
6218 TabContentsWrapper::GetCurrentWrapperForContents(tab_contents), path); | |
6219 snapshot_taker->Start(); | 6224 snapshot_taker->Start(); |
6220 } else { | 6225 } else { |
6221 AutomationJSONReply(this, reply_message) | 6226 AutomationJSONReply(this, reply_message) |
6222 .SendError("Tab has no associated RenderViewHost"); | 6227 .SendError("Tab has no associated RenderViewHost"); |
6223 } | 6228 } |
6224 } | 6229 } |
6225 | 6230 |
6226 void TestingAutomationProvider::GetCookiesJSON( | 6231 void TestingAutomationProvider::GetCookiesJSON( |
6227 DictionaryValue* args, IPC::Message* reply_message) { | 6232 DictionaryValue* args, IPC::Message* reply_message) { |
6228 automation_util::GetCookiesJSON(this, args, reply_message); | 6233 automation_util::GetCookiesJSON(this, args, reply_message); |
(...skipping 299 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6528 | 6533 |
6529 Send(reply_message_); | 6534 Send(reply_message_); |
6530 redirect_query_ = 0; | 6535 redirect_query_ = 0; |
6531 reply_message_ = NULL; | 6536 reply_message_ = NULL; |
6532 } | 6537 } |
6533 | 6538 |
6534 void TestingAutomationProvider::OnRemoveProvider() { | 6539 void TestingAutomationProvider::OnRemoveProvider() { |
6535 if (g_browser_process) | 6540 if (g_browser_process) |
6536 g_browser_process->GetAutomationProviderList()->RemoveProvider(this); | 6541 g_browser_process->GetAutomationProviderList()->RemoveProvider(this); |
6537 } | 6542 } |
OLD | NEW |