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

Unified Diff: components/search_engines/desktop_search_win.cc

Issue 1477783004: Add a preference to control Windows desktop search redirection. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: add about_flags.cc entry Created 5 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: components/search_engines/desktop_search_win.cc
diff --git a/components/search_engines/detect_desktop_search_win.cc b/components/search_engines/desktop_search_win.cc
similarity index 64%
rename from components/search_engines/detect_desktop_search_win.cc
rename to components/search_engines/desktop_search_win.cc
index 563e80de7f16d668065bbfb24ea25e68aef1cadf..14856f6c67bc8f937cb31bb18357945f9ceb207e 100644
--- a/components/search_engines/detect_desktop_search_win.cc
+++ b/components/search_engines/desktop_search_win.cc
@@ -2,17 +2,42 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#include "components/search_engines/detect_desktop_search_win.h"
+#include "components/search_engines/desktop_search_win.h"
#include <string>
#include "base/memory/scoped_ptr.h"
+#include "base/prefs/pref_service.h"
#include "base/strings/string_util.h"
+#include "components/pref_registry/pref_registry_syncable.h"
#include "components/search_engines/prepopulated_engines.h"
#include "components/search_engines/template_url.h"
#include "components/search_engines/template_url_prepopulate_data.h"
#include "net/base/url_util.h"
+namespace {
+// Name of the Windows desktop search redirection preference.
+const char kWindowsDesktopSearchRedirectionPref[] =
+ "windows_desktop_search_redirection";
Peter Kasting 2015/12/03 05:41:39 Multiple test files also want to use this pref nam
fdoray 2015/12/03 17:16:17 Done.
+} // namespace
+
+const base::Feature kWindowsDesktopSearchRedirectionFeature = {
+ "WindowsDesktopSearchRedirection", base::FEATURE_DISABLED_BY_DEFAULT};
Peter Kasting 2015/12/03 05:41:39 Nit: I'd wrap the final "};" to the next line.
fdoray 2015/12/03 17:16:18 Done.
+
+void RegisterWindowsDesktopSearchRedirectionPref(
+ user_prefs::PrefRegistrySyncable* registry) {
+ registry->RegisterBooleanPref(kWindowsDesktopSearchRedirectionPref, false);
+}
+
+bool ShouldRedirectWindowsDesktopSearchToDefaultSearchEngine(
+ PrefService* pref_service) {
+ DCHECK(pref_service);
+
+ if (!base::FeatureList::IsEnabled(kWindowsDesktopSearchRedirectionFeature))
+ return false;
+ return pref_service->GetBoolean(kWindowsDesktopSearchRedirectionPref);
Peter Kasting 2015/12/03 05:41:39 Nit: Simpler: return base::FeatureList::IsEnabl
fdoray 2015/12/03 17:16:17 Done.
+}
+
bool DetectWindowsDesktopSearch(const GURL& url,
const SearchTermsData& search_terms_data,
base::string16* search_terms) {

Powered by Google App Engine
This is Rietveld 408576698