Fix scroll regression when specifying an extension id.
[chromium-blink-merge.git] / components / search_engines / search_terms_data.h
bloba9a41c595ff2341500b8013688a83f04bc2e1255
1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 #ifndef COMPONENTS_SEARCH_ENGINES_SEARCH_TERMS_DATA_H_
6 #define COMPONENTS_SEARCH_ENGINES_SEARCH_TERMS_DATA_H_
8 #include <string>
10 #include "base/basictypes.h"
11 #include "base/compiler_specific.h"
12 #include "base/strings/string16.h"
14 // All data needed by TemplateURLRef::ReplaceSearchTerms which typically may
15 // only be accessed on the UI thread.
16 class SearchTermsData {
17 public:
18 SearchTermsData();
19 virtual ~SearchTermsData();
21 // Returns the value to use for replacements of type GOOGLE_BASE_URL. This
22 // implementation simply returns the default value.
23 virtual std::string GoogleBaseURLValue() const;
25 // Returns the value for the GOOGLE_BASE_SUGGEST_URL term. This
26 // implementation simply returns the default value.
27 std::string GoogleBaseSuggestURLValue() const;
29 // Returns the locale used by the application. This implementation returns
30 // "en" and thus should be overridden where the result is actually meaningful.
31 virtual std::string GetApplicationLocale() const;
33 // Returns the value for the Chrome Omnibox rlz. This implementation returns
34 // the empty string.
35 virtual base::string16 GetRlzParameterValue(bool from_app_list) const;
37 // The optional client parameter passed with Google search requests. This
38 // implementation returns the empty string.
39 virtual std::string GetSearchClient() const;
41 // The suggest client parameter ("client") passed with Google suggest
42 // requests. See GetSuggestRequestIdentifier() for more details.
43 // This implementation returns the empty string.
44 virtual std::string GetSuggestClient() const;
46 // The suggest request identifier parameter ("gs_ri") passed with Google
47 // suggest requests. Along with suggestclient (See GetSuggestClient()),
48 // this parameter controls what suggestion results are returned.
49 // This implementation returns the empty string.
50 virtual std::string GetSuggestRequestIdentifier() const;
52 // Returns true if the AnswersInSuggest feature should be enabled.
53 virtual bool EnableAnswersInSuggest() const;
55 // Returns true if search terms are shown in the omnibox on search results
56 // pages.
57 virtual bool IsShowingSearchTermsOnSearchResultsPages() const;
59 // Returns a string indicating whether InstantExtended is enabled.
60 virtual std::string InstantExtendedEnabledParam(bool for_search) const;
62 // Returns a string that will cause the search results page to update
63 // incrementally.
64 virtual std::string ForceInstantResultsParam(bool for_prerender) const;
66 // Returns the start-edge margin of the omnibox in pixels.
67 virtual int OmniboxStartMargin() const;
69 // Returns a string indicating whether a non-default theme is active,
70 // suitable for adding as a query string param to the homepage. This only
71 // applies if Instant Extended is enabled. Returns an empty string otherwise.
72 // Determining this requires accessing the Profile, so this can only ever be
73 // non-empty for UIThreadSearchTermsData.
74 virtual std::string NTPIsThemedParam() const;
76 // Returns the value to use for replacements of type
77 // GOOGLE_IMAGE_SEARCH_SOURCE.
78 virtual std::string GoogleImageSearchSource() const;
80 private:
81 DISALLOW_COPY_AND_ASSIGN(SearchTermsData);
84 #endif // COMPONENTS_SEARCH_ENGINES_SEARCH_TERMS_DATA_H_