| 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 2124 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2135 BlockedContentTabHelper* blocked_content = | 2135 BlockedContentTabHelper* blocked_content = |
| 2136 tab_contents->blocked_content_tab_helper(); | 2136 tab_contents->blocked_content_tab_helper(); |
| 2137 *count = static_cast<int>(blocked_content->GetBlockedContentsCount()); | 2137 *count = static_cast<int>(blocked_content->GetBlockedContentsCount()); |
| 2138 } | 2138 } |
| 2139 } | 2139 } |
| 2140 } | 2140 } |
| 2141 | 2141 |
| 2142 void TestingAutomationProvider::SendJSONRequest(int handle, | 2142 void TestingAutomationProvider::SendJSONRequest(int handle, |
| 2143 const std::string& json_request, | 2143 const std::string& json_request, |
| 2144 IPC::Message* reply_message) { | 2144 IPC::Message* reply_message) { |
| 2145 scoped_ptr<Value> values; | |
| 2146 base::JSONReader reader; | |
| 2147 std::string error; | 2145 std::string error; |
| 2148 values.reset(reader.ReadAndReturnError(json_request, | 2146 scoped_ptr<Value> values(base::JSONReader::ReadAndReturnError(json_request, |
| 2149 base::JSON_ALLOW_TRAILING_COMMAS, NULL, &error)); | 2147 base::JSON_ALLOW_TRAILING_COMMAS, NULL, &error)); |
| 2150 if (!error.empty()) { | 2148 if (!error.empty()) { |
| 2151 AutomationJSONReply(this, reply_message).SendError(error); | 2149 AutomationJSONReply(this, reply_message).SendError(error); |
| 2152 return; | 2150 return; |
| 2153 } | 2151 } |
| 2154 | 2152 |
| 2155 // Make sure input is a dict with a string command. | 2153 // Make sure input is a dict with a string command. |
| 2156 std::string command; | 2154 std::string command; |
| 2157 DictionaryValue* dict_value = NULL; | 2155 DictionaryValue* dict_value = NULL; |
| 2158 if (values->GetType() != Value::TYPE_DICTIONARY) { | 2156 if (values->GetType() != Value::TYPE_DICTIONARY) { |
| (...skipping 4981 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 7140 *browser_handle = browser_tracker_->Add(browser); | 7138 *browser_handle = browser_tracker_->Add(browser); |
| 7141 *success = true; | 7139 *success = true; |
| 7142 } | 7140 } |
| 7143 } | 7141 } |
| 7144 } | 7142 } |
| 7145 | 7143 |
| 7146 void TestingAutomationProvider::OnRemoveProvider() { | 7144 void TestingAutomationProvider::OnRemoveProvider() { |
| 7147 if (g_browser_process) | 7145 if (g_browser_process) |
| 7148 g_browser_process->GetAutomationProviderList()->RemoveProvider(this); | 7146 g_browser_process->GetAutomationProviderList()->RemoveProvider(this); |
| 7149 } | 7147 } |
| OLD | NEW |