Chromium Code Reviews| Index: components/search_engines/desktop_search_utils.h |
| diff --git a/components/search_engines/desktop_search_utils.h b/components/search_engines/desktop_search_utils.h |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..3df249d7fb6e8ed8635cd072227cfcdc59104566 |
| --- /dev/null |
| +++ b/components/search_engines/desktop_search_utils.h |
| @@ -0,0 +1,45 @@ |
| +// Copyright 2016 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_UTILS_H_ |
| +#define COMPONENTS_SEARCH_ENGINES_DESKTOP_SEARCH_UTILS_H_ |
| + |
| +#include "base/feature_list.h" |
| +#include "base/strings/string16.h" |
| +#include "url/gurl.h" |
| + |
| +class PrefService; |
| +class TemplateURLService; |
| + |
| +namespace user_prefs { |
| +class PrefRegistrySyncable; |
| +} |
| + |
| +namespace prefs { |
| +// Name of the preference keeping track of whether the desktop search |
| +// redirection infobar has been shown. |
| +extern const char kDesktopSearchRedirectionInfobarShownPref[]; |
| +} // namespace prefs |
|
Peter Kasting
2016/01/22 00:38:57
Nit: I wouldn't bother with this comment
fdoray
2016/02/01 15:15:54
Done.
|
| + |
| +// Desktop search redirection feature. This is exposed in the header file so |
| +// that it can be referenced from about_flags.cc. |
| +extern const base::Feature kDesktopSearchRedirectionFeature; |
| + |
| +// Registers the preference keeping track of whether the desktop search |
| +// redirection infobar has been shown in |registry|. |
|
Peter Kasting
2016/01/22 00:38:57
Nit: I'd remove "in |registry|" since that's impli
fdoray
2016/02/01 15:15:54
Done.
|
| +void RegisterDesktopSearchRedirectionPref( |
| + user_prefs::PrefRegistrySyncable* registry); |
| + |
| +// Replaces |url| by a default search engine URL and returns true if: |
|
Peter Kasting
2016/01/22 00:38:57
Nit: Remove "and returns true"
fdoray
2016/02/01 15:15:54
Done.
|
| +// - |url| is a desktop search URL. |
| +// - The desktop search redirection feature is enabled. |
| +// - The default search engine is not Bing. |
| +// Returns true if an infobar should be shown to tell the user about the |
| +// redirection. |
| +bool ReplaceDesktopSearchURLWithDefaultSearchURLIfNeeded( |
| + const PrefService* pref_service, |
| + TemplateURLService* template_url_service, |
| + GURL* url); |
| + |
| +#endif // COMPONENTS_SEARCH_ENGINES_DESKTOP_SEARCH_UTILS_H_ |