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 63% |
rename from components/search_engines/detect_desktop_search_win.cc |
rename to components/search_engines/desktop_search_win.cc |
index 563e80de7f16d668065bbfb24ea25e68aef1cadf..b1bae715aec628bed246e3d6fb02b5db1ac84b5b 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 prefs { |
+const char kWindowsDesktopSearchRedirectionPref[] = |
+ "windows_desktop_search_redirection"; |
+} // namespace prefs |
+ |
+const base::Feature kWindowsDesktopSearchRedirectionFeature = { |
+ "WindowsDesktopSearchRedirection", base::FEATURE_DISABLED_BY_DEFAULT |
+}; |
+ |
+void RegisterWindowsDesktopSearchRedirectionPref( |
+ user_prefs::PrefRegistrySyncable* registry) { |
+ registry->RegisterBooleanPref(prefs::kWindowsDesktopSearchRedirectionPref, |
+ false); |
+} |
+ |
+bool ShouldRedirectWindowsDesktopSearchToDefaultSearchEngine( |
+ PrefService* pref_service) { |
+ DCHECK(pref_service); |
+ return base::FeatureList::IsEnabled( |
+ kWindowsDesktopSearchRedirectionFeature) && |
+ pref_service->GetBoolean(prefs::kWindowsDesktopSearchRedirectionPref); |
+} |
+ |
bool DetectWindowsDesktopSearch(const GURL& url, |
const SearchTermsData& search_terms_data, |
base::string16* search_terms) { |
@@ -37,7 +62,7 @@ bool DetectWindowsDesktopSearch(const GURL& url, |
// Use a case-insensitive comparison because the key is sometimes in capital |
// letters. |
if (base::EqualsCaseInsensitiveASCII(it.GetKey(), kBingSourceQueryKey)) { |
- std::string source = it.GetValue(); |
+ const std::string source = it.GetValue(); |
if (source == kBingSourceDesktopText || source == kBingSourceDesktopVoice) |
return true; |
} |