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

Side by Side Diff: extensions/common/features/simple_feature.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, 3 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/features/simple_feature.h" 5 #include "extensions/common/features/simple_feature.h"
6 6
7 #include <map> 7 #include <map>
8 #include <vector> 8 #include <vector>
9 9
10 #include "base/bind.h" 10 #include "base/bind.h"
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after
73 std::map<std::string, Feature::Platform> platforms; 73 std::map<std::string, Feature::Platform> platforms;
74 }; 74 };
75 75
76 base::LazyInstance<Mappings> g_mappings = LAZY_INSTANCE_INITIALIZER; 76 base::LazyInstance<Mappings> g_mappings = LAZY_INSTANCE_INITIALIZER;
77 77
78 // TODO(aa): Can we replace all this manual parsing with JSON schema stuff? 78 // TODO(aa): Can we replace all this manual parsing with JSON schema stuff?
79 79
80 void ParseSet(const base::DictionaryValue* value, 80 void ParseSet(const base::DictionaryValue* value,
81 const std::string& property, 81 const std::string& property,
82 std::set<std::string>* set) { 82 std::set<std::string>* set) {
83 const base::ListValue* list_value = NULL; 83 const base::ListValue* list_value = nullptr;
84 if (!value->GetList(property, &list_value)) 84 if (!value->GetList(property, &list_value))
85 return; 85 return;
86 86
87 set->clear(); 87 set->clear();
88 for (size_t i = 0; i < list_value->GetSize(); ++i) { 88 for (size_t i = 0; i < list_value->GetSize(); ++i) {
89 std::string str_val; 89 std::string str_val;
90 CHECK(list_value->GetString(i, &str_val)) << property << " " << i; 90 CHECK(list_value->GetString(i, &str_val)) << property << " " << i;
91 set->insert(str_val); 91 set->insert(str_val);
92 } 92 }
93 } 93 }
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
148 iter != string_set.end(); ++iter) { 148 iter != string_set.end(); ++iter) {
149 T enum_value = static_cast<T>(0); 149 T enum_value = static_cast<T>(0);
150 ParseEnum(*iter, &enum_value, mapping); 150 ParseEnum(*iter, &enum_value, mapping);
151 enum_set->insert(enum_value); 151 enum_set->insert(enum_value);
152 } 152 }
153 } 153 }
154 154
155 void ParseURLPatterns(const base::DictionaryValue* value, 155 void ParseURLPatterns(const base::DictionaryValue* value,
156 const std::string& key, 156 const std::string& key,
157 URLPatternSet* set) { 157 URLPatternSet* set) {
158 const base::ListValue* matches = NULL; 158 const base::ListValue* matches = nullptr;
159 if (value->GetList(key, &matches)) { 159 if (value->GetList(key, &matches)) {
160 set->ClearPatterns(); 160 set->ClearPatterns();
161 for (size_t i = 0; i < matches->GetSize(); ++i) { 161 for (size_t i = 0; i < matches->GetSize(); ++i) {
162 std::string pattern; 162 std::string pattern;
163 CHECK(matches->GetString(i, &pattern)); 163 CHECK(matches->GetString(i, &pattern));
164 set->AddPattern(URLPattern(URLPattern::SCHEME_ALL, pattern)); 164 set->AddPattern(URLPattern(URLPattern::SCHEME_ALL, pattern));
165 } 165 }
166 } 166 }
167 } 167 }
168 168
(...skipping 403 matching lines...) Expand 10 before | Expand all | Expand 10 after
572 if (!dependency) 572 if (!dependency)
573 return CreateAvailability(NOT_PRESENT); 573 return CreateAvailability(NOT_PRESENT);
574 Availability dependency_availability = checker.Run(dependency); 574 Availability dependency_availability = checker.Run(dependency);
575 if (!dependency_availability.is_available()) 575 if (!dependency_availability.is_available())
576 return dependency_availability; 576 return dependency_availability;
577 } 577 }
578 return CreateAvailability(IS_AVAILABLE); 578 return CreateAvailability(IS_AVAILABLE);
579 } 579 }
580 580
581 } // namespace extensions 581 } // namespace extensions
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698