Chromium Code Reviews| OLD | NEW |
|---|---|
| 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_SERVICE_H_ | 5 #ifndef CHROME_BROWSER_SEARCH_ENGINES_TEMPLATE_URL_SERVICE_H_ |
| 6 #define CHROME_BROWSER_SEARCH_ENGINES_TEMPLATE_URL_SERVICE_H_ | 6 #define CHROME_BROWSER_SEARCH_ENGINES_TEMPLATE_URL_SERVICE_H_ |
| 7 #pragma once | 7 #pragma once |
| 8 | 8 |
| 9 #include <map> | 9 #include <map> |
| 10 #include <set> | 10 #include <set> |
| (...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 84 // not want to auto-add keywords, such as keywords for searches on pages that | 84 // not want to auto-add keywords, such as keywords for searches on pages that |
| 85 // themselves come from form submissions. | 85 // themselves come from form submissions. |
| 86 static string16 GenerateKeyword(const GURL& url, bool autodetected); | 86 static string16 GenerateKeyword(const GURL& url, bool autodetected); |
| 87 | 87 |
| 88 // Removes any unnecessary characters from a user input keyword. | 88 // Removes any unnecessary characters from a user input keyword. |
| 89 // This removes the leading scheme, "www." and any trailing slash. | 89 // This removes the leading scheme, "www." and any trailing slash. |
| 90 static string16 CleanUserInputKeyword(const string16& keyword); | 90 static string16 CleanUserInputKeyword(const string16& keyword); |
| 91 | 91 |
| 92 // Returns the search url for t_url. Returns an empty GURL if t_url has no | 92 // Returns the search url for t_url. Returns an empty GURL if t_url has no |
| 93 // url(). | 93 // url(). |
| 94 static GURL GenerateSearchURL(const TemplateURL* t_url); | 94 static GURL GenerateSearchURL(Profile* profile, const TemplateURL* t_url); |
| 95 | 95 |
| 96 // Just like GenerateSearchURL except that it takes SearchTermsData to supply | 96 // Just like GenerateSearchURL except that it takes SearchTermsData to supply |
| 97 // the data for some search terms. Most of the time GenerateSearchURL should | 97 // the data for some search terms. Most of the time GenerateSearchURL should |
| 98 // be called. | 98 // be called. |
| 99 static GURL GenerateSearchURLUsingTermsData( | 99 static GURL GenerateSearchURLUsingTermsData( |
| 100 Profile* profile, | |
|
sky
2011/08/08 23:37:23
This method shouldn't take a profile, it's intende
sreeram
2011/08/09 16:24:01
I only supply NULL where the caller strips away th
| |
| 100 const TemplateURL* t_url, | 101 const TemplateURL* t_url, |
| 101 const SearchTermsData& search_terms_data); | 102 const SearchTermsData& search_terms_data); |
| 102 | 103 |
| 103 // Returns true if there is no TemplateURL that conflicts with the | 104 // Returns true if there is no TemplateURL that conflicts with the |
| 104 // keyword/url pair, or there is one but it can be replaced. If there is an | 105 // keyword/url pair, or there is one but it can be replaced. If there is an |
| 105 // existing keyword that can be replaced and template_url_to_replace is | 106 // existing keyword that can be replaced and template_url_to_replace is |
| 106 // non-NULL, template_url_to_replace is set to the keyword to replace. | 107 // non-NULL, template_url_to_replace is set to the keyword to replace. |
| 107 // | 108 // |
| 108 // url gives the url of the search query. The url is used to avoid generating | 109 // url gives the url of the search query. The url is used to avoid generating |
| 109 // a TemplateURL for an existing TemplateURL that shares the same host. | 110 // a TemplateURL for an existing TemplateURL that shares the same host. |
| (...skipping 344 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 454 // List of extension IDs waiting for Load to have keywords registered. | 455 // List of extension IDs waiting for Load to have keywords registered. |
| 455 std::vector<std::string> pending_extension_ids_; | 456 std::vector<std::string> pending_extension_ids_; |
| 456 | 457 |
| 457 // Function returning current time in base::Time units. | 458 // Function returning current time in base::Time units. |
| 458 TimeProvider* time_provider_; | 459 TimeProvider* time_provider_; |
| 459 | 460 |
| 460 DISALLOW_COPY_AND_ASSIGN(TemplateURLService); | 461 DISALLOW_COPY_AND_ASSIGN(TemplateURLService); |
| 461 }; | 462 }; |
| 462 | 463 |
| 463 #endif // CHROME_BROWSER_SEARCH_ENGINES_TEMPLATE_URL_SERVICE_H_ | 464 #endif // CHROME_BROWSER_SEARCH_ENGINES_TEMPLATE_URL_SERVICE_H_ |
| OLD | NEW |