OLD | NEW |
---|---|
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 "chrome/browser/extensions/api/settings_overrides/settings_overrides_ap i.h" | 5 #include "chrome/browser/extensions/api/settings_overrides/settings_overrides_ap i.h" |
6 | 6 |
7 #include <stddef.h> | 7 #include <stddef.h> |
8 #include <utility> | 8 #include <utility> |
9 | 9 |
10 #include "base/lazy_instance.h" | 10 #include "base/lazy_instance.h" |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
42 base::ReplaceSubstringsAfterOffset(&str, 0, "__PARAM__", install_parameter); | 42 base::ReplaceSubstringsAfterOffset(&str, 0, "__PARAM__", install_parameter); |
43 return str; | 43 return str; |
44 } | 44 } |
45 | 45 |
46 // Find the prepopulated search engine with the given id. | 46 // Find the prepopulated search engine with the given id. |
47 bool GetPrepopulatedSearchProvider(PrefService* prefs, | 47 bool GetPrepopulatedSearchProvider(PrefService* prefs, |
48 int prepopulated_id, | 48 int prepopulated_id, |
49 TemplateURLData* data) { | 49 TemplateURLData* data) { |
50 DCHECK(data); | 50 DCHECK(data); |
51 size_t default_index; | 51 size_t default_index; |
52 ScopedVector<TemplateURLData> engines = | 52 std::vector<std::unique_ptr<TemplateURLData>> engines = |
53 TemplateURLPrepopulateData::GetPrepopulatedEngines(prefs, &default_index); | 53 TemplateURLPrepopulateData::GetPrepopulatedEngines(prefs, &default_index); |
54 for (ScopedVector<TemplateURLData>::iterator i = engines.begin(); | 54 for (const auto& engine : engines) { |
55 i != engines.end(); | 55 if (engine->prepopulate_id == prepopulated_id) { |
56 ++i) { | 56 *data = *engine; |
Devlin
2016/09/02 00:49:09
Total drive-by nit: it looks like there's no reaso
Peter Kasting
2016/09/02 01:06:25
Looks like just fixing now would be pretty simple.
Avi (use Gerrit)
2016/09/02 01:08:37
Fixed, ptal.
Devlin
2016/09/02 01:24:08
Thanks! I didn't want to volunteer you for more w
| |
57 if ((*i)->prepopulate_id == prepopulated_id) { | |
58 *data = **i; | |
59 return true; | 57 return true; |
60 } | 58 } |
61 } | 59 } |
62 return false; | 60 return false; |
63 } | 61 } |
64 | 62 |
65 TemplateURLData ConvertSearchProvider( | 63 TemplateURLData ConvertSearchProvider( |
66 PrefService* prefs, | 64 PrefService* prefs, |
67 const ChromeSettingsOverrides::Search_provider& search_provider, | 65 const ChromeSettingsOverrides::Search_provider& search_provider, |
68 const std::string& install_parameter) { | 66 const std::string& install_parameter) { |
(...skipping 215 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
284 | 282 |
285 template <> | 283 template <> |
286 void BrowserContextKeyedAPIFactory< | 284 void BrowserContextKeyedAPIFactory< |
287 SettingsOverridesAPI>::DeclareFactoryDependencies() { | 285 SettingsOverridesAPI>::DeclareFactoryDependencies() { |
288 DependsOn(ExtensionPrefsFactory::GetInstance()); | 286 DependsOn(ExtensionPrefsFactory::GetInstance()); |
289 DependsOn(PreferenceAPI::GetFactoryInstance()); | 287 DependsOn(PreferenceAPI::GetFactoryInstance()); |
290 DependsOn(TemplateURLServiceFactory::GetInstance()); | 288 DependsOn(TemplateURLServiceFactory::GetInstance()); |
291 } | 289 } |
292 | 290 |
293 } // namespace extensions | 291 } // namespace extensions |
OLD | NEW |