Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(295)

Side by Side Diff: chrome/browser/search_engines/template_url_service.h

Issue 10384188: Ensure that TemplateURLs removed by prepopulate search engine merging is also removed from Sync. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: init Created 8 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 <list> 9 #include <list>
10 #include <map> 10 #include <map>
(...skipping 336 matching lines...) Expand 10 before | Expand all | Expand 10 after
347 CreateSyncDataFromTemplateURL); 347 CreateSyncDataFromTemplateURL);
348 FRIEND_TEST_ALL_PREFIXES(TemplateURLServiceSyncTest, 348 FRIEND_TEST_ALL_PREFIXES(TemplateURLServiceSyncTest,
349 CreateTemplateURLFromSyncData); 349 CreateTemplateURLFromSyncData);
350 FRIEND_TEST_ALL_PREFIXES(TemplateURLServiceSyncTest, UniquifyKeyword); 350 FRIEND_TEST_ALL_PREFIXES(TemplateURLServiceSyncTest, UniquifyKeyword);
351 FRIEND_TEST_ALL_PREFIXES(TemplateURLServiceSyncTest, 351 FRIEND_TEST_ALL_PREFIXES(TemplateURLServiceSyncTest,
352 ResolveSyncKeywordConflict); 352 ResolveSyncKeywordConflict);
353 FRIEND_TEST_ALL_PREFIXES(TemplateURLServiceSyncTest, 353 FRIEND_TEST_ALL_PREFIXES(TemplateURLServiceSyncTest,
354 FindDuplicateOfSyncTemplateURL); 354 FindDuplicateOfSyncTemplateURL);
355 FRIEND_TEST_ALL_PREFIXES(TemplateURLServiceSyncTest, 355 FRIEND_TEST_ALL_PREFIXES(TemplateURLServiceSyncTest,
356 MergeSyncAndLocalURLDuplicates); 356 MergeSyncAndLocalURLDuplicates);
357 FRIEND_TEST_ALL_PREFIXES(TemplateURLServiceSyncTest,
358 PreSyncDeletes);
357 359
358 friend class TemplateURLServiceTestUtil; 360 friend class TemplateURLServiceTestUtil;
359 361
360 typedef std::map<string16, TemplateURL*> KeywordToTemplateMap; 362 typedef std::map<string16, TemplateURL*> KeywordToTemplateMap;
361 typedef std::map<std::string, TemplateURL*> GUIDToTemplateMap; 363 typedef std::map<std::string, TemplateURL*> GUIDToTemplateMap;
362 typedef std::list<std::string> PendingExtensionIDs; 364 typedef std::list<std::string> PendingExtensionIDs;
363 365
364 // Helper functor for FindMatchingKeywords(), for finding the range of 366 // Helper functor for FindMatchingKeywords(), for finding the range of
365 // keywords which begin with a prefix. 367 // keywords which begin with a prefix.
366 class LessWithPrefix; 368 class LessWithPrefix;
(...skipping 171 matching lines...) Expand 10 before | Expand all | Expand 10 after
538 540
539 // Retrieve the pending default search provider according to Sync. Returns 541 // Retrieve the pending default search provider according to Sync. Returns
540 // NULL if there was no pending search provider from Sync. 542 // NULL if there was no pending search provider from Sync.
541 TemplateURL* GetPendingSyncedDefaultSearchProvider(); 543 TemplateURL* GetPendingSyncedDefaultSearchProvider();
542 544
543 // Goes through a vector of TemplateURLs and ensure that both the in-memory 545 // Goes through a vector of TemplateURLs and ensure that both the in-memory
544 // and database copies have valid sync_guids. This is to fix crbug.com/102038, 546 // and database copies have valid sync_guids. This is to fix crbug.com/102038,
545 // where old entries were being pushed to Sync without a sync_guid. 547 // where old entries were being pushed to Sync without a sync_guid.
546 void PatchMissingSyncGUIDs(TemplateURLVector* template_urls); 548 void PatchMissingSyncGUIDs(TemplateURLVector* template_urls);
547 549
550 // Adds |guid| to |pre_sync_deletes_|.
551 void AddPreSyncDeletedGUIDForTesting(const std::string& guid);
552
548 content::NotificationRegistrar notification_registrar_; 553 content::NotificationRegistrar notification_registrar_;
549 PrefChangeRegistrar pref_change_registrar_; 554 PrefChangeRegistrar pref_change_registrar_;
550 555
551 // Mapping from keyword to the TemplateURL. 556 // Mapping from keyword to the TemplateURL.
552 KeywordToTemplateMap keyword_to_template_map_; 557 KeywordToTemplateMap keyword_to_template_map_;
553 558
554 // Mapping from Sync GUIDs to the TemplateURL. 559 // Mapping from Sync GUIDs to the TemplateURL.
555 GUIDToTemplateMap guid_to_template_map_; 560 GUIDToTemplateMap guid_to_template_map_;
556 561
557 TemplateURLVector template_urls_; 562 TemplateURLVector template_urls_;
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after
621 // Sync's error handler. We use it to create a sync error. 626 // Sync's error handler. We use it to create a sync error.
622 scoped_ptr<SyncErrorFactory> sync_error_factory_; 627 scoped_ptr<SyncErrorFactory> sync_error_factory_;
623 628
624 // Whether or not we are waiting on the default search provider to come in 629 // Whether or not we are waiting on the default search provider to come in
625 // from Sync. This is to facilitate the fact that changes to the value of 630 // from Sync. This is to facilitate the fact that changes to the value of
626 // prefs::kSyncedDefaultSearchProviderGUID do not always come before the 631 // prefs::kSyncedDefaultSearchProviderGUID do not always come before the
627 // TemplateURL entry it refers to, and to handle the case when we want to use 632 // TemplateURL entry it refers to, and to handle the case when we want to use
628 // the Synced default when the default search provider becomes unmanaged. 633 // the Synced default when the default search provider becomes unmanaged.
629 bool pending_synced_default_search_; 634 bool pending_synced_default_search_;
630 635
636 // A set of sync GUIDs denoting TemplateURLs that have been removed from this
637 // model or the underlying WebDataService prior to MergeDataAndStartSyncing.
638 // This set is used to determine what entries from the server we want to
639 // ignore locally and return a delete command for.
640 std::set<std::string> pre_sync_deletes_;
Peter Kasting 2012/05/15 21:28:10 Is there any way to keep this as a local that's pa
SteveT 2012/05/16 13:26:43 That's a bit difficult. The reason is because the
641
631 DISALLOW_COPY_AND_ASSIGN(TemplateURLService); 642 DISALLOW_COPY_AND_ASSIGN(TemplateURLService);
632 }; 643 };
633 644
634 #endif // CHROME_BROWSER_SEARCH_ENGINES_TEMPLATE_URL_SERVICE_H_ 645 #endif // CHROME_BROWSER_SEARCH_ENGINES_TEMPLATE_URL_SERVICE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698