Chromium Code Reviews| Index: components/search_engines/template_url_data.h |
| diff --git a/components/search_engines/template_url_data.h b/components/search_engines/template_url_data.h |
| index 11943b0ce673eefd744dacf3c8615ff9e5bf9e34..914f191b09c23fa70f607ca211da9861b83be072 100644 |
| --- a/components/search_engines/template_url_data.h |
| +++ b/components/search_engines/template_url_data.h |
| @@ -10,9 +10,13 @@ |
| #include "base/strings/string16.h" |
| #include "base/time/time.h" |
| +#include "components/search_engines/search_engine_type.h" |
| #include "components/search_engines/template_url_id.h" |
| #include "url/gurl.h" |
| +class SearchTermsData; |
| +class TemplateURL; |
| + |
| // The data for the TemplateURL. Separating this into its own class allows most |
| // users to do SSA-style usage of TemplateURL: construct a TemplateURLData with |
| // whatever fields are desired, then create an immutable TemplateURL from it. |
| @@ -36,6 +40,13 @@ struct TemplateURLData { |
| void SetURL(const std::string& url); |
| const std::string& url() const { return url_; } |
| + // Returns the type of this search engine, or SEARCH_ENGINE_OTHER if no |
| + // engines match. |template_url_hint| is a TemplateURL which owns this |
| + // TemplateURLData. If |template_url_hint| is nullptr it's ignored. |
| + SearchEngineType GetEngineType( |
| + const SearchTermsData& search_terms_data, |
| + const TemplateURL* template_url_hint = nullptr) const; |
|
Peter Kasting
2016/06/09 23:00:56
Supplying a null second arg is only used by one te
Vitaly Baranov
2016/06/12 07:29:15
Done.
|
| + |
| // Optional additional raw URLs. |
| std::string suggestions_url; |
| std::string instant_url; |
| @@ -120,6 +131,9 @@ struct TemplateURLData { |
| base::string16 short_name_; |
| base::string16 keyword_; |
| std::string url_; |
| + |
| + // Mutable to allow GetEngineType() to assign it implicitly. |
|
Peter Kasting
2016/06/09 23:00:56
Nit: This is sort of implied by the mutable keywor
Vitaly Baranov
2016/06/12 07:29:15
Done.
|
| + mutable SearchEngineType engine_type_; |
| }; |
|
Peter Kasting
2016/06/09 23:00:56
NIt: While here: DISALLOW_COPY_AND_ASSIGN
Vitaly Baranov
2016/06/12 07:29:15
TemplateURLData has a copy constructor.
|
| #endif // COMPONENTS_SEARCH_ENGINES_TEMPLATE_URL_DATA_H_ |