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_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 328 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 339 Profile* profile() const { return profile_; } | 339 Profile* profile() const { return profile_; } |
| 340 | 340 |
| 341 // Returns a SearchTermsData which can be used to call TemplateURL methods. | 341 // Returns a SearchTermsData which can be used to call TemplateURL methods. |
| 342 // Note: Prefer using this method to instantiating UIThreadSearchTermsData on | 342 // Note: Prefer using this method to instantiating UIThreadSearchTermsData on |
| 343 // your own, especially when your code hasn't depended on Profile, to avoid | 343 // your own, especially when your code hasn't depended on Profile, to avoid |
| 344 // adding a new dependency on Profile. | 344 // adding a new dependency on Profile. |
| 345 const SearchTermsData& search_terms_data() const { | 345 const SearchTermsData& search_terms_data() const { |
| 346 return *search_terms_data_; | 346 return *search_terms_data_; |
| 347 } | 347 } |
| 348 | 348 |
| 349 void set_dsp_changed_to_google_event_recorder( | |
| 350 const base::Closure& dsp_changed_to_google_event_recorder) { | |
| 351 dsp_changed_to_google_event_recorder_ = | |
| 352 dsp_changed_to_google_event_recorder; | |
| 353 } | |
| 354 | |
| 349 // Returns a SyncData with a sync representation of the search engine data | 355 // Returns a SyncData with a sync representation of the search engine data |
| 350 // from |turl|. | 356 // from |turl|. |
| 351 static syncer::SyncData CreateSyncDataFromTemplateURL( | 357 static syncer::SyncData CreateSyncDataFromTemplateURL( |
| 352 const TemplateURL& turl); | 358 const TemplateURL& turl); |
| 353 | 359 |
| 354 // Creates a new heap-allocated TemplateURL* which is populated by overlaying | 360 // Creates a new heap-allocated TemplateURL* which is populated by overlaying |
| 355 // |sync_data| atop |existing_turl|. |existing_turl| may be NULL; if not it | 361 // |sync_data| atop |existing_turl|. |existing_turl| may be NULL; if not it |
| 356 // remains unmodified. The caller owns the returned TemplateURL*. | 362 // remains unmodified. The caller owns the returned TemplateURL*. |
| 357 // | 363 // |
| 358 // If the created TemplateURL is migrated in some way from out-of-date sync | 364 // If the created TemplateURL is migrated in some way from out-of-date sync |
| (...skipping 315 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 | 680 // 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. | 681 // obtained from the Profile. This allows us to lazily access the database. |
| 676 Profile* profile_; | 682 Profile* profile_; |
| 677 | 683 |
| 678 PrefService* prefs_; | 684 PrefService* prefs_; |
| 679 | 685 |
| 680 rappor::RapporService* rappor_service_; | 686 rappor::RapporService* rappor_service_; |
| 681 | 687 |
| 682 scoped_ptr<SearchTermsData> search_terms_data_; | 688 scoped_ptr<SearchTermsData> search_terms_data_; |
| 683 | 689 |
| 690 // This closure is run when the default search provider is set to google. | |
| 691 base::Closure dsp_changed_to_google_event_recorder_; | |
|
Peter Kasting
2014/07/01 18:19:08
Let's just call this |dsp_change_callback_| and re
hashimoto
2014/07/01 23:24:49
Done.
| |
| 692 | |
| 684 // Whether the keywords have been loaded. | 693 // Whether the keywords have been loaded. |
| 685 bool loaded_; | 694 bool loaded_; |
| 686 | 695 |
| 687 // Set when the web data service fails to load properly. This prevents | 696 // 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 | 697 // further communication with sync or writing to prefs, so we don't persist |
| 689 // inconsistent state data anywhere. | 698 // inconsistent state data anywhere. |
| 690 bool load_failed_; | 699 bool load_failed_; |
| 691 | 700 |
| 692 // If non-zero, we're waiting on a load. | 701 // If non-zero, we're waiting on a load. |
| 693 WebDataService::Handle load_handle_; | 702 WebDataService::Handle load_handle_; |
| (...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 749 | 758 |
| 750 // Helper class to manage the default search engine. | 759 // Helper class to manage the default search engine. |
| 751 DefaultSearchManager default_search_manager_; | 760 DefaultSearchManager default_search_manager_; |
| 752 | 761 |
| 753 scoped_ptr<GoogleURLTracker::Subscription> google_url_updated_subscription_; | 762 scoped_ptr<GoogleURLTracker::Subscription> google_url_updated_subscription_; |
| 754 | 763 |
| 755 DISALLOW_COPY_AND_ASSIGN(TemplateURLService); | 764 DISALLOW_COPY_AND_ASSIGN(TemplateURLService); |
| 756 }; | 765 }; |
| 757 | 766 |
| 758 #endif // CHROME_BROWSER_SEARCH_ENGINES_TEMPLATE_URL_SERVICE_H_ | 767 #endif // CHROME_BROWSER_SEARCH_ENGINES_TEMPLATE_URL_SERVICE_H_ |
| OLD | NEW |