Index: components/search_engines/desktop_search_win.h |
diff --git a/components/search_engines/desktop_search_win.h b/components/search_engines/desktop_search_win.h |
new file mode 100644 |
index 0000000000000000000000000000000000000000..44c92d172a38254088e0205954a486914c100f37 |
--- /dev/null |
+++ b/components/search_engines/desktop_search_win.h |
@@ -0,0 +1,55 @@ |
+// Copyright 2015 The Chromium Authors. All rights reserved. |
+// Use of this source code is governed by a BSD-style license that can be |
+// found in the LICENSE file. |
+ |
+#ifndef COMPONENTS_SEARCH_ENGINES_DESKTOP_SEARCH_WIN_H_ |
+#define COMPONENTS_SEARCH_ENGINES_DESKTOP_SEARCH_WIN_H_ |
+ |
+#include "base/feature_list.h" |
+#include "base/strings/string16.h" |
+ |
+class GURL; |
+class PrefService; |
+class SearchTermsData; |
+ |
+namespace user_prefs { |
+class PrefRegistrySyncable; |
+} |
+ |
+// Values for the Windows desktop search redirection preference. ENABLED means |
+// that the user has explicitly chosen to redirect desktop searches to the |
+// default search engine. DISABLED means that the user has chosen not to use the |
+// default search engine for desktop searches. UNSET means that no value has |
+// been explicitly set for the preference, i.e. the browser should prompt the |
+// user before redirecting a desktop search to the default search engine. |
+enum class WindowsDesktopSearchRedirectionPref { |
+ ENABLED, |
+ DISABLED, |
+ UNSET, |
+}; |
+ |
+// Windows desktop search redirection feature. |
+extern const base::Feature kWindowsDesktopSearchRedirectionFeature; |
Peter Kasting
2015/12/01 02:23:05
There's no need to declare this in the header as o
fdoray
2015/12/02 17:28:27
It's required if I want the feature to be controll
|
+ |
+// Registers the Windows desktop search redirection preference into |registry|. |
+void RegisterWindowsDesktopSearchRedirectionPref( |
+ user_prefs::PrefRegistrySyncable* registry); |
+ |
+// Reads the value of the Windows desktop search redirection preference from |
+// |pref_service|. |
+WindowsDesktopSearchRedirectionPref GetWindowsDesktopSearchRedirectionPref( |
+ PrefService* pref_service); |
+ |
+// Returns true if the Windows desktop search redirection feature is enabled. |
+// When the feature is disabled, Windows desktop searches are never redirected |
+// to the default search engine and the redirection preference doesn't appear |
+// on the settings page. |
+bool WindowsDesktopSearchRedirectionFeatureIsEnabled(); |
+ |
+// Detects whether a URL comes from a Windows Desktop search. If so, puts the |
+// search terms in |search_terms| and returns true. |
+bool DetectWindowsDesktopSearch(const GURL& url, |
+ const SearchTermsData& search_terms_data, |
+ base::string16* search_terms); |
+ |
+#endif // COMPONENTS_SEARCH_ENGINES_DESKTOP_SEARCH_WIN_H_ |