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

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

Issue 2479113002: Make extensions DSE persistent in browser prefs (Closed)
Patch Set: Fixed after rebase on master Created 4 years 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..9fa3a743c727e101ca18747f440222ebf8b1e8ee 100644
--- a/chrome/browser/search_engines/chrome_template_url_service_client.cc
+++ b/chrome/browser/search_engines/chrome_template_url_service_client.cc
@@ -6,14 +6,18 @@
#include "base/memory/ptr_util.h"
#include "components/history/core/browser/history_service.h"
+#include "components/search_engines/default_search_manager.h"
#include "components/search_engines/template_url_service.h"
+#include "extensions/browser/extension_pref_value_map.h"
#include "extensions/common/constants.h"
ChromeTemplateURLServiceClient::ChromeTemplateURLServiceClient(
- history::HistoryService* history_service)
+ history::HistoryService* history_service,
+ ExtensionPrefValueMap* extension_prefs_value_map)
: owner_(NULL),
history_service_observer_(this),
- history_service_(history_service) {
+ history_service_(history_service),
+ extension_prefs_value_map_(extension_prefs_value_map) {
// 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
@@ -68,6 +72,13 @@ bool ChromeTemplateURLServiceClient::IsOmniboxExtensionURL(
return GURL(url).SchemeIs(extensions::kExtensionScheme);
}
+std::string ChromeTemplateURLServiceClient::GetExtensionControllingDSEPref() {
+ if (!extension_prefs_value_map_)
+ return std::string(); // Can be null during testing.
+ return extension_prefs_value_map_->GetExtensionControllingPref(
+ DefaultSearchManager::kDefaultSearchProviderDataPrefName);
+}
+
void ChromeTemplateURLServiceClient::OnURLVisited(
history::HistoryService* history_service,
ui::PageTransition transition,

Powered by Google App Engine
This is Rietveld 408576698