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

Unified Diff: chrome/browser/search_engines/chrome_template_url_service_client.cc

Issue 2479113002: Make extensions DSE persistent in browser prefs (Closed)
Patch Set: 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/search_engines/chrome_template_url_service_client.cc
diff --git a/chrome/browser/search_engines/chrome_template_url_service_client.cc b/chrome/browser/search_engines/chrome_template_url_service_client.cc
index 6653ee6c70a236ce8a5e0598ea359bea5e467670..8ca2ccf072c93aef0996d3ef87f7c21f573de5f9 100644
--- a/chrome/browser/search_engines/chrome_template_url_service_client.cc
+++ b/chrome/browser/search_engines/chrome_template_url_service_client.cc
@@ -5,15 +5,18 @@
#include "chrome/browser/search_engines/chrome_template_url_service_client.h"
#include "base/memory/ptr_util.h"
+#include "chrome/browser/extensions/api/preference/preference_api.h"
#include "components/history/core/browser/history_service.h"
#include "components/search_engines/template_url_service.h"
#include "extensions/common/constants.h"
ChromeTemplateURLServiceClient::ChromeTemplateURLServiceClient(
- history::HistoryService* history_service)
+ history::HistoryService* history_service,
+ extensions::PreferenceAPI* pref_api)
: owner_(NULL),
history_service_observer_(this),
- history_service_(history_service) {
+ history_service_(history_service),
+ pref_api_(pref_api) {
// TODO(sky): bug 1166191. The keywords should be moved into the history
// db, which will mean we no longer need this notification and the history
// backend can handle automatically adding the search terms as the user
@@ -84,3 +87,14 @@ void ChromeTemplateURLServiceClient::OnURLVisited(
ui::PageTransitionCoreTypeIs(transition, ui::PAGE_TRANSITION_KEYWORD);
owner_->OnHistoryURLVisited(visited_details);
}
+
+void ChromeTemplateURLServiceClient::SetExtensionControlledPref(
+ const std::string extension_id, const std::string pref_name,
+ std::unique_ptr<base::Value> pref_value) {
+ if (!pref_api_)
+ return;
+ pref_api_->SetExtensionControlledPref(extension_id,
+ pref_name,
+ extensions::kExtensionPrefsScopeRegular,
+ pref_value.release());
+}

Powered by Google App Engine
This is Rietveld 408576698