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/extensions/api/autotest_private/autotest_private_api.h" | 5 #include "chrome/browser/extensions/api/autotest_private/autotest_private_api.h" |
6 | 6 |
7 #include <memory> | 7 #include <memory> |
8 #include <utility> | 8 #include <utility> |
9 | 9 |
10 #include "base/lazy_instance.h" | 10 #include "base/lazy_instance.h" |
(...skipping 155 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
166 ExtensionActionManager::Get(GetProfile()); | 166 ExtensionActionManager::Get(GetProfile()); |
167 | 167 |
168 base::ListValue* extensions_values = new base::ListValue; | 168 base::ListValue* extensions_values = new base::ListValue; |
169 ExtensionList all; | 169 ExtensionList all; |
170 all.insert(all.end(), extensions.begin(), extensions.end()); | 170 all.insert(all.end(), extensions.begin(), extensions.end()); |
171 all.insert(all.end(), disabled_extensions.begin(), disabled_extensions.end()); | 171 all.insert(all.end(), disabled_extensions.begin(), disabled_extensions.end()); |
172 for (ExtensionList::const_iterator it = all.begin(); | 172 for (ExtensionList::const_iterator it = all.begin(); |
173 it != all.end(); ++it) { | 173 it != all.end(); ++it) { |
174 const Extension* extension = it->get(); | 174 const Extension* extension = it->get(); |
175 std::string id = extension->id(); | 175 std::string id = extension->id(); |
176 base::DictionaryValue* extension_value = new base::DictionaryValue; | 176 std::unique_ptr<base::DictionaryValue> extension_value( |
| 177 new base::DictionaryValue); |
177 extension_value->SetString("id", id); | 178 extension_value->SetString("id", id); |
178 extension_value->SetString("version", extension->VersionString()); | 179 extension_value->SetString("version", extension->VersionString()); |
179 extension_value->SetString("name", extension->name()); | 180 extension_value->SetString("name", extension->name()); |
180 extension_value->SetString("publicKey", extension->public_key()); | 181 extension_value->SetString("publicKey", extension->public_key()); |
181 extension_value->SetString("description", extension->description()); | 182 extension_value->SetString("description", extension->description()); |
182 extension_value->SetString( | 183 extension_value->SetString( |
183 "backgroundUrl", BackgroundInfo::GetBackgroundURL(extension).spec()); | 184 "backgroundUrl", BackgroundInfo::GetBackgroundURL(extension).spec()); |
184 extension_value->SetString( | 185 extension_value->SetString( |
185 "optionsUrl", OptionsPageInfo::GetOptionsPage(extension).spec()); | 186 "optionsUrl", OptionsPageInfo::GetOptionsPage(extension).spec()); |
186 | 187 |
(...skipping 11 matching lines...) Expand all Loading... |
198 extension_value->SetBoolean("isUserInstalled", | 199 extension_value->SetBoolean("isUserInstalled", |
199 location == Manifest::INTERNAL || | 200 location == Manifest::INTERNAL || |
200 Manifest::IsUnpackedLocation(location)); | 201 Manifest::IsUnpackedLocation(location)); |
201 extension_value->SetBoolean("isEnabled", service->IsExtensionEnabled(id)); | 202 extension_value->SetBoolean("isEnabled", service->IsExtensionEnabled(id)); |
202 extension_value->SetBoolean("allowedInIncognito", | 203 extension_value->SetBoolean("allowedInIncognito", |
203 util::IsIncognitoEnabled(id, GetProfile())); | 204 util::IsIncognitoEnabled(id, GetProfile())); |
204 extension_value->SetBoolean( | 205 extension_value->SetBoolean( |
205 "hasPageAction", | 206 "hasPageAction", |
206 extension_action_manager->GetPageAction(*extension) != NULL); | 207 extension_action_manager->GetPageAction(*extension) != NULL); |
207 | 208 |
208 extensions_values->Append(extension_value); | 209 extensions_values->Append(std::move(extension_value)); |
209 } | 210 } |
210 | 211 |
211 std::unique_ptr<base::DictionaryValue> return_value( | 212 std::unique_ptr<base::DictionaryValue> return_value( |
212 new base::DictionaryValue); | 213 new base::DictionaryValue); |
213 return_value->Set("extensions", extensions_values); | 214 return_value->Set("extensions", extensions_values); |
214 SetResult(std::move(return_value)); | 215 SetResult(std::move(return_value)); |
215 return true; | 216 return true; |
216 } | 217 } |
217 | 218 |
218 static int AccessArray(const volatile int arr[], const volatile int *index) { | 219 static int AccessArray(const volatile int arr[], const volatile int *index) { |
(...skipping 168 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
387 return new AutotestPrivateAPI(); | 388 return new AutotestPrivateAPI(); |
388 } | 389 } |
389 | 390 |
390 AutotestPrivateAPI::AutotestPrivateAPI() : test_mode_(false) { | 391 AutotestPrivateAPI::AutotestPrivateAPI() : test_mode_(false) { |
391 } | 392 } |
392 | 393 |
393 AutotestPrivateAPI::~AutotestPrivateAPI() { | 394 AutotestPrivateAPI::~AutotestPrivateAPI() { |
394 } | 395 } |
395 | 396 |
396 } // namespace extensions | 397 } // namespace extensions |
OLD | NEW |