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

Side by Side Diff: chrome/browser/search_engines/search_terms_data.h

Issue 151813002: Adds InstantExtendedEnabledParam to the search request URL iff the query extraction flag is enabled. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: '' Created 6 years, 10 months 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef CHROME_BROWSER_SEARCH_ENGINES_SEARCH_TERMS_DATA_H_ 5 #ifndef CHROME_BROWSER_SEARCH_ENGINES_SEARCH_TERMS_DATA_H_
6 #define CHROME_BROWSER_SEARCH_ENGINES_SEARCH_TERMS_DATA_H_ 6 #define CHROME_BROWSER_SEARCH_ENGINES_SEARCH_TERMS_DATA_H_
7 7
8 #include <string> 8 #include <string>
9 9
10 #include "base/basictypes.h" 10 #include "base/basictypes.h"
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
54 // Returns a string that will cause the search results page to update 54 // Returns a string that will cause the search results page to update
55 // incrementally. Currently, Instant Extended passes a different param to 55 // incrementally. Currently, Instant Extended passes a different param to
56 // search results pages that also has this effect, so by default this function 56 // search results pages that also has this effect, so by default this function
57 // returns the empty string when Instant Extended is enabled. However, when 57 // returns the empty string when Instant Extended is enabled. However, when
58 // doing instant search result prerendering, we still need to pass this param, 58 // doing instant search result prerendering, we still need to pass this param,
59 // as Instant Extended does not cause incremental updates by default for the 59 // as Instant Extended does not cause incremental updates by default for the
60 // prerender page. Callers should set |for_prerender| in this case to force 60 // prerender page. Callers should set |for_prerender| in this case to force
61 // the returned string to be non-empty. 61 // the returned string to be non-empty.
62 virtual std::string ForceInstantResultsParam(bool for_prerender) const; 62 virtual std::string ForceInstantResultsParam(bool for_prerender) const;
63 63
64 // Returns a string indicating whether InstantExtended is enabled, suitable
65 // for adding as a query string param to the homepage or search requests.
66 // Returns an empty string otherwise. Determining this requires accessing the
67 // Profile, so this can only ever be non-empty for UIThreadSearchTermsData.
68 virtual std::string InstantExtendedEnabledParam() const;
69
70 // Returns a string indicating whether a non-default theme is active, 64 // Returns a string indicating whether a non-default theme is active,
71 // suitable for adding as a query string param to the homepage. This only 65 // suitable for adding as a query string param to the homepage. This only
72 // applies if Instant Extended is enabled. Returns an empty string otherwise. 66 // applies if Instant Extended is enabled. Returns an empty string otherwise.
73 // Determining this requires accessing the Profile, so this can only ever be 67 // Determining this requires accessing the Profile, so this can only ever be
74 // non-empty for UIThreadSearchTermsData. 68 // non-empty for UIThreadSearchTermsData.
75 virtual std::string NTPIsThemedParam() const; 69 virtual std::string NTPIsThemedParam() const;
76 70
77 private: 71 private:
78 DISALLOW_COPY_AND_ASSIGN(SearchTermsData); 72 DISALLOW_COPY_AND_ASSIGN(SearchTermsData);
79 }; 73 };
80 74
81 // Implementation of SearchTermsData that is only usable on the UI thread. 75 // Implementation of SearchTermsData that is only usable on the UI thread.
82 class UIThreadSearchTermsData : public SearchTermsData { 76 class UIThreadSearchTermsData : public SearchTermsData {
83 public: 77 public:
84 // If |profile_| is NULL, the Google base URL accessors will return default 78 // If |profile_| is NULL, the Google base URL accessors will return default
85 // values, and ForceInstantResultsParam(), InstantExtendedEnabledParam(), and 79 // values, and NTPIsThemedParam() will return an empty string.
86 // NTPIsThemedParam(), will return the empty string.
87 explicit UIThreadSearchTermsData(Profile* profile); 80 explicit UIThreadSearchTermsData(Profile* profile);
88 81
89 virtual std::string GoogleBaseURLValue() const OVERRIDE; 82 virtual std::string GoogleBaseURLValue() const OVERRIDE;
90 virtual std::string GetApplicationLocale() const OVERRIDE; 83 virtual std::string GetApplicationLocale() const OVERRIDE;
91 virtual base::string16 GetRlzParameterValue() const OVERRIDE; 84 virtual base::string16 GetRlzParameterValue() const OVERRIDE;
92 virtual std::string GetSearchClient() const OVERRIDE; 85 virtual std::string GetSearchClient() const OVERRIDE;
93 virtual std::string GetSuggestClient() const OVERRIDE; 86 virtual std::string GetSuggestClient() const OVERRIDE;
94 virtual std::string GetSuggestRequestIdentifier() const OVERRIDE; 87 virtual std::string GetSuggestRequestIdentifier() const OVERRIDE;
95 virtual std::string ForceInstantResultsParam( 88 virtual std::string ForceInstantResultsParam(
96 bool for_prerender) const OVERRIDE; 89 bool for_prerender) const OVERRIDE;
97 virtual std::string InstantExtendedEnabledParam() const OVERRIDE;
98 virtual std::string NTPIsThemedParam() const OVERRIDE; 90 virtual std::string NTPIsThemedParam() const OVERRIDE;
99 91
100 // Used by tests to override the value for the Google base URL. Passing the 92 // Used by tests to override the value for the Google base URL. Passing the
101 // empty string cancels this override. 93 // empty string cancels this override.
102 static void SetGoogleBaseURL(const std::string& base_url); 94 static void SetGoogleBaseURL(const std::string& base_url);
103 95
104 private: 96 private:
105 static std::string* google_base_url_; 97 static std::string* google_base_url_;
106 Profile* profile_; 98 Profile* profile_;
107 99
108 DISALLOW_COPY_AND_ASSIGN(UIThreadSearchTermsData); 100 DISALLOW_COPY_AND_ASSIGN(UIThreadSearchTermsData);
109 }; 101 };
110 102
111 #endif // CHROME_BROWSER_SEARCH_ENGINES_SEARCH_TERMS_DATA_H_ 103 #endif // CHROME_BROWSER_SEARCH_ENGINES_SEARCH_TERMS_DATA_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698