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

Side by Side Diff: extensions/common/permissions/manifest_permission_set.cc

Issue 598173003: Run clang-modernize -use-nullptr over src/extensions/. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 2 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 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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/permissions/manifest_permission_set.h" 5 #include "extensions/common/permissions/manifest_permission_set.h"
6 6
7 #include "base/logging.h" 7 #include "base/logging.h"
8 #include "base/strings/string_number_conversions.h" 8 #include "base/strings/string_number_conversions.h"
9 #include "base/values.h" 9 #include "base/values.h"
10 #include "extensions/common/error_utils.h" 10 #include "extensions/common/error_utils.h"
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
57 namespace extensions { 57 namespace extensions {
58 58
59 // static 59 // static
60 bool ManifestPermissionSet::ParseFromJSON( 60 bool ManifestPermissionSet::ParseFromJSON(
61 const base::ListValue* permissions, 61 const base::ListValue* permissions,
62 ManifestPermissionSet* manifest_permissions, 62 ManifestPermissionSet* manifest_permissions,
63 base::string16* error, 63 base::string16* error,
64 std::vector<std::string>* unhandled_permissions) { 64 std::vector<std::string>* unhandled_permissions) {
65 for (size_t i = 0; i < permissions->GetSize(); ++i) { 65 for (size_t i = 0; i < permissions->GetSize(); ++i) {
66 std::string permission_name; 66 std::string permission_name;
67 const base::Value* permission_value = NULL; 67 const base::Value* permission_value = nullptr;
68 if (!permissions->GetString(i, &permission_name)) { 68 if (!permissions->GetString(i, &permission_name)) {
69 const base::DictionaryValue* dict = NULL; 69 const base::DictionaryValue* dict = nullptr;
70 // permission should be a string or a single key dict. 70 // permission should be a string or a single key dict.
71 if (!permissions->GetDictionary(i, &dict) || dict->size() != 1) { 71 if (!permissions->GetDictionary(i, &dict) || dict->size() != 1) {
72 if (error) { 72 if (error) {
73 *error = ErrorUtils::FormatErrorMessageUTF16( 73 *error = ErrorUtils::FormatErrorMessageUTF16(
74 errors::kInvalidPermission, base::IntToString(i)); 74 errors::kInvalidPermission, base::IntToString(i));
75 return false; 75 return false;
76 } 76 }
77 LOG(WARNING) << "Permission is not a string or single key dict."; 77 LOG(WARNING) << "Permission is not a string or single key dict.";
78 continue; 78 continue;
79 } 79 }
80 base::DictionaryValue::Iterator it(*dict); 80 base::DictionaryValue::Iterator it(*dict);
81 permission_name = it.key(); 81 permission_name = it.key();
82 permission_value = &it.value(); 82 permission_value = &it.value();
83 } 83 }
84 84
85 if (!CreateManifestPermission(permission_name, permission_value, 85 if (!CreateManifestPermission(permission_name, permission_value,
86 manifest_permissions, error, 86 manifest_permissions, error,
87 unhandled_permissions)) 87 unhandled_permissions))
88 return false; 88 return false;
89 } 89 }
90 return true; 90 return true;
91 } 91 }
92 92
93 } // namespace extensions 93 } // namespace extensions
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698