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

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: 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 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
64 const SearchTermsData& search_terms_data) const; 65 const SearchTermsData& search_terms_data) const;
65 66
66 // Returns a string that is the result of replacing the search terms in 67 // Returns a string that is the result of replacing the search terms in
67 // the url with the specified value. 68 // the url with the specified value.
68 // 69 //
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(
75 Profile* profile,
74 const TemplateURL& host, 76 const TemplateURL& host,
75 const string16& terms, 77 const string16& terms,
76 int accepted_suggestion, 78 int accepted_suggestion,
77 const string16& original_query_for_suggestion) const; 79 const string16& original_query_for_suggestion) const;
78 80
79 // Just like ReplaceSearchTerms except that it takes SearchTermsData to supply 81 // Just like ReplaceSearchTerms except that it takes SearchTermsData to supply
80 // the data for some search terms. Most of the time ReplaceSearchTerms should 82 // the data for some search terms. Most of the time ReplaceSearchTerms should
81 // be called. 83 // be called.
82 std::string ReplaceSearchTermsUsingTermsData( 84 std::string ReplaceSearchTermsUsingTermsData(
85 Profile* profile,
sky 2011/08/08 23:37:23 This too may be invoked from any thread, which imp
sreeram 2011/08/09 16:24:01 I am not sure how to interpret this. Is the conce
83 const TemplateURL& host, 86 const TemplateURL& host,
84 const string16& terms, 87 const string16& terms,
85 int accepted_suggestion, 88 int accepted_suggestion,
86 const string16& original_query_for_suggestion, 89 const string16& original_query_for_suggestion,
87 const SearchTermsData& search_terms_data) const; 90 const SearchTermsData& search_terms_data) const;
88 91
89 // Returns the raw URL. None of the parameters will have been replaced. 92 // Returns the raw URL. None of the parameters will have been replaced.
90 const std::string& url() const { return url_; } 93 const std::string& url() const { return url_; }
91 94
92 // Returns the index number of the first search result. 95 // Returns the index number of the first search result.
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after
155 // Enumeration of the known types. 158 // Enumeration of the known types.
156 enum ReplacementType { 159 enum ReplacementType {
157 ENCODING, 160 ENCODING,
158 GOOGLE_ACCEPTED_SUGGESTION, 161 GOOGLE_ACCEPTED_SUGGESTION,
159 GOOGLE_BASE_URL, 162 GOOGLE_BASE_URL,
160 GOOGLE_BASE_SUGGEST_URL, 163 GOOGLE_BASE_SUGGEST_URL,
161 GOOGLE_ORIGINAL_QUERY_FOR_SUGGESTION, 164 GOOGLE_ORIGINAL_QUERY_FOR_SUGGESTION,
162 GOOGLE_RLZ, 165 GOOGLE_RLZ,
163 GOOGLE_SEARCH_FIELDTRIAL_GROUP, 166 GOOGLE_SEARCH_FIELDTRIAL_GROUP,
164 GOOGLE_UNESCAPED_SEARCH_TERMS, 167 GOOGLE_UNESCAPED_SEARCH_TERMS,
168 INSTANT_FIELD_TRIAL_GROUP,
165 LANGUAGE, 169 LANGUAGE,
166 SEARCH_TERMS, 170 SEARCH_TERMS,
167 }; 171 };
168 172
169 // Used to identify an element of the raw url that can be replaced. 173 // Used to identify an element of the raw url that can be replaced.
170 struct Replacement { 174 struct Replacement {
171 Replacement(ReplacementType type, size_t index) 175 Replacement(ReplacementType type, size_t index)
172 : type(type), index(index) {} 176 : type(type), index(index) {}
173 ReplacementType type; 177 ReplacementType type;
174 size_t index; 178 size_t index;
(...skipping 364 matching lines...) Expand 10 before | Expand all | Expand 10 after
539 int logo_id_; 543 int logo_id_;
540 int prepopulate_id_; 544 int prepopulate_id_;
541 // The primary unique identifier for Sync. This is only set on TemplateURLs 545 // The primary unique identifier for Sync. This is only set on TemplateURLs
542 // that have been associated with Sync. 546 // that have been associated with Sync.
543 std::string sync_guid_; 547 std::string sync_guid_;
544 548
545 // TODO(sky): Add date last parsed OSD file. 549 // TODO(sky): Add date last parsed OSD file.
546 }; 550 };
547 551
548 #endif // CHROME_BROWSER_SEARCH_ENGINES_TEMPLATE_URL_H_ 552 #endif // CHROME_BROWSER_SEARCH_ENGINES_TEMPLATE_URL_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698