| 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/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 "base/values.h" | 9 #include "base/values.h" |
| 10 #include "chrome/browser/autocomplete/autocomplete_match.h" | 10 #include "chrome/browser/autocomplete/autocomplete_match.h" |
| (...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 146 if (!args->Get(key, &id_value)) { | 146 if (!args->Get(key, &id_value)) { |
| 147 *error = base::StringPrintf("Missing parameter '%s'", key.c_str()); | 147 *error = base::StringPrintf("Missing parameter '%s'", key.c_str()); |
| 148 return false; | 148 return false; |
| 149 } | 149 } |
| 150 return AutomationId::FromValue(id_value, id, error); | 150 return AutomationId::FromValue(id_value, id, error); |
| 151 } | 151 } |
| 152 | 152 |
| 153 bool GetRenderViewFromJSONArgs( | 153 bool GetRenderViewFromJSONArgs( |
| 154 DictionaryValue* args, | 154 DictionaryValue* args, |
| 155 Profile* profile, | 155 Profile* profile, |
| 156 RenderViewHost** rvh, | 156 content::RenderViewHost** rvh, |
| 157 std::string* error) { | 157 std::string* error) { |
| 158 Value* id_value; | 158 Value* id_value; |
| 159 if (args->Get("auto_id", &id_value)) { | 159 if (args->Get("auto_id", &id_value)) { |
| 160 AutomationId id; | 160 AutomationId id; |
| 161 if (!AutomationId::FromValue(id_value, &id, error)) | 161 if (!AutomationId::FromValue(id_value, &id, error)) |
| 162 return false; | 162 return false; |
| 163 if (!automation_util::GetRenderViewForId(id, profile, rvh)) { | 163 if (!automation_util::GetRenderViewForId(id, profile, rvh)) { |
| 164 *error = "ID does not correspond to an open view"; | 164 *error = "ID does not correspond to an open view"; |
| 165 return false; | 165 return false; |
| 166 } | 166 } |
| (...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 224 | 224 |
| 225 bool GetEnabledExtensionFromJSONArgs( | 225 bool GetEnabledExtensionFromJSONArgs( |
| 226 base::DictionaryValue* args, | 226 base::DictionaryValue* args, |
| 227 const std::string& key, | 227 const std::string& key, |
| 228 Profile* profile, | 228 Profile* profile, |
| 229 const Extension** extension, | 229 const Extension** extension, |
| 230 std::string* error) { | 230 std::string* error) { |
| 231 return GetExtensionFromJSONArgsHelper( | 231 return GetExtensionFromJSONArgsHelper( |
| 232 args, key, profile, false /* include_disabled */, extension, error); | 232 args, key, profile, false /* include_disabled */, extension, error); |
| 233 } | 233 } |
| OLD | NEW |