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 181 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 192 // This will assert if the default search is managed; the UI should not be | 192 // This will assert if the default search is managed; the UI should not be |
| 193 // invoking this method in that situation. | 193 // invoking this method in that situation. |
| 194 void SetDefaultSearchProvider(const TemplateURL* url); | 194 void SetDefaultSearchProvider(const TemplateURL* url); |
| 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 // Sets the backup and marks the default search provider as verified. | |
| 203 // |url| may be null. | |
| 204 // This will assert if the default search is managed; the UI should not be | |
| 205 // invoking this method in that situation. | |
| 206 void SetVerifiedDefaultSearchProvider(const TemplateURL* url); | |
| 207 | |
| 208 // Returns the backup for the default search provider. If verification of | |
| 209 // the backup failed, returns NULL. | |
| 210 const TemplateURL* backup_default_search_provider() const { | |
| 211 return backup_default_search_provider_; | |
| 212 }; | |
| 213 | |
| 214 // Indicates if the default search provider was successfully verified on | |
| 215 // the last load. | |
| 216 bool is_default_search_provider_verified() const { | |
| 217 return is_default_search_provider_verified_; | |
| 218 } | |
| 219 | |
| 202 // Returns true if the default search is managed through group policy. | 220 // Returns true if the default search is managed through group policy. |
| 203 bool is_default_search_managed() const { return is_default_search_managed_; } | 221 bool is_default_search_managed() const { return is_default_search_managed_; } |
| 204 | 222 |
| 205 // Observers used to listen for changes to the model. | 223 // Observers used to listen for changes to the model. |
| 206 // TemplateURLService does NOT delete the observers when deleted. | 224 // TemplateURLService does NOT delete the observers when deleted. |
| 207 void AddObserver(TemplateURLServiceObserver* observer); | 225 void AddObserver(TemplateURLServiceObserver* observer); |
| 208 void RemoveObserver(TemplateURLServiceObserver* observer); | 226 void RemoveObserver(TemplateURLServiceObserver* observer); |
| 209 | 227 |
| 210 // Loads the keywords. This has no effect if the keywords have already been | 228 // Loads the keywords. This has no effect if the keywords have already been |
| 211 // loaded. | 229 // loaded. |
| (...skipping 316 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 528 scoped_refptr<WebDataService> service_; | 546 scoped_refptr<WebDataService> service_; |
| 529 | 547 |
| 530 // All visits that occurred before we finished loading. Once loaded | 548 // All visits that occurred before we finished loading. Once loaded |
| 531 // UpdateKeywordSearchTermsForURL is invoked for each element of the vector. | 549 // UpdateKeywordSearchTermsForURL is invoked for each element of the vector. |
| 532 std::vector<history::URLVisitedDetails> visits_to_add_; | 550 std::vector<history::URLVisitedDetails> visits_to_add_; |
| 533 | 551 |
| 534 // Once loaded, the default search provider. This is a pointer to a | 552 // Once loaded, the default search provider. This is a pointer to a |
| 535 // TemplateURL owned by template_urls_. | 553 // TemplateURL owned by template_urls_. |
| 536 const TemplateURL* default_search_provider_; | 554 const TemplateURL* default_search_provider_; |
| 537 | 555 |
| 556 // Once loaded, the backup default search provider. | |
| 557 // This is a pointer to a TemplateURL owned by template_urls_. | |
| 558 const TemplateURL* backup_default_search_provider_; | |
|
sky
2011/10/21 17:20:30
I don't like persisting this and is_default_search
whywhat
2011/10/21 20:31:53
Done.
| |
| 559 | |
| 560 // Indicates if the default search provider was verified successfully. | |
| 561 bool is_default_search_provider_verified_; | |
| 562 | |
| 538 // Used for UX testing. Gives the slot in the search engine dialog that was | 563 // Used for UX testing. Gives the slot in the search engine dialog that was |
| 539 // chosen as the default search engine. | 564 // chosen as the default search engine. |
| 540 int search_engine_dialog_chosen_slot_; | 565 int search_engine_dialog_chosen_slot_; |
| 541 | 566 |
| 542 // The initial search provider extracted from preferences. This is only valid | 567 // The initial search provider extracted from preferences. This is only valid |
| 543 // if we haven't been loaded or loading failed. | 568 // if we haven't been loaded or loading failed. |
| 544 scoped_ptr<TemplateURL> initial_default_search_provider_; | 569 scoped_ptr<TemplateURL> initial_default_search_provider_; |
| 545 | 570 |
| 546 // Whether the default search is managed via policy. | 571 // Whether the default search is managed via policy. |
| 547 bool is_default_search_managed_; | 572 bool is_default_search_managed_; |
| (...skipping 22 matching lines...) Expand all Loading... | |
| 570 // true, we ignore any local search engine changes, since we triggered them. | 595 // true, we ignore any local search engine changes, since we triggered them. |
| 571 bool processing_syncer_changes_; | 596 bool processing_syncer_changes_; |
| 572 | 597 |
| 573 // Sync's SyncChange handler. We push all our changes through this. | 598 // Sync's SyncChange handler. We push all our changes through this. |
| 574 SyncChangeProcessor* sync_processor_; | 599 SyncChangeProcessor* sync_processor_; |
| 575 | 600 |
| 576 DISALLOW_COPY_AND_ASSIGN(TemplateURLService); | 601 DISALLOW_COPY_AND_ASSIGN(TemplateURLService); |
| 577 }; | 602 }; |
| 578 | 603 |
| 579 #endif // CHROME_BROWSER_SEARCH_ENGINES_TEMPLATE_URL_SERVICE_H_ | 604 #endif // CHROME_BROWSER_SEARCH_ENGINES_TEMPLATE_URL_SERVICE_H_ |
| OLD | NEW |