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

Side by Side Diff: chrome/browser/extensions/api/settings_overrides/settings_overrides_api.cc

Issue 2487633003: Change behaivor to decide whether a search engine should be shown in the default list (Closed)
Patch Set: Update based on Peter and Nicolas's comments. Created 4 years, 1 month 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 "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 259 matching lines...) Expand 10 before | Expand all | Expand 10 after
270 DCHECK(settings->search_engine); 270 DCHECK(settings->search_engine);
271 auto info = 271 auto info =
272 base::MakeUnique<TemplateURL::AssociatedExtensionInfo>(extension->id()); 272 base::MakeUnique<TemplateURL::AssociatedExtensionInfo>(extension->id());
273 info->wants_to_be_default_engine = settings->search_engine->is_default; 273 info->wants_to_be_default_engine = settings->search_engine->is_default;
274 274
275 ExtensionPrefs* prefs = ExtensionPrefs::Get(profile_); 275 ExtensionPrefs* prefs = ExtensionPrefs::Get(profile_);
276 info->install_time = prefs->GetInstallTime(extension->id()); 276 info->install_time = prefs->GetInstallTime(extension->id());
277 std::string install_parameter = prefs->GetInstallParam(extension->id()); 277 std::string install_parameter = prefs->GetInstallParam(extension->id());
278 std::unique_ptr<TemplateURLData> data = ConvertSearchProvider( 278 std::unique_ptr<TemplateURLData> data = ConvertSearchProvider(
279 profile_->GetPrefs(), *settings->search_engine, install_parameter); 279 profile_->GetPrefs(), *settings->search_engine, install_parameter);
280 data->show_in_default_list = info->wants_to_be_default_engine;
281 auto turl = base::MakeUnique<TemplateURL>( 280 auto turl = base::MakeUnique<TemplateURL>(
282 *data, TemplateURL::NORMAL_CONTROLLED_BY_EXTENSION); 281 *data, TemplateURL::NORMAL_CONTROLLED_BY_EXTENSION);
283 282
284 url_service_->AddExtensionControlledTURL(std::move(turl), std::move(info)); 283 url_service_->AddExtensionControlledTURL(std::move(turl), std::move(info));
285 } 284 }
286 285
287 template <> 286 template <>
288 void BrowserContextKeyedAPIFactory< 287 void BrowserContextKeyedAPIFactory<
289 SettingsOverridesAPI>::DeclareFactoryDependencies() { 288 SettingsOverridesAPI>::DeclareFactoryDependencies() {
290 DependsOn(ExtensionPrefsFactory::GetInstance()); 289 DependsOn(ExtensionPrefsFactory::GetInstance());
291 DependsOn(PreferenceAPI::GetFactoryInstance()); 290 DependsOn(PreferenceAPI::GetFactoryInstance());
292 DependsOn(TemplateURLServiceFactory::GetInstance()); 291 DependsOn(TemplateURLServiceFactory::GetInstance());
293 } 292 }
294 293
295 } // namespace extensions 294 } // namespace extensions
OLDNEW
« no previous file with comments | « chrome/browser/android/locale/special_locale_handler.cc ('k') | chrome/browser/importer/in_process_importer_bridge.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698