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

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

Issue 7558014: Add a URL param to indicate group selection in Instant field trial. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Addressed @pkasting's comments Created 9 years, 4 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) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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_TEMPLATE_URL_H_ 5 #ifndef CHROME_BROWSER_SEARCH_ENGINES_TEMPLATE_URL_H_
6 #define CHROME_BROWSER_SEARCH_ENGINES_TEMPLATE_URL_H_ 6 #define CHROME_BROWSER_SEARCH_ENGINES_TEMPLATE_URL_H_
7 #pragma once 7 #pragma once
8 8
9 #include <string> 9 #include <string>
10 #include <vector> 10 #include <vector>
11 11
12 #include "base/gtest_prod_util.h" 12 #include "base/gtest_prod_util.h"
13 #include "base/time.h" 13 #include "base/time.h"
14 #include "chrome/browser/search_engines/search_engine_type.h" 14 #include "chrome/browser/search_engines/search_engine_type.h"
15 #include "chrome/browser/search_engines/template_url_id.h" 15 #include "chrome/browser/search_engines/template_url_id.h"
16 #include "googleurl/src/gurl.h" 16 #include "googleurl/src/gurl.h"
17 17
18 class PrefService; 18 class PrefService;
19 class Profile;
19 class SearchTermsData; 20 class SearchTermsData;
20 class TemplateURL; 21 class TemplateURL;
21 class WebDataService; 22 class WebDataService;
22 struct WDKeywordsResult; 23 struct WDKeywordsResult;
23 24
24 // TemplateURL represents the relevant portions of the Open Search Description 25 // TemplateURL represents the relevant portions of the Open Search Description
25 // Document (http://www.opensearch.org/Specifications/OpenSearch). 26 // Document (http://www.opensearch.org/Specifications/OpenSearch).
26 // The main use case for TemplateURL is to use the TemplateURLRef returned by 27 // The main use case for TemplateURL is to use the TemplateURLRef returned by
27 // suggestions_url or url for keyword/suggestion expansion: 28 // suggestions_url or url for keyword/suggestion expansion:
28 // . suggestions_url describes a URL that is ideal for as you type suggestions. 29 // . suggestions_url describes a URL that is ideal for as you type suggestions.
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
69 // If this TemplateURLRef does not support replacement (SupportsReplacement 70 // If this TemplateURLRef does not support replacement (SupportsReplacement
70 // returns false), an empty string is returned. 71 // returns false), an empty string is returned.
71 // 72 //
72 // The TemplateURL is used to determine the input encoding for the term. 73 // The TemplateURL is used to determine the input encoding for the term.
73 std::string ReplaceSearchTerms( 74 std::string ReplaceSearchTerms(
74 const TemplateURL& host, 75 const TemplateURL& host,
75 const string16& terms, 76 const string16& terms,
76 int accepted_suggestion, 77 int accepted_suggestion,
77 const string16& original_query_for_suggestion) const; 78 const string16& original_query_for_suggestion) const;
78 79
80 // Just like ReplaceSearchTerms except that it takes a Profile that's used to
81 // retrieve Instant field trial params. Most callers don't care about those
82 // params, and so can use ReplaceSearchTerms instead.
83 std::string ReplaceSearchTermsUsingProfile(
84 Profile* profile,
85 const TemplateURL& host,
86 const string16& terms,
87 int accepted_suggestion,
88 const string16& original_query_for_suggestion) const;
89
79 // Just like ReplaceSearchTerms except that it takes SearchTermsData to supply 90 // Just like ReplaceSearchTerms except that it takes SearchTermsData to supply
80 // the data for some search terms. Most of the time ReplaceSearchTerms should 91 // the data for some search terms. Most of the time ReplaceSearchTerms should
81 // be called. 92 // be called.
82 std::string ReplaceSearchTermsUsingTermsData( 93 std::string ReplaceSearchTermsUsingTermsData(
83 const TemplateURL& host, 94 const TemplateURL& host,
84 const string16& terms, 95 const string16& terms,
85 int accepted_suggestion, 96 int accepted_suggestion,
86 const string16& original_query_for_suggestion, 97 const string16& original_query_for_suggestion,
87 const SearchTermsData& search_terms_data) const; 98 const SearchTermsData& search_terms_data) const;
88 99
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after
151 FRIEND_TEST_ALL_PREFIXES(TemplateURLTest, ParseURLNoKnownParameters); 162 FRIEND_TEST_ALL_PREFIXES(TemplateURLTest, ParseURLNoKnownParameters);
152 FRIEND_TEST_ALL_PREFIXES(TemplateURLTest, ParseURLTwoParameters); 163 FRIEND_TEST_ALL_PREFIXES(TemplateURLTest, ParseURLTwoParameters);
153 FRIEND_TEST_ALL_PREFIXES(TemplateURLTest, ParseURLNestedParameter); 164 FRIEND_TEST_ALL_PREFIXES(TemplateURLTest, ParseURLNestedParameter);
154 165
155 // Enumeration of the known types. 166 // Enumeration of the known types.
156 enum ReplacementType { 167 enum ReplacementType {
157 ENCODING, 168 ENCODING,
158 GOOGLE_ACCEPTED_SUGGESTION, 169 GOOGLE_ACCEPTED_SUGGESTION,
159 GOOGLE_BASE_URL, 170 GOOGLE_BASE_URL,
160 GOOGLE_BASE_SUGGEST_URL, 171 GOOGLE_BASE_SUGGEST_URL,
172 GOOGLE_INSTANT_FIELD_TRIAL_GROUP,
161 GOOGLE_ORIGINAL_QUERY_FOR_SUGGESTION, 173 GOOGLE_ORIGINAL_QUERY_FOR_SUGGESTION,
162 GOOGLE_RLZ, 174 GOOGLE_RLZ,
163 GOOGLE_SEARCH_FIELDTRIAL_GROUP, 175 GOOGLE_SEARCH_FIELDTRIAL_GROUP,
164 GOOGLE_UNESCAPED_SEARCH_TERMS, 176 GOOGLE_UNESCAPED_SEARCH_TERMS,
165 LANGUAGE, 177 LANGUAGE,
166 SEARCH_TERMS, 178 SEARCH_TERMS,
167 }; 179 };
168 180
169 // Used to identify an element of the raw url that can be replaced. 181 // Used to identify an element of the raw url that can be replaced.
170 struct Replacement { 182 struct Replacement {
(...skipping 368 matching lines...) Expand 10 before | Expand all | Expand 10 after
539 int logo_id_; 551 int logo_id_;
540 int prepopulate_id_; 552 int prepopulate_id_;
541 // The primary unique identifier for Sync. This is only set on TemplateURLs 553 // The primary unique identifier for Sync. This is only set on TemplateURLs
542 // that have been associated with Sync. 554 // that have been associated with Sync.
543 std::string sync_guid_; 555 std::string sync_guid_;
544 556
545 // TODO(sky): Add date last parsed OSD file. 557 // TODO(sky): Add date last parsed OSD file.
546 }; 558 };
547 559
548 #endif // CHROME_BROWSER_SEARCH_ENGINES_TEMPLATE_URL_H_ 560 #endif // CHROME_BROWSER_SEARCH_ENGINES_TEMPLATE_URL_H_
OLDNEW
« no previous file with comments | « chrome/browser/search_engines/search_terms_data.cc ('k') | chrome/browser/search_engines/template_url.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698