| 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" |
| 11 #include "chrome/browser/automation/automation_provider.h" | 11 #include "chrome/browser/automation/automation_provider.h" |
| 12 #include "chrome/browser/automation/automation_util.h" | 12 #include "chrome/browser/automation/automation_util.h" |
| 13 #include "chrome/browser/extensions/extension_service.h" | 13 #include "chrome/browser/extensions/extension_service.h" |
| 14 #include "chrome/browser/extensions/extension_system.h" |
| 14 #include "chrome/browser/profiles/profile.h" | 15 #include "chrome/browser/profiles/profile.h" |
| 15 #include "chrome/common/automation_id.h" | 16 #include "chrome/common/automation_id.h" |
| 16 #include "chrome/common/automation_messages.h" | 17 #include "chrome/common/automation_messages.h" |
| 17 #include "chrome/common/extensions/extension.h" | 18 #include "chrome/common/extensions/extension.h" |
| 18 #include "content/public/browser/web_contents.h" | 19 #include "content/public/browser/web_contents.h" |
| 19 | 20 |
| 20 using automation::Error; | 21 using automation::Error; |
| 21 using automation::ErrorCode; | 22 using automation::ErrorCode; |
| 22 using content::WebContents; | 23 using content::WebContents; |
| 23 | 24 |
| (...skipping 158 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 182 const std::string& key, | 183 const std::string& key, |
| 183 Profile* profile, | 184 Profile* profile, |
| 184 bool include_disabled, | 185 bool include_disabled, |
| 185 const extensions::Extension** extension, | 186 const extensions::Extension** extension, |
| 186 std::string* error) { | 187 std::string* error) { |
| 187 std::string id; | 188 std::string id; |
| 188 if (!args->GetString(key, &id)) { | 189 if (!args->GetString(key, &id)) { |
| 189 *error = base::StringPrintf("Missing or invalid key: %s", key.c_str()); | 190 *error = base::StringPrintf("Missing or invalid key: %s", key.c_str()); |
| 190 return false; | 191 return false; |
| 191 } | 192 } |
| 192 ExtensionService* service = profile->GetExtensionService(); | 193 ExtensionService* service = extensions::ExtensionSystem::Get(profile)-> |
| 194 extension_service(); |
| 193 if (!service) { | 195 if (!service) { |
| 194 *error = "No extensions service."; | 196 *error = "No extensions service."; |
| 195 return false; | 197 return false; |
| 196 } | 198 } |
| 197 if (!service->GetInstalledExtension(id)) { | 199 if (!service->GetInstalledExtension(id)) { |
| 198 // The extension ID does not correspond to any extension, whether crashed | 200 // The extension ID does not correspond to any extension, whether crashed |
| 199 // or not. | 201 // or not. |
| 200 *error = base::StringPrintf("Extension %s is not installed.", | 202 *error = base::StringPrintf("Extension %s is not installed.", |
| 201 id.c_str()); | 203 id.c_str()); |
| 202 return false; | 204 return false; |
| (...skipping 22 matching lines...) Expand all Loading... |
| 225 | 227 |
| 226 bool GetEnabledExtensionFromJSONArgs( | 228 bool GetEnabledExtensionFromJSONArgs( |
| 227 base::DictionaryValue* args, | 229 base::DictionaryValue* args, |
| 228 const std::string& key, | 230 const std::string& key, |
| 229 Profile* profile, | 231 Profile* profile, |
| 230 const extensions::Extension** extension, | 232 const extensions::Extension** extension, |
| 231 std::string* error) { | 233 std::string* error) { |
| 232 return GetExtensionFromJSONArgsHelper( | 234 return GetExtensionFromJSONArgsHelper( |
| 233 args, key, profile, false /* include_disabled */, extension, error); | 235 args, key, profile, false /* include_disabled */, extension, error); |
| 234 } | 236 } |
| OLD | NEW |