OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 2180 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2191 } | 2191 } |
2192 } | 2192 } |
2193 } | 2193 } |
2194 | 2194 |
2195 void TestingAutomationProvider::SendJSONRequest(int handle, | 2195 void TestingAutomationProvider::SendJSONRequest(int handle, |
2196 const std::string& json_request, | 2196 const std::string& json_request, |
2197 IPC::Message* reply_message) { | 2197 IPC::Message* reply_message) { |
2198 scoped_ptr<Value> values; | 2198 scoped_ptr<Value> values; |
2199 base::JSONReader reader; | 2199 base::JSONReader reader; |
2200 std::string error; | 2200 std::string error; |
2201 values.reset(reader.ReadAndReturnError(json_request, true, NULL, &error)); | 2201 values.reset(reader.ReadAndReturnError(json_request, |
| 2202 base::JSON_ALLOW_TRAILING_COMMAS, NULL, &error)); |
2202 if (!error.empty()) { | 2203 if (!error.empty()) { |
2203 AutomationJSONReply(this, reply_message).SendError(error); | 2204 AutomationJSONReply(this, reply_message).SendError(error); |
2204 return; | 2205 return; |
2205 } | 2206 } |
2206 | 2207 |
2207 // Make sure input is a dict with a string command. | 2208 // Make sure input is a dict with a string command. |
2208 std::string command; | 2209 std::string command; |
2209 DictionaryValue* dict_value = NULL; | 2210 DictionaryValue* dict_value = NULL; |
2210 if (values->GetType() != Value::TYPE_DICTIONARY) { | 2211 if (values->GetType() != Value::TYPE_DICTIONARY) { |
2211 AutomationJSONReply(this, reply_message).SendError("not a dict"); | 2212 AutomationJSONReply(this, reply_message).SendError("not a dict"); |
(...skipping 4840 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
7052 *browser_handle = browser_tracker_->Add(browser); | 7053 *browser_handle = browser_tracker_->Add(browser); |
7053 *success = true; | 7054 *success = true; |
7054 } | 7055 } |
7055 } | 7056 } |
7056 } | 7057 } |
7057 | 7058 |
7058 void TestingAutomationProvider::OnRemoveProvider() { | 7059 void TestingAutomationProvider::OnRemoveProvider() { |
7059 if (g_browser_process) | 7060 if (g_browser_process) |
7060 g_browser_process->GetAutomationProviderList()->RemoveProvider(this); | 7061 g_browser_process->GetAutomationProviderList()->RemoveProvider(this); |
7061 } | 7062 } |
OLD | NEW |