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 458 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
469 // This does NOT notify the delegate or the database. | 469 // This does NOT notify the delegate or the database. |
470 // | 470 // |
471 // This transfers ownership of the elements in |urls| to |this|, and may | 471 // This transfers ownership of the elements in |urls| to |this|, and may |
472 // delete some elements, so it's not safe for callers to access any elements | 472 // delete some elements, so it's not safe for callers to access any elements |
473 // after calling; to reinforce this, this function clears |urls| on exit. | 473 // after calling; to reinforce this, this function clears |urls| on exit. |
474 void SetTemplateURLs(TemplateURLVector* urls); | 474 void SetTemplateURLs(TemplateURLVector* urls); |
475 | 475 |
476 // Transitions to the loaded state. | 476 // Transitions to the loaded state. |
477 void ChangeToLoadedState(); | 477 void ChangeToLoadedState(); |
478 | 478 |
| 479 // Copies |initial_default_search_provider_| in as the actual default search |
| 480 // provider and finishes the transition to the loading state. This is called |
| 481 // in test code, or when some kind of corruption prevents the WebDataService |
| 482 // from loading, so the TemplateURLService doesn't suddenly begin reporting |
| 483 // "no DSP" once it attempts to load. |
| 484 void OnFailedLoad(); |
| 485 |
479 // Clears user preferences describing the default search engine. | 486 // Clears user preferences describing the default search engine. |
480 void ClearDefaultProviderFromPrefs(); | 487 void ClearDefaultProviderFromPrefs(); |
481 | 488 |
482 // Returns true if there is no TemplateURL that has a search url with the | 489 // Returns true if there is no TemplateURL that has a search url with the |
483 // specified host, or the only TemplateURLs matching the specified host can | 490 // specified host, or the only TemplateURLs matching the specified host can |
484 // be replaced. | 491 // be replaced. |
485 bool CanReplaceKeywordForHost(const std::string& host, | 492 bool CanReplaceKeywordForHost(const std::string& host, |
486 TemplateURL** to_replace); | 493 TemplateURL** to_replace); |
487 | 494 |
488 // Returns true if the TemplateURL is replaceable. This doesn't look at the | 495 // Returns true if the TemplateURL is replaceable. This doesn't look at the |
(...skipping 293 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
782 base::CallbackList<void(void)> on_loaded_callbacks_; | 789 base::CallbackList<void(void)> on_loaded_callbacks_; |
783 | 790 |
784 // Helper class to manage the default search engine. This will be NULL when | 791 // Helper class to manage the default search engine. This will be NULL when |
785 // using the testing-specific constructor. | 792 // using the testing-specific constructor. |
786 scoped_ptr<DefaultSearchManager> default_search_manager_; | 793 scoped_ptr<DefaultSearchManager> default_search_manager_; |
787 | 794 |
788 DISALLOW_COPY_AND_ASSIGN(TemplateURLService); | 795 DISALLOW_COPY_AND_ASSIGN(TemplateURLService); |
789 }; | 796 }; |
790 | 797 |
791 #endif // CHROME_BROWSER_SEARCH_ENGINES_TEMPLATE_URL_SERVICE_H_ | 798 #endif // CHROME_BROWSER_SEARCH_ENGINES_TEMPLATE_URL_SERVICE_H_ |
OLD | NEW |