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_SERVICE_H_ | 5 #ifndef CHROME_BROWSER_SEARCH_ENGINES_TEMPLATE_URL_SERVICE_H_ |
6 #define CHROME_BROWSER_SEARCH_ENGINES_TEMPLATE_URL_SERVICE_H_ | 6 #define CHROME_BROWSER_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 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
83 | 83 |
84 // Struct used for initializing the data store with fake data. | 84 // Struct used for initializing the data store with fake data. |
85 // Each initializer is mapped to a TemplateURL. | 85 // Each initializer is mapped to a TemplateURL. |
86 struct Initializer { | 86 struct Initializer { |
87 const char* const keyword; | 87 const char* const keyword; |
88 const char* const url; | 88 const char* const url; |
89 const char* const content; | 89 const char* const content; |
90 }; | 90 }; |
91 | 91 |
92 TemplateURLService(Profile* profile, | 92 TemplateURLService(Profile* profile, |
93 rappor::RapporService* rappor_service); | 93 rappor::RapporService* rappor_service, |
| 94 const base::Closure& dsp_change_callback); |
94 // The following is for testing. | 95 // The following is for testing. |
95 TemplateURLService(const Initializer* initializers, const int count); | 96 TemplateURLService(const Initializer* initializers, const int count); |
96 virtual ~TemplateURLService(); | 97 virtual ~TemplateURLService(); |
97 | 98 |
98 // Creates a TemplateURLData that was previously saved to |prefs| via | 99 // Creates a TemplateURLData that was previously saved to |prefs| via |
99 // SaveDefaultSearchProviderToPrefs or set via policy. | 100 // SaveDefaultSearchProviderToPrefs or set via policy. |
100 // Returns true if successful, false otherwise. | 101 // Returns true if successful, false otherwise. |
101 // If the user or the policy has opted for no default search, this | 102 // If the user or the policy has opted for no default search, this |
102 // returns true but default_provider is set to NULL. | 103 // returns true but default_provider is set to NULL. |
103 // |*is_managed| specifies whether the default is managed via policy. | 104 // |*is_managed| specifies whether the default is managed via policy. |
(...skipping 570 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
674 // When Load is invoked, if we haven't yet loaded, the WebDataService is | 675 // When Load is invoked, if we haven't yet loaded, the WebDataService is |
675 // obtained from the Profile. This allows us to lazily access the database. | 676 // obtained from the Profile. This allows us to lazily access the database. |
676 Profile* profile_; | 677 Profile* profile_; |
677 | 678 |
678 PrefService* prefs_; | 679 PrefService* prefs_; |
679 | 680 |
680 rappor::RapporService* rappor_service_; | 681 rappor::RapporService* rappor_service_; |
681 | 682 |
682 scoped_ptr<SearchTermsData> search_terms_data_; | 683 scoped_ptr<SearchTermsData> search_terms_data_; |
683 | 684 |
| 685 // This closure is run when the default search provider is set to Google. |
| 686 base::Closure dsp_change_callback_; |
| 687 |
684 // Whether the keywords have been loaded. | 688 // Whether the keywords have been loaded. |
685 bool loaded_; | 689 bool loaded_; |
686 | 690 |
687 // Set when the web data service fails to load properly. This prevents | 691 // Set when the web data service fails to load properly. This prevents |
688 // further communication with sync or writing to prefs, so we don't persist | 692 // further communication with sync or writing to prefs, so we don't persist |
689 // inconsistent state data anywhere. | 693 // inconsistent state data anywhere. |
690 bool load_failed_; | 694 bool load_failed_; |
691 | 695 |
692 // If non-zero, we're waiting on a load. | 696 // If non-zero, we're waiting on a load. |
693 WebDataService::Handle load_handle_; | 697 WebDataService::Handle load_handle_; |
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
749 | 753 |
750 // Helper class to manage the default search engine. | 754 // Helper class to manage the default search engine. |
751 DefaultSearchManager default_search_manager_; | 755 DefaultSearchManager default_search_manager_; |
752 | 756 |
753 scoped_ptr<GoogleURLTracker::Subscription> google_url_updated_subscription_; | 757 scoped_ptr<GoogleURLTracker::Subscription> google_url_updated_subscription_; |
754 | 758 |
755 DISALLOW_COPY_AND_ASSIGN(TemplateURLService); | 759 DISALLOW_COPY_AND_ASSIGN(TemplateURLService); |
756 }; | 760 }; |
757 | 761 |
758 #endif // CHROME_BROWSER_SEARCH_ENGINES_TEMPLATE_URL_SERVICE_H_ | 762 #endif // CHROME_BROWSER_SEARCH_ENGINES_TEMPLATE_URL_SERVICE_H_ |
OLD | NEW |