| OLD | NEW |
| 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_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 | 7 |
| 8 #include <string> | 8 #include <string> |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| (...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 152 | 152 |
| 153 // Enumeration of the known types. | 153 // Enumeration of the known types. |
| 154 enum ReplacementType { | 154 enum ReplacementType { |
| 155 ENCODING, | 155 ENCODING, |
| 156 GOOGLE_ACCEPTED_SUGGESTION, | 156 GOOGLE_ACCEPTED_SUGGESTION, |
| 157 GOOGLE_ASSISTED_QUERY_STATS, | 157 GOOGLE_ASSISTED_QUERY_STATS, |
| 158 GOOGLE_BASE_URL, | 158 GOOGLE_BASE_URL, |
| 159 GOOGLE_BASE_SUGGEST_URL, | 159 GOOGLE_BASE_SUGGEST_URL, |
| 160 GOOGLE_INSTANT_ENABLED, | 160 GOOGLE_INSTANT_ENABLED, |
| 161 GOOGLE_INSTANT_EXTENDED_ENABLED, | 161 GOOGLE_INSTANT_EXTENDED_ENABLED, |
| 162 GOOGLE_INSTANT_EXTENDED_ENABLED_KEY, |
| 162 GOOGLE_ORIGINAL_QUERY_FOR_SUGGESTION, | 163 GOOGLE_ORIGINAL_QUERY_FOR_SUGGESTION, |
| 163 GOOGLE_RLZ, | 164 GOOGLE_RLZ, |
| 164 GOOGLE_SEARCH_CLIENT, | 165 GOOGLE_SEARCH_CLIENT, |
| 165 GOOGLE_SEARCH_FIELDTRIAL_GROUP, | 166 GOOGLE_SEARCH_FIELDTRIAL_GROUP, |
| 166 GOOGLE_UNESCAPED_SEARCH_TERMS, | 167 GOOGLE_UNESCAPED_SEARCH_TERMS, |
| 167 LANGUAGE, | 168 LANGUAGE, |
| 168 SEARCH_TERMS, | 169 SEARCH_TERMS, |
| 169 }; | 170 }; |
| 170 | 171 |
| 171 // Used to identify an element of the raw url that can be replaced. | 172 // Used to identify an element of the raw url that can be replaced. |
| (...skipping 168 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 340 int prepopulate_id; | 341 int prepopulate_id; |
| 341 | 342 |
| 342 // The primary unique identifier for Sync. This set on all TemplateURLs | 343 // The primary unique identifier for Sync. This set on all TemplateURLs |
| 343 // regardless of whether they have been associated with Sync. | 344 // regardless of whether they have been associated with Sync. |
| 344 std::string sync_guid; | 345 std::string sync_guid; |
| 345 | 346 |
| 346 // A list of URL patterns that can be used, in addition to |url_|, to extract | 347 // A list of URL patterns that can be used, in addition to |url_|, to extract |
| 347 // search terms from a URL. | 348 // search terms from a URL. |
| 348 std::vector<std::string> alternate_urls; | 349 std::vector<std::string> alternate_urls; |
| 349 | 350 |
| 351 |
| 352 // A parameter that, if present and non-zero in a search_url or instant_url, |
| 353 // causes Chrome to replace the URL with the search term. |
| 354 // The parameter must be in the query if the search terms are in the query, |
| 355 // and in the ref if the search terms are in the ref. |
| 356 std::string search_terms_replacement_key; |
| 357 |
| 350 private: | 358 private: |
| 351 // Private so we can enforce using the setters and thus enforce that these | 359 // Private so we can enforce using the setters and thus enforce that these |
| 352 // fields are never empty. | 360 // fields are never empty. |
| 353 string16 keyword_; | 361 string16 keyword_; |
| 354 std::string url_; | 362 std::string url_; |
| 355 }; | 363 }; |
| 356 | 364 |
| 357 | 365 |
| 358 // TemplateURL ---------------------------------------------------------------- | 366 // TemplateURL ---------------------------------------------------------------- |
| 359 | 367 |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 391 const std::string& url() const { return data_.url(); } | 399 const std::string& url() const { return data_.url(); } |
| 392 const std::string& suggestions_url() const { return data_.suggestions_url; } | 400 const std::string& suggestions_url() const { return data_.suggestions_url; } |
| 393 const std::string& instant_url() const { return data_.instant_url; } | 401 const std::string& instant_url() const { return data_.instant_url; } |
| 394 const std::vector<std::string>& alternate_urls() const { | 402 const std::vector<std::string>& alternate_urls() const { |
| 395 return data_.alternate_urls; | 403 return data_.alternate_urls; |
| 396 } | 404 } |
| 397 const GURL& favicon_url() const { return data_.favicon_url; } | 405 const GURL& favicon_url() const { return data_.favicon_url; } |
| 398 | 406 |
| 399 const GURL& originating_url() const { return data_.originating_url; } | 407 const GURL& originating_url() const { return data_.originating_url; } |
| 400 | 408 |
| 409 const std::string& search_terms_replacement_key() const { |
| 410 return data_.search_terms_replacement_key; |
| 411 } |
| 412 |
| 401 bool show_in_default_list() const { return data_.show_in_default_list; } | 413 bool show_in_default_list() const { return data_.show_in_default_list; } |
| 402 // Returns true if show_in_default_list() is true and this TemplateURL has a | 414 // Returns true if show_in_default_list() is true and this TemplateURL has a |
| 403 // TemplateURLRef that supports replacement. | 415 // TemplateURLRef that supports replacement. |
| 404 bool ShowInDefaultList() const; | 416 bool ShowInDefaultList() const; |
| 405 | 417 |
| 406 bool safe_for_autoreplace() const { return data_.safe_for_autoreplace; } | 418 bool safe_for_autoreplace() const { return data_.safe_for_autoreplace; } |
| 407 | 419 |
| 408 const std::vector<std::string>& input_encodings() const { | 420 const std::vector<std::string>& input_encodings() const { |
| 409 return data_.input_encodings; | 421 return data_.input_encodings; |
| 410 } | 422 } |
| (...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 489 TemplateURLRef url_ref_; | 501 TemplateURLRef url_ref_; |
| 490 TemplateURLRef suggestions_url_ref_; | 502 TemplateURLRef suggestions_url_ref_; |
| 491 TemplateURLRef instant_url_ref_; | 503 TemplateURLRef instant_url_ref_; |
| 492 | 504 |
| 493 // TODO(sky): Add date last parsed OSD file. | 505 // TODO(sky): Add date last parsed OSD file. |
| 494 | 506 |
| 495 DISALLOW_COPY_AND_ASSIGN(TemplateURL); | 507 DISALLOW_COPY_AND_ASSIGN(TemplateURL); |
| 496 }; | 508 }; |
| 497 | 509 |
| 498 #endif // CHROME_BROWSER_SEARCH_ENGINES_TEMPLATE_URL_H_ | 510 #endif // CHROME_BROWSER_SEARCH_ENGINES_TEMPLATE_URL_H_ |
| OLD | NEW |