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> |
11 | 11 |
12 #include "base/gtest_prod_util.h" | 12 #include "base/gtest_prod_util.h" |
13 #include "base/time.h" | 13 #include "base/time.h" |
14 #include "chrome/browser/search_engines/template_url_prepopulate_data.h" | 14 #include "chrome/browser/search_engines/template_url_prepopulate_data.h" |
15 #include "googleurl/src/gurl.h" | 15 #include "googleurl/src/gurl.h" |
16 | 16 |
17 class TemplateURL; | 17 class TemplateURL; |
| 18 class WebDataService; |
| 19 struct WDKeywordsResult; |
18 | 20 |
19 // TemplateURL represents the relevant portions of the Open Search Description | 21 // TemplateURL represents the relevant portions of the Open Search Description |
20 // Document (http://www.opensearch.org/Specifications/OpenSearch). | 22 // Document (http://www.opensearch.org/Specifications/OpenSearch). |
21 // The main use case for TemplateURL is to use the TemplateURLRef returned by | 23 // The main use case for TemplateURL is to use the TemplateURLRef returned by |
22 // suggestions_url or url for keyword/suggestion expansion: | 24 // suggestions_url or url for keyword/suggestion expansion: |
23 // . suggestions_url describes a URL that is ideal for as you type suggestions. | 25 // . suggestions_url describes a URL that is ideal for as you type suggestions. |
24 // The returned results are in the mime type application/x-suggestions+json. | 26 // The returned results are in the mime type application/x-suggestions+json. |
25 // . url describes a URL that may be used as a shortcut. Returned results are | 27 // . url describes a URL that may be used as a shortcut. Returned results are |
26 // are text/html. | 28 // are text/html. |
27 // Before using either one, make sure it's non-NULL, and if you intend to use | 29 // Before using either one, make sure it's non-NULL, and if you intend to use |
(...skipping 405 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
433 IDType id() const { return id_; } | 435 IDType id() const { return id_; } |
434 | 436 |
435 // If this TemplateURL comes from prepopulated data the prepopulate_id is > 0. | 437 // If this TemplateURL comes from prepopulated data the prepopulate_id is > 0. |
436 void set_prepopulate_id(int id) { prepopulate_id_ = id; } | 438 void set_prepopulate_id(int id) { prepopulate_id_ = id; } |
437 int prepopulate_id() const { return prepopulate_id_; } | 439 int prepopulate_id() const { return prepopulate_id_; } |
438 | 440 |
439 std::string GetExtensionId() const; | 441 std::string GetExtensionId() const; |
440 bool IsExtensionKeyword() const; | 442 bool IsExtensionKeyword() const; |
441 | 443 |
442 private: | 444 private: |
| 445 friend void MergeEnginesFromPrepopulateData( |
| 446 PrefService* prefs, |
| 447 WebDataService* service, |
| 448 std::vector<TemplateURL*>* template_urls, |
| 449 const TemplateURL** default_search_provider); |
443 friend class WebDatabaseTest; | 450 friend class WebDatabaseTest; |
444 friend class WebDatabase; | 451 friend class WebDatabase; |
445 friend class TemplateURLModel; | 452 friend class TemplateURLModel; |
446 | 453 |
447 // Invalidates cached values on this object and its child TemplateURLRefs. | 454 // Invalidates cached values on this object and its child TemplateURLRefs. |
448 void InvalidateCachedValues() const; | 455 void InvalidateCachedValues() const; |
449 | 456 |
450 // Unique identifier, used when archived to the database. | 457 // Unique identifier, used when archived to the database. |
451 void set_id(IDType id) { id_ = id;} | 458 void set_id(IDType id) { id_ = id;} |
452 | 459 |
(...skipping 18 matching lines...) Expand all Loading... |
471 base::Time date_created_; | 478 base::Time date_created_; |
472 int usage_count_; | 479 int usage_count_; |
473 TemplateURLPrepopulateData::SearchEngineType search_engine_type_; | 480 TemplateURLPrepopulateData::SearchEngineType search_engine_type_; |
474 int logo_id_; | 481 int logo_id_; |
475 int prepopulate_id_; | 482 int prepopulate_id_; |
476 | 483 |
477 // TODO(sky): Add date last parsed OSD file. | 484 // TODO(sky): Add date last parsed OSD file. |
478 }; | 485 }; |
479 | 486 |
480 #endif // CHROME_BROWSER_SEARCH_ENGINES_TEMPLATE_URL_H_ | 487 #endif // CHROME_BROWSER_SEARCH_ENGINES_TEMPLATE_URL_H_ |
OLD | NEW |