| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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> |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 42 // parameter. Most callers aren't using Suggest capabilities and should just | 42 // parameter. Most callers aren't using Suggest capabilities and should just |
| 43 // pass NO_SUGGESTIONS_AVAILABLE. | 43 // pass NO_SUGGESTIONS_AVAILABLE. |
| 44 // NOTE: Because positive values are meaningful, make sure these are negative! | 44 // NOTE: Because positive values are meaningful, make sure these are negative! |
| 45 enum AcceptedSuggestion { | 45 enum AcceptedSuggestion { |
| 46 NO_SUGGESTION_CHOSEN = -1, | 46 NO_SUGGESTION_CHOSEN = -1, |
| 47 NO_SUGGESTIONS_AVAILABLE = -2, | 47 NO_SUGGESTIONS_AVAILABLE = -2, |
| 48 }; | 48 }; |
| 49 | 49 |
| 50 TemplateURLRef(); | 50 TemplateURLRef(); |
| 51 | 51 |
| 52 TemplateURLRef(const std::string& url, int index_offset, int page_offset) | 52 TemplateURLRef(const std::string& url, int index_offset, int page_offset); |
| 53 : url_(url), | 53 |
| 54 index_offset_(index_offset), | 54 ~TemplateURLRef(); |
| 55 page_offset_(page_offset), | |
| 56 parsed_(false), | |
| 57 valid_(false), | |
| 58 supports_replacements_(false) { | |
| 59 } | |
| 60 | 55 |
| 61 // Returns true if this URL supports replacement. | 56 // Returns true if this URL supports replacement. |
| 62 bool SupportsReplacement() const; | 57 bool SupportsReplacement() const; |
| 63 | 58 |
| 64 // Returns a string that is the result of replacing the search terms in | 59 // Returns a string that is the result of replacing the search terms in |
| 65 // the url with the specified value. | 60 // the url with the specified value. |
| 66 // | 61 // |
| 67 // If this TemplateURLRef does not support replacement (SupportsReplacement | 62 // If this TemplateURLRef does not support replacement (SupportsReplacement |
| 68 // returns false), an empty string is returned. | 63 // returns false), an empty string is returned. |
| 69 // | 64 // |
| (...skipping 192 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 262 GURL url; | 257 GURL url; |
| 263 }; | 258 }; |
| 264 | 259 |
| 265 // Generates a favicon URL from the specified url. | 260 // Generates a favicon URL from the specified url. |
| 266 static GURL GenerateFaviconURL(const GURL& url); | 261 static GURL GenerateFaviconURL(const GURL& url); |
| 267 | 262 |
| 268 // Returns true if |true| is non-null and has a search URL that supports | 263 // Returns true if |true| is non-null and has a search URL that supports |
| 269 // replacement. | 264 // replacement. |
| 270 static bool SupportsReplacement(const TemplateURL* turl); | 265 static bool SupportsReplacement(const TemplateURL* turl); |
| 271 | 266 |
| 272 TemplateURL() | 267 TemplateURL(); |
| 273 : autogenerate_keyword_(false), | 268 ~TemplateURL(); |
| 274 keyword_generated_(false), | |
| 275 show_in_default_list_(false), | |
| 276 safe_for_autoreplace_(false), | |
| 277 id_(0), | |
| 278 date_created_(base::Time::Now()), | |
| 279 usage_count_(0), | |
| 280 search_engine_type_(TemplateURLPrepopulateData::SEARCH_ENGINE_OTHER), | |
| 281 logo_id_(0), | |
| 282 prepopulate_id_(0) {} | |
| 283 ~TemplateURL() {} | |
| 284 | 269 |
| 285 // A short description of the template. This is the name we show to the user | 270 // A short description of the template. This is the name we show to the user |
| 286 // in various places that use keywords. For example, the location bar shows | 271 // in various places that use keywords. For example, the location bar shows |
| 287 // this when the user selects the keyword. | 272 // this when the user selects the keyword. |
| 288 void set_short_name(const std::wstring& short_name) { | 273 void set_short_name(const std::wstring& short_name) { |
| 289 short_name_ = short_name; | 274 short_name_ = short_name; |
| 290 } | 275 } |
| 291 const std::wstring& short_name() const { return short_name_; } | 276 const std::wstring& short_name() const { return short_name_; } |
| 292 | 277 |
| 293 // An accessor for the short_name, but adjusted so it can be appropriately | 278 // An accessor for the short_name, but adjusted so it can be appropriately |
| (...skipping 184 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 478 base::Time date_created_; | 463 base::Time date_created_; |
| 479 int usage_count_; | 464 int usage_count_; |
| 480 TemplateURLPrepopulateData::SearchEngineType search_engine_type_; | 465 TemplateURLPrepopulateData::SearchEngineType search_engine_type_; |
| 481 int logo_id_; | 466 int logo_id_; |
| 482 int prepopulate_id_; | 467 int prepopulate_id_; |
| 483 | 468 |
| 484 // TODO(sky): Add date last parsed OSD file. | 469 // TODO(sky): Add date last parsed OSD file. |
| 485 }; | 470 }; |
| 486 | 471 |
| 487 #endif // CHROME_BROWSER_SEARCH_ENGINES_TEMPLATE_URL_H_ | 472 #endif // CHROME_BROWSER_SEARCH_ENGINES_TEMPLATE_URL_H_ |
| OLD | NEW |