| 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 #pragma once | 7 #pragma once |
| 8 | 8 |
| 9 #include <map> | 9 #include <map> |
| 10 #include <set> | 10 #include <set> |
| (...skipping 261 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 272 // Processes a local TemplateURL change for Sync. |turl| is the TemplateURL | 272 // Processes a local TemplateURL change for Sync. |turl| is the TemplateURL |
| 273 // that has been modified, and |type| is the Sync ChangeType that took place. | 273 // that has been modified, and |type| is the Sync ChangeType that took place. |
| 274 // This may send a new SyncChange to the cloud. If our model has not yet been | 274 // This may send a new SyncChange to the cloud. If our model has not yet been |
| 275 // associated with Sync, or if this is triggered by a Sync change, then this | 275 // associated with Sync, or if this is triggered by a Sync change, then this |
| 276 // does nothing. | 276 // does nothing. |
| 277 void ProcessTemplateURLChange(const TemplateURL* turl, | 277 void ProcessTemplateURLChange(const TemplateURL* turl, |
| 278 SyncChange::SyncChangeType type); | 278 SyncChange::SyncChangeType type); |
| 279 | 279 |
| 280 Profile* profile() const { return profile_; } | 280 Profile* profile() const { return profile_; } |
| 281 | 281 |
| 282 void SetSearchEngineDialogSlot(int slot) { | |
| 283 search_engine_dialog_chosen_slot_ = slot; | |
| 284 } | |
| 285 | |
| 286 int GetSearchEngineDialogSlot() const { | |
| 287 return search_engine_dialog_chosen_slot_; | |
| 288 } | |
| 289 | |
| 290 // Returns a SyncData with a sync representation of the search engine data | 282 // Returns a SyncData with a sync representation of the search engine data |
| 291 // from |turl|. | 283 // from |turl|. |
| 292 static SyncData CreateSyncDataFromTemplateURL(const TemplateURL& turl); | 284 static SyncData CreateSyncDataFromTemplateURL(const TemplateURL& turl); |
| 293 | 285 |
| 294 // Returns a heap-allocated TemplateURL, populated by |sync_data|'s fields. | 286 // Returns a heap-allocated TemplateURL, populated by |sync_data|'s fields. |
| 295 // This does the opposite of CreateSyncDataFromTemplateURL. The caller owns | 287 // This does the opposite of CreateSyncDataFromTemplateURL. The caller owns |
| 296 // the returned TemplateURL*. | 288 // the returned TemplateURL*. |
| 297 static TemplateURL* CreateTemplateURLFromSyncData(const SyncData& sync_data); | 289 static TemplateURL* CreateTemplateURLFromSyncData(const SyncData& sync_data); |
| 298 | 290 |
| 299 // Returns a map mapping Sync GUIDs to pointers to SyncData. | 291 // Returns a map mapping Sync GUIDs to pointers to SyncData. |
| (...skipping 245 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 545 scoped_refptr<WebDataService> service_; | 537 scoped_refptr<WebDataService> service_; |
| 546 | 538 |
| 547 // All visits that occurred before we finished loading. Once loaded | 539 // All visits that occurred before we finished loading. Once loaded |
| 548 // UpdateKeywordSearchTermsForURL is invoked for each element of the vector. | 540 // UpdateKeywordSearchTermsForURL is invoked for each element of the vector. |
| 549 std::vector<history::URLVisitedDetails> visits_to_add_; | 541 std::vector<history::URLVisitedDetails> visits_to_add_; |
| 550 | 542 |
| 551 // Once loaded, the default search provider. This is a pointer to a | 543 // Once loaded, the default search provider. This is a pointer to a |
| 552 // TemplateURL owned by template_urls_. | 544 // TemplateURL owned by template_urls_. |
| 553 const TemplateURL* default_search_provider_; | 545 const TemplateURL* default_search_provider_; |
| 554 | 546 |
| 555 // Used for UX testing. Gives the slot in the search engine dialog that was | |
| 556 // chosen as the default search engine. | |
| 557 int search_engine_dialog_chosen_slot_; | |
| 558 | |
| 559 // The initial search provider extracted from preferences. This is only valid | 547 // The initial search provider extracted from preferences. This is only valid |
| 560 // if we haven't been loaded or loading failed. | 548 // if we haven't been loaded or loading failed. |
| 561 scoped_ptr<TemplateURL> initial_default_search_provider_; | 549 scoped_ptr<TemplateURL> initial_default_search_provider_; |
| 562 | 550 |
| 563 // Whether the default search is managed via policy. | 551 // Whether the default search is managed via policy. |
| 564 bool is_default_search_managed_; | 552 bool is_default_search_managed_; |
| 565 | 553 |
| 566 // The set of preferences observer we use to find if the default search | 554 // The set of preferences observer we use to find if the default search |
| 567 // preferences have changed. | 555 // preferences have changed. |
| 568 scoped_ptr<PrefSetObserver> default_search_prefs_; | 556 scoped_ptr<PrefSetObserver> default_search_prefs_; |
| (...skipping 25 matching lines...) Expand all Loading... |
| 594 // from Sync. This is to facilitate the fact that changes to the value of | 582 // from Sync. This is to facilitate the fact that changes to the value of |
| 595 // prefs::kSyncedDefaultSearchProviderGUID do not always come before the | 583 // prefs::kSyncedDefaultSearchProviderGUID do not always come before the |
| 596 // TemplateURL entry it refers to, and to handle the case when we want to use | 584 // TemplateURL entry it refers to, and to handle the case when we want to use |
| 597 // the Synced default when the default search provider becomes unmanaged. | 585 // the Synced default when the default search provider becomes unmanaged. |
| 598 bool pending_synced_default_search_; | 586 bool pending_synced_default_search_; |
| 599 | 587 |
| 600 DISALLOW_COPY_AND_ASSIGN(TemplateURLService); | 588 DISALLOW_COPY_AND_ASSIGN(TemplateURLService); |
| 601 }; | 589 }; |
| 602 | 590 |
| 603 #endif // CHROME_BROWSER_SEARCH_ENGINES_TEMPLATE_URL_SERVICE_H_ | 591 #endif // CHROME_BROWSER_SEARCH_ENGINES_TEMPLATE_URL_SERVICE_H_ |
| OLD | NEW |