OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 COMPONENTS_SEARCH_ENGINES_TEMPLATE_URL_SERVICE_H_ | 5 #ifndef COMPONENTS_SEARCH_ENGINES_TEMPLATE_URL_SERVICE_H_ |
6 #define COMPONENTS_SEARCH_ENGINES_TEMPLATE_URL_SERVICE_H_ | 6 #define COMPONENTS_SEARCH_ENGINES_TEMPLATE_URL_SERVICE_H_ |
7 | 7 |
8 #include <list> | 8 #include <list> |
9 #include <map> | 9 #include <map> |
10 #include <set> | 10 #include <set> |
(...skipping 27 matching lines...) Expand all Loading... |
38 | 38 |
39 namespace rappor { | 39 namespace rappor { |
40 class RapporService; | 40 class RapporService; |
41 } | 41 } |
42 | 42 |
43 namespace syncer { | 43 namespace syncer { |
44 class SyncData; | 44 class SyncData; |
45 class SyncErrorFactory; | 45 class SyncErrorFactory; |
46 } | 46 } |
47 | 47 |
| 48 namespace user_prefs { |
| 49 class PrefRegistrySyncable; |
| 50 } |
| 51 |
48 // TemplateURLService is the backend for keywords. It's used by | 52 // TemplateURLService is the backend for keywords. It's used by |
49 // KeywordAutocomplete. | 53 // KeywordAutocomplete. |
50 // | 54 // |
51 // TemplateURLService stores a vector of TemplateURLs. The TemplateURLs are | 55 // TemplateURLService stores a vector of TemplateURLs. The TemplateURLs are |
52 // persisted to the database maintained by KeywordWebDataService. | 56 // persisted to the database maintained by KeywordWebDataService. |
53 // *ALL* mutations to the TemplateURLs must funnel through TemplateURLService. | 57 // *ALL* mutations to the TemplateURLs must funnel through TemplateURLService. |
54 // This allows TemplateURLService to notify listeners of changes as well as keep | 58 // This allows TemplateURLService to notify listeners of changes as well as keep |
55 // the database in sync. | 59 // the database in sync. |
56 // | 60 // |
57 // TemplateURLService does not load the vector of TemplateURLs in its | 61 // TemplateURLService does not load the vector of TemplateURLs in its |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
91 scoped_ptr<SearchTermsData> search_terms_data, | 95 scoped_ptr<SearchTermsData> search_terms_data, |
92 const scoped_refptr<KeywordWebDataService>& web_data_service, | 96 const scoped_refptr<KeywordWebDataService>& web_data_service, |
93 scoped_ptr<TemplateURLServiceClient> client, | 97 scoped_ptr<TemplateURLServiceClient> client, |
94 GoogleURLTracker* google_url_tracker, | 98 GoogleURLTracker* google_url_tracker, |
95 rappor::RapporService* rappor_service, | 99 rappor::RapporService* rappor_service, |
96 const base::Closure& dsp_change_callback); | 100 const base::Closure& dsp_change_callback); |
97 // The following is for testing. | 101 // The following is for testing. |
98 TemplateURLService(const Initializer* initializers, const int count); | 102 TemplateURLService(const Initializer* initializers, const int count); |
99 ~TemplateURLService() override; | 103 ~TemplateURLService() override; |
100 | 104 |
| 105 // Register Profile preferences in |registry|. |
| 106 static void RegisterProfilePrefs(user_prefs::PrefRegistrySyncable* registry); |
| 107 |
101 // Removes any unnecessary characters from a user input keyword. | 108 // Removes any unnecessary characters from a user input keyword. |
102 // This removes the leading scheme, "www." and any trailing slash. | 109 // This removes the leading scheme, "www." and any trailing slash. |
103 static base::string16 CleanUserInputKeyword(const base::string16& keyword); | 110 static base::string16 CleanUserInputKeyword(const base::string16& keyword); |
104 | 111 |
105 // Returns true if there is no TemplateURL that conflicts with the | 112 // Returns true if there is no TemplateURL that conflicts with the |
106 // keyword/url pair, or there is one but it can be replaced. If there is an | 113 // keyword/url pair, or there is one but it can be replaced. If there is an |
107 // existing keyword that can be replaced and template_url_to_replace is | 114 // existing keyword that can be replaced and template_url_to_replace is |
108 // non-NULL, template_url_to_replace is set to the keyword to replace. | 115 // non-NULL, template_url_to_replace is set to the keyword to replace. |
109 // | 116 // |
110 // |url| is the URL of the search query. This is used to prevent auto-adding | 117 // |url| is the URL of the search query. This is used to prevent auto-adding |
(...skipping 611 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
722 | 729 |
723 // Helper class to manage the default search engine. | 730 // Helper class to manage the default search engine. |
724 DefaultSearchManager default_search_manager_; | 731 DefaultSearchManager default_search_manager_; |
725 | 732 |
726 scoped_ptr<GoogleURLTracker::Subscription> google_url_updated_subscription_; | 733 scoped_ptr<GoogleURLTracker::Subscription> google_url_updated_subscription_; |
727 | 734 |
728 DISALLOW_COPY_AND_ASSIGN(TemplateURLService); | 735 DISALLOW_COPY_AND_ASSIGN(TemplateURLService); |
729 }; | 736 }; |
730 | 737 |
731 #endif // COMPONENTS_SEARCH_ENGINES_TEMPLATE_URL_SERVICE_H_ | 738 #endif // COMPONENTS_SEARCH_ENGINES_TEMPLATE_URL_SERVICE_H_ |
OLD | NEW |