Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(53)

Side by Side Diff: extensions/common/manifest_handlers/nacl_modules_handler.cc

Issue 1908953003: Convert //extensions/{common,shell} from scoped_ptr to std::unique_ptr (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase? Created 4 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 "extensions/common/manifest_handlers/nacl_modules_handler.h" 5 #include "extensions/common/manifest_handlers/nacl_modules_handler.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 8
9 #include <memory>
10
9 #include "base/lazy_instance.h" 11 #include "base/lazy_instance.h"
10 #include "base/memory/scoped_ptr.h"
11 #include "base/strings/string_number_conversions.h" 12 #include "base/strings/string_number_conversions.h"
12 #include "base/strings/utf_string_conversions.h" 13 #include "base/strings/utf_string_conversions.h"
13 #include "base/values.h" 14 #include "base/values.h"
14 #include "extensions/common/error_utils.h" 15 #include "extensions/common/error_utils.h"
15 #include "extensions/common/manifest_constants.h" 16 #include "extensions/common/manifest_constants.h"
16 17
17 namespace extensions { 18 namespace extensions {
18 19
19 namespace keys = manifest_keys; 20 namespace keys = manifest_keys;
20 namespace errors = manifest_errors; 21 namespace errors = manifest_errors;
(...skipping 21 matching lines...) Expand all
42 NaClModulesHandler::~NaClModulesHandler() { 43 NaClModulesHandler::~NaClModulesHandler() {
43 } 44 }
44 45
45 bool NaClModulesHandler::Parse(Extension* extension, base::string16* error) { 46 bool NaClModulesHandler::Parse(Extension* extension, base::string16* error) {
46 const base::ListValue* list_value = NULL; 47 const base::ListValue* list_value = NULL;
47 if (!extension->manifest()->GetList(keys::kNaClModules, &list_value)) { 48 if (!extension->manifest()->GetList(keys::kNaClModules, &list_value)) {
48 *error = base::ASCIIToUTF16(errors::kInvalidNaClModules); 49 *error = base::ASCIIToUTF16(errors::kInvalidNaClModules);
49 return false; 50 return false;
50 } 51 }
51 52
52 scoped_ptr<NaClModuleData> nacl_module_data(new NaClModuleData); 53 std::unique_ptr<NaClModuleData> nacl_module_data(new NaClModuleData);
53 54
54 for (size_t i = 0; i < list_value->GetSize(); ++i) { 55 for (size_t i = 0; i < list_value->GetSize(); ++i) {
55 const base::DictionaryValue* module_value = NULL; 56 const base::DictionaryValue* module_value = NULL;
56 if (!list_value->GetDictionary(i, &module_value)) { 57 if (!list_value->GetDictionary(i, &module_value)) {
57 *error = base::ASCIIToUTF16(errors::kInvalidNaClModules); 58 *error = base::ASCIIToUTF16(errors::kInvalidNaClModules);
58 return false; 59 return false;
59 } 60 }
60 61
61 // Get nacl_modules[i].path. 62 // Get nacl_modules[i].path.
62 std::string path_str; 63 std::string path_str;
(...skipping 19 matching lines...) Expand all
82 83
83 extension->SetManifestData(keys::kNaClModules, nacl_module_data.release()); 84 extension->SetManifestData(keys::kNaClModules, nacl_module_data.release());
84 return true; 85 return true;
85 } 86 }
86 87
87 const std::vector<std::string> NaClModulesHandler::Keys() const { 88 const std::vector<std::string> NaClModulesHandler::Keys() const {
88 return SingleKey(keys::kNaClModules); 89 return SingleKey(keys::kNaClModules);
89 } 90 }
90 91
91 } // namespace extensions 92 } // namespace extensions
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698