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 379 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
390 static TemplateURL* CreateTemplateURLFromTemplateURLAndSyncData( | 390 static TemplateURL* CreateTemplateURLFromTemplateURLAndSyncData( |
391 Profile* profile, | 391 Profile* profile, |
392 TemplateURL* existing_turl, | 392 TemplateURL* existing_turl, |
393 const syncer::SyncData& sync_data, | 393 const syncer::SyncData& sync_data, |
394 syncer::SyncChangeList* change_list); | 394 syncer::SyncChangeList* change_list); |
395 | 395 |
396 // Returns a map mapping Sync GUIDs to pointers to syncer::SyncData. | 396 // Returns a map mapping Sync GUIDs to pointers to syncer::SyncData. |
397 static SyncDataMap CreateGUIDToSyncDataMap( | 397 static SyncDataMap CreateGUIDToSyncDataMap( |
398 const syncer::SyncDataList& sync_data); | 398 const syncer::SyncDataList& sync_data); |
399 | 399 |
400 // Indicates whether the pre-populated TemplateURLs should be disabled. May | |
401 // only be true in tests. | |
402 static bool fallback_search_engines_disabled() { | |
403 return g_fallback_search_engines_disabled; | |
404 } | |
405 | |
406 #if defined(UNIT_TEST) | 400 #if defined(UNIT_TEST) |
407 // Disables the pre-populated TemplateURLs for testing purposes. | |
408 static void set_fallback_search_engines_disabled(bool disabled) { | |
409 g_fallback_search_engines_disabled = disabled; | |
410 } | |
411 | |
412 // Sets a different time provider function, such as | 401 // Sets a different time provider function, such as |
413 // base::MockTimeProvider::StaticNow, for testing calls to base::Time::Now. | 402 // base::MockTimeProvider::StaticNow, for testing calls to base::Time::Now. |
414 void set_time_provider(TimeProvider* time_provider) { | 403 void set_time_provider(TimeProvider* time_provider) { |
415 time_provider_ = time_provider; | 404 time_provider_ = time_provider; |
416 } | 405 } |
417 #endif | 406 #endif |
418 | 407 |
419 protected: | 408 protected: |
420 // Cover method for the method of the same name on the HistoryService. | 409 // Cover method for the method of the same name on the HistoryService. |
421 // url is the one that was visited with the given search terms. | 410 // url is the one that was visited with the given search terms. |
(...skipping 366 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
788 DefaultSearchChangeOrigin dsp_change_origin_; | 777 DefaultSearchChangeOrigin dsp_change_origin_; |
789 | 778 |
790 // Stores a list of callbacks to be run after TemplateURLService has loaded. | 779 // Stores a list of callbacks to be run after TemplateURLService has loaded. |
791 base::CallbackList<void(void)> on_loaded_callbacks_; | 780 base::CallbackList<void(void)> on_loaded_callbacks_; |
792 | 781 |
793 // Helper class to manage the default search engine. | 782 // Helper class to manage the default search engine. |
794 DefaultSearchManager default_search_manager_; | 783 DefaultSearchManager default_search_manager_; |
795 | 784 |
796 scoped_ptr<GoogleURLTracker::Subscription> google_url_updated_subscription_; | 785 scoped_ptr<GoogleURLTracker::Subscription> google_url_updated_subscription_; |
797 | 786 |
798 // Used to disable the prepopulated search engines in tests. | |
799 static bool g_fallback_search_engines_disabled; | |
800 | |
801 DISALLOW_COPY_AND_ASSIGN(TemplateURLService); | 787 DISALLOW_COPY_AND_ASSIGN(TemplateURLService); |
802 }; | 788 }; |
803 | 789 |
804 #endif // CHROME_BROWSER_SEARCH_ENGINES_TEMPLATE_URL_SERVICE_H_ | 790 #endif // CHROME_BROWSER_SEARCH_ENGINES_TEMPLATE_URL_SERVICE_H_ |
OLD | NEW |