| 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 211 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 222 const std::string& search_url); | 222 const std::string& search_url); |
| 223 | 223 |
| 224 // Return true if the given |url| can be made the default. This returns false | 224 // Return true if the given |url| can be made the default. This returns false |
| 225 // regardless of |url| if the default search provider is managed by policy or | 225 // regardless of |url| if the default search provider is managed by policy or |
| 226 // controlled by an extension. | 226 // controlled by an extension. |
| 227 bool CanMakeDefault(const TemplateURL* url); | 227 bool CanMakeDefault(const TemplateURL* url); |
| 228 | 228 |
| 229 // Set the default search provider. |url| may be null. | 229 // Set the default search provider. |url| may be null. |
| 230 // This will assert if the default search is managed; the UI should not be | 230 // This will assert if the default search is managed; the UI should not be |
| 231 // invoking this method in that situation. | 231 // invoking this method in that situation. |
| 232 void SetDefaultSearchProvider(TemplateURL* url); | 232 void SetUserSelectedDefaultSearchProvider(TemplateURL* url); |
| 233 | 233 |
| 234 // Returns the default search provider. If the TemplateURLService hasn't been | 234 // Returns the default search provider. If the TemplateURLService hasn't been |
| 235 // loaded, the default search provider is pulled from preferences. | 235 // loaded, the default search provider is pulled from preferences. |
| 236 // | 236 // |
| 237 // NOTE: At least in unittest mode, this may return NULL. | 237 // NOTE: At least in unittest mode, this may return NULL. |
| 238 TemplateURL* GetDefaultSearchProvider(); | 238 TemplateURL* GetDefaultSearchProvider(); |
| 239 | 239 |
| 240 // Returns true if the |url| is a search results page from the default search | 240 // Returns true if the |url| is a search results page from the default search |
| 241 // provider. | 241 // provider. |
| 242 bool IsSearchResultsPageFromDefaultSearchProvider(const GURL& url); | 242 bool IsSearchResultsPageFromDefaultSearchProvider(const GURL& url); |
| (...skipping 280 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 523 | 523 |
| 524 // Invoked when the Google base URL has changed. Updates the mapping for all | 524 // Invoked when the Google base URL has changed. Updates the mapping for all |
| 525 // TemplateURLs that have a replacement term of {google:baseURL} or | 525 // TemplateURLs that have a replacement term of {google:baseURL} or |
| 526 // {google:baseSuggestURL}. | 526 // {google:baseSuggestURL}. |
| 527 void GoogleBaseURLChanged(const GURL& old_base_url); | 527 void GoogleBaseURLChanged(const GURL& old_base_url); |
| 528 | 528 |
| 529 // Update the default search. Called at initialization or when a managed | 529 // Update the default search. Called at initialization or when a managed |
| 530 // preference has changed. | 530 // preference has changed. |
| 531 void UpdateDefaultSearch(); | 531 void UpdateDefaultSearch(); |
| 532 | 532 |
| 533 // Set the default search provider. |url| may be user-selected or |
| 534 // automatically selected and may be null. |
| 535 // This will assert if the default search is managed. |
| 536 void SetDefaultSearchProvider(TemplateURL* url); |
| 537 |
| 533 // Set the default search provider even if it is managed. |url| may be null. | 538 // Set the default search provider even if it is managed. |url| may be null. |
| 534 // Caller is responsible for notifying observers. Returns whether |url| was | 539 // Caller is responsible for notifying observers. Returns whether |url| was |
| 535 // found in |template_urls_|. | 540 // found in |template_urls_|. |
| 536 // If |url| is an extension-controlled search engine then preferences and the | 541 // If |url| is an extension-controlled search engine then preferences and the |
| 537 // database are left untouched. | 542 // database are left untouched. |
| 538 // If |url| is a normal search engine and the existing default search engine | 543 // If |url| is a normal search engine and the existing default search engine |
| 539 // is controlled by an extension then |url| is propagated to the database and | 544 // is controlled by an extension then |url| is propagated to the database and |
| 540 // prefs but the extension-controlled default engine will continue to hide | 545 // prefs but the extension-controlled default engine will continue to hide |
| 541 // this value until the extension is uninstalled. | 546 // this value until the extension is uninstalled. |
| 542 bool SetDefaultSearchProviderNoNotify(TemplateURL* url); | 547 bool SetDefaultSearchProviderNoNotify(TemplateURL* url); |
| (...skipping 225 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 768 // cause/origin of a default search change. | 773 // cause/origin of a default search change. |
| 769 DefaultSearchChangeOrigin dsp_change_origin_; | 774 DefaultSearchChangeOrigin dsp_change_origin_; |
| 770 | 775 |
| 771 // Stores a list of callbacks to be run after TemplateURLService has loaded. | 776 // Stores a list of callbacks to be run after TemplateURLService has loaded. |
| 772 base::CallbackList<void(void)> on_loaded_callbacks_; | 777 base::CallbackList<void(void)> on_loaded_callbacks_; |
| 773 | 778 |
| 774 DISALLOW_COPY_AND_ASSIGN(TemplateURLService); | 779 DISALLOW_COPY_AND_ASSIGN(TemplateURLService); |
| 775 }; | 780 }; |
| 776 | 781 |
| 777 #endif // CHROME_BROWSER_SEARCH_ENGINES_TEMPLATE_URL_SERVICE_H_ | 782 #endif // CHROME_BROWSER_SEARCH_ENGINES_TEMPLATE_URL_SERVICE_H_ |
| OLD | NEW |