Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 #pragma once | 7 #pragma once |
| 8 | 8 |
| 9 #include <map> | 9 #include <map> |
| 10 #include <set> | 10 #include <set> |
| (...skipping 184 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 195 | 195 |
| 196 // Returns the default search provider. If the TemplateURLService hasn't been | 196 // Returns the default search provider. If the TemplateURLService hasn't been |
| 197 // loaded, the default search provider is pulled from preferences. | 197 // loaded, the default search provider is pulled from preferences. |
| 198 // | 198 // |
| 199 // NOTE: At least in unittest mode, this may return NULL. | 199 // NOTE: At least in unittest mode, this may return NULL. |
| 200 const TemplateURL* GetDefaultSearchProvider(); | 200 const TemplateURL* GetDefaultSearchProvider(); |
| 201 | 201 |
| 202 // Returns true if the default search is managed through group policy. | 202 // Returns true if the default search is managed through group policy. |
| 203 bool is_default_search_managed() const { return is_default_search_managed_; } | 203 bool is_default_search_managed() const { return is_default_search_managed_; } |
| 204 | 204 |
| 205 // Returns the default search specified in the prepopulated data, if it | |
| 206 // exists. If not, returns first URL in |template_urls_|, or NULL if that's | |
| 207 // empty. | |
|
sky
2011/10/24 17:04:13
Document ownership of returned pointer.
whywhat
2011/10/25 10:30:41
Done.
| |
| 208 const TemplateURL* FindNewDefaultSearchProvider(); | |
| 209 | |
| 205 // Observers used to listen for changes to the model. | 210 // Observers used to listen for changes to the model. |
| 206 // TemplateURLService does NOT delete the observers when deleted. | 211 // TemplateURLService does NOT delete the observers when deleted. |
| 207 void AddObserver(TemplateURLServiceObserver* observer); | 212 void AddObserver(TemplateURLServiceObserver* observer); |
| 208 void RemoveObserver(TemplateURLServiceObserver* observer); | 213 void RemoveObserver(TemplateURLServiceObserver* observer); |
| 209 | 214 |
| 210 // Loads the keywords. This has no effect if the keywords have already been | 215 // Loads the keywords. This has no effect if the keywords have already been |
| 211 // loaded. | 216 // loaded. |
| 212 // Observers are notified when loading completes via the method | 217 // Observers are notified when loading completes via the method |
| 213 // OnTemplateURLServiceChanged. | 218 // OnTemplateURLServiceChanged. |
| 214 void Load(); | 219 void Load(); |
| (...skipping 203 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 418 | 423 |
| 419 // Invoked when the Google base URL has changed. Updates the mapping for all | 424 // Invoked when the Google base URL has changed. Updates the mapping for all |
| 420 // TemplateURLs that have a replacement term of {google:baseURL} or | 425 // TemplateURLs that have a replacement term of {google:baseURL} or |
| 421 // {google:baseSuggestURL}. | 426 // {google:baseSuggestURL}. |
| 422 void GoogleBaseURLChanged(); | 427 void GoogleBaseURLChanged(); |
| 423 | 428 |
| 424 // Update the default search. Called at initialization or when a managed | 429 // Update the default search. Called at initialization or when a managed |
| 425 // preference has changed. | 430 // preference has changed. |
| 426 void UpdateDefaultSearch(); | 431 void UpdateDefaultSearch(); |
| 427 | 432 |
| 428 // Returns the default search specified in the prepopulated data, if it | |
| 429 // exists. If not, returns first URL in |template_urls_|, or NULL if that's | |
| 430 // empty. | |
| 431 const TemplateURL* FindNewDefaultSearchProvider(); | |
| 432 | |
| 433 // Set the default search provider even if it is managed. |url| may be null. | 433 // Set the default search provider even if it is managed. |url| may be null. |
| 434 // Caller is responsible for notifying observers. | 434 // Caller is responsible for notifying observers. |
| 435 void SetDefaultSearchProviderNoNotify(const TemplateURL* url); | 435 void SetDefaultSearchProviderNoNotify(const TemplateURL* url); |
| 436 | 436 |
| 437 // Adds a new TemplateURL to this model. TemplateURLService will own the | 437 // Adds a new TemplateURL to this model. TemplateURLService will own the |
| 438 // reference, and delete it when the TemplateURL is removed. | 438 // reference, and delete it when the TemplateURL is removed. |
| 439 // Caller is responsible for notifying observers. | 439 // Caller is responsible for notifying observers. |
| 440 void AddNoNotify(TemplateURL* template_url); | 440 void AddNoNotify(TemplateURL* template_url); |
| 441 | 441 |
| 442 // Removes the keyword from the model. This deletes the supplied TemplateURL. | 442 // Removes the keyword from the model. This deletes the supplied TemplateURL. |
| (...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 570 // true, we ignore any local search engine changes, since we triggered them. | 570 // true, we ignore any local search engine changes, since we triggered them. |
| 571 bool processing_syncer_changes_; | 571 bool processing_syncer_changes_; |
| 572 | 572 |
| 573 // Sync's SyncChange handler. We push all our changes through this. | 573 // Sync's SyncChange handler. We push all our changes through this. |
| 574 SyncChangeProcessor* sync_processor_; | 574 SyncChangeProcessor* sync_processor_; |
| 575 | 575 |
| 576 DISALLOW_COPY_AND_ASSIGN(TemplateURLService); | 576 DISALLOW_COPY_AND_ASSIGN(TemplateURLService); |
| 577 }; | 577 }; |
| 578 | 578 |
| 579 #endif // CHROME_BROWSER_SEARCH_ENGINES_TEMPLATE_URL_SERVICE_H_ | 579 #endif // CHROME_BROWSER_SEARCH_ENGINES_TEMPLATE_URL_SERVICE_H_ |
| OLD | NEW |