OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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/automation_provider_json.h" | 5 #include "chrome/browser/automation/automation_provider_json.h" |
6 | 6 |
7 #include "base/json/json_writer.h" | 7 #include "base/json/json_writer.h" |
8 #include "base/json/string_escape.h" | 8 #include "base/json/string_escape.h" |
| 9 #include "chrome/browser/automation/automation_provider.h" |
9 #include "chrome/test/automation/automation_messages.h" | 10 #include "chrome/test/automation/automation_messages.h" |
10 | 11 |
11 namespace { | 12 namespace { |
12 | 13 |
13 // Util for creating a JSON error return string (dict with key | 14 // Util for creating a JSON error return string (dict with key |
14 // 'error' and error string value). No need to quote input. | 15 // 'error' and error string value). No need to quote input. |
15 std::string JSONErrorString(const std::string& err) { | 16 std::string JSONErrorString(const std::string& err) { |
16 std::string prefix = "{\"error\": \""; | 17 std::string prefix = "{\"error\": \""; |
17 std::string no_quote_err; | 18 std::string no_quote_err; |
18 std::string suffix = "\"}"; | 19 std::string suffix = "\"}"; |
(...skipping 27 matching lines...) Expand all Loading... |
46 | 47 |
47 void AutomationJSONReply::SendError(const std::string& error_message) { | 48 void AutomationJSONReply::SendError(const std::string& error_message) { |
48 DCHECK(message_) << "Resending reply for JSON automation request"; | 49 DCHECK(message_) << "Resending reply for JSON automation request"; |
49 std::string json_string = JSONErrorString(error_message); | 50 std::string json_string = JSONErrorString(error_message); |
50 AutomationMsg_SendJSONRequest::WriteReplyParams( | 51 AutomationMsg_SendJSONRequest::WriteReplyParams( |
51 message_, json_string, false); | 52 message_, json_string, false); |
52 provider_->Send(message_); | 53 provider_->Send(message_); |
53 message_ = NULL; | 54 message_ = NULL; |
54 } | 55 } |
55 | 56 |
OLD | NEW |