Chromium Code Reviews| 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 147 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 158 // Enumeration of the known types. | 158 // Enumeration of the known types. |
| 159 enum ReplacementType { | 159 enum ReplacementType { |
| 160 ENCODING, | 160 ENCODING, |
| 161 GOOGLE_ACCEPTED_SUGGESTION, | 161 GOOGLE_ACCEPTED_SUGGESTION, |
| 162 GOOGLE_ASSISTED_QUERY_STATS, | 162 GOOGLE_ASSISTED_QUERY_STATS, |
| 163 GOOGLE_BASE_URL, | 163 GOOGLE_BASE_URL, |
| 164 GOOGLE_BASE_SUGGEST_URL, | 164 GOOGLE_BASE_SUGGEST_URL, |
| 165 GOOGLE_CURSOR_POSITION, | 165 GOOGLE_CURSOR_POSITION, |
| 166 GOOGLE_INSTANT_ENABLED, | 166 GOOGLE_INSTANT_ENABLED, |
| 167 GOOGLE_INSTANT_EXTENDED_ENABLED, | 167 GOOGLE_INSTANT_EXTENDED_ENABLED, |
| 168 GOOGLE_INSTANT_EXTENDED_ENABLED_KEY, | |
| 168 GOOGLE_ORIGINAL_QUERY_FOR_SUGGESTION, | 169 GOOGLE_ORIGINAL_QUERY_FOR_SUGGESTION, |
| 169 GOOGLE_RLZ, | 170 GOOGLE_RLZ, |
| 170 GOOGLE_SEARCH_CLIENT, | 171 GOOGLE_SEARCH_CLIENT, |
| 171 GOOGLE_SEARCH_FIELDTRIAL_GROUP, | 172 GOOGLE_SEARCH_FIELDTRIAL_GROUP, |
| 172 GOOGLE_UNESCAPED_SEARCH_TERMS, | 173 GOOGLE_UNESCAPED_SEARCH_TERMS, |
| 173 LANGUAGE, | 174 LANGUAGE, |
| 174 SEARCH_TERMS, | 175 SEARCH_TERMS, |
| 175 }; | 176 }; |
| 176 | 177 |
| 177 // Used to identify an element of the raw url that can be replaced. | 178 // 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... | |
| 346 int prepopulate_id; | 347 int prepopulate_id; |
| 347 | 348 |
| 348 // The primary unique identifier for Sync. This set on all TemplateURLs | 349 // The primary unique identifier for Sync. This set on all TemplateURLs |
| 349 // regardless of whether they have been associated with Sync. | 350 // regardless of whether they have been associated with Sync. |
| 350 std::string sync_guid; | 351 std::string sync_guid; |
| 351 | 352 |
| 352 // A list of URL patterns that can be used, in addition to |url_|, to extract | 353 // A list of URL patterns that can be used, in addition to |url_|, to extract |
| 353 // search terms from a URL. | 354 // search terms from a URL. |
| 354 std::vector<std::string> alternate_urls; | 355 std::vector<std::string> alternate_urls; |
| 355 | 356 |
| 357 | |
|
Peter Kasting
2012/12/18 01:54:43
Nit: Extra newline
beaudoin
2012/12/20 04:23:29
Done.
| |
| 358 // A parameter that, if present and non-zero in a search_url or instant_url, | |
| 359 // causes Chrome to replace the URL with the search term. | |
| 360 // The parameter must be in the query if the search terms are in the query, | |
| 361 // and in the ref if the search terms are in the ref. | |
| 362 std::string search_terms_replacement_key; | |
| 363 | |
| 356 private: | 364 private: |
| 357 // Private so we can enforce using the setters and thus enforce that these | 365 // Private so we can enforce using the setters and thus enforce that these |
| 358 // fields are never empty. | 366 // fields are never empty. |
| 359 string16 keyword_; | 367 string16 keyword_; |
| 360 std::string url_; | 368 std::string url_; |
| 361 }; | 369 }; |
| 362 | 370 |
| 363 | 371 |
| 364 // TemplateURL ---------------------------------------------------------------- | 372 // TemplateURL ---------------------------------------------------------------- |
| 365 | 373 |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 397 const std::string& url() const { return data_.url(); } | 405 const std::string& url() const { return data_.url(); } |
| 398 const std::string& suggestions_url() const { return data_.suggestions_url; } | 406 const std::string& suggestions_url() const { return data_.suggestions_url; } |
| 399 const std::string& instant_url() const { return data_.instant_url; } | 407 const std::string& instant_url() const { return data_.instant_url; } |
| 400 const std::vector<std::string>& alternate_urls() const { | 408 const std::vector<std::string>& alternate_urls() const { |
| 401 return data_.alternate_urls; | 409 return data_.alternate_urls; |
| 402 } | 410 } |
| 403 const GURL& favicon_url() const { return data_.favicon_url; } | 411 const GURL& favicon_url() const { return data_.favicon_url; } |
| 404 | 412 |
| 405 const GURL& originating_url() const { return data_.originating_url; } | 413 const GURL& originating_url() const { return data_.originating_url; } |
| 406 | 414 |
| 415 const std::string& search_terms_replacement_key() const { | |
| 416 return data_.search_terms_replacement_key; | |
| 417 } | |
|
Peter Kasting
2012/12/18 01:54:43
Nit: Keep the accessor/mutator order here the same
beaudoin
2012/12/20 04:23:29
Done.
| |
| 418 | |
| 407 bool show_in_default_list() const { return data_.show_in_default_list; } | 419 bool show_in_default_list() const { return data_.show_in_default_list; } |
| 408 // Returns true if show_in_default_list() is true and this TemplateURL has a | 420 // Returns true if show_in_default_list() is true and this TemplateURL has a |
| 409 // TemplateURLRef that supports replacement. | 421 // TemplateURLRef that supports replacement. |
| 410 bool ShowInDefaultList() const; | 422 bool ShowInDefaultList() const; |
| 411 | 423 |
| 412 bool safe_for_autoreplace() const { return data_.safe_for_autoreplace; } | 424 bool safe_for_autoreplace() const { return data_.safe_for_autoreplace; } |
| 413 | 425 |
| 414 const std::vector<std::string>& input_encodings() const { | 426 const std::vector<std::string>& input_encodings() const { |
| 415 return data_.input_encodings; | 427 return data_.input_encodings; |
| 416 } | 428 } |
| (...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 495 TemplateURLRef url_ref_; | 507 TemplateURLRef url_ref_; |
| 496 TemplateURLRef suggestions_url_ref_; | 508 TemplateURLRef suggestions_url_ref_; |
| 497 TemplateURLRef instant_url_ref_; | 509 TemplateURLRef instant_url_ref_; |
| 498 | 510 |
| 499 // TODO(sky): Add date last parsed OSD file. | 511 // TODO(sky): Add date last parsed OSD file. |
| 500 | 512 |
| 501 DISALLOW_COPY_AND_ASSIGN(TemplateURL); | 513 DISALLOW_COPY_AND_ASSIGN(TemplateURL); |
| 502 }; | 514 }; |
| 503 | 515 |
| 504 #endif // CHROME_BROWSER_SEARCH_ENGINES_TEMPLATE_URL_H_ | 516 #endif // CHROME_BROWSER_SEARCH_ENGINES_TEMPLATE_URL_H_ |
| OLD | NEW |