OLD | NEW |
---|---|
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 COMPONENTS_SEARCH_ENGINES_TEMPLATE_URL_SERVICE_H_ | 5 #ifndef COMPONENTS_SEARCH_ENGINES_TEMPLATE_URL_SERVICE_H_ |
6 #define COMPONENTS_SEARCH_ENGINES_TEMPLATE_URL_SERVICE_H_ | 6 #define COMPONENTS_SEARCH_ENGINES_TEMPLATE_URL_SERVICE_H_ |
7 | 7 |
8 #include <stddef.h> | 8 #include <stddef.h> |
9 | 9 |
10 #include <list> | 10 #include <list> |
(...skipping 607 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
618 // known to the local model (though it may already be synced), and |sync_turl| | 618 // known to the local model (though it may already be synced), and |sync_turl| |
619 // is a new TemplateURL known to Sync but not yet known to the local model. | 619 // is a new TemplateURL known to Sync but not yet known to the local model. |
620 // The criteria for if |local_turl| is better than |sync_turl| is whether any | 620 // The criteria for if |local_turl| is better than |sync_turl| is whether any |
621 // of the following are true: | 621 // of the following are true: |
622 // * |local_turl|'s last_modified timestamp is newer than sync_turl. | 622 // * |local_turl|'s last_modified timestamp is newer than sync_turl. |
623 // * |local_turl| is created by policy. | 623 // * |local_turl| is created by policy. |
624 // * |local_turl| is the local default search provider. | 624 // * |local_turl| is the local default search provider. |
625 bool IsLocalTemplateURLBetter(const TemplateURL* local_turl, | 625 bool IsLocalTemplateURLBetter(const TemplateURL* local_turl, |
626 const TemplateURL* sync_turl); | 626 const TemplateURL* sync_turl); |
627 | 627 |
628 // Returns true iff |local_turl| is considered "better" than |sync_turl| for | |
629 // the purposes of resolving a conflicting prepopulate_id. |local_turl| must | |
630 // be a TemplateURL known to the local model (though it may already be | |
631 // synced), and |sync_turl| is a new TemplateURL known to Sync but not yet | |
632 // known to the local model. | |
633 // The criteria for if |local_turl| is better than |sync_turl| is whether | |
634 // either of the following is true: | |
635 // * |local_turl|'s last_modified timestamp is newer than sync_turl. | |
636 // * |local_turl| is created by policy. | |
637 // Note that even if the local turl is the default search provider, the remote | |
638 // url can still be considered better. | |
639 bool IsLocalPrepopulatedTemplateURLBetter(const TemplateURL* local_turl, | |
640 const TemplateURL* sync_turl); | |
Peter Kasting
2016/06/14 19:21:26
Nit: I'd combine these two functions into one and
Patrick Noland
2016/06/14 22:55:24
Done.
| |
641 | |
628 // Given two synced TemplateURLs with a conflicting keyword, one of which | 642 // Given two synced TemplateURLs with a conflicting keyword, one of which |
629 // needs to be added to or updated in the local model (|unapplied_sync_turl|) | 643 // needs to be added to or updated in the local model (|unapplied_sync_turl|) |
630 // and one which is already known to the local model (|applied_sync_turl|), | 644 // and one which is already known to the local model (|applied_sync_turl|), |
631 // prepares the local model so that |unapplied_sync_turl| can be added to it, | 645 // prepares the local model so that |unapplied_sync_turl| can be added to it, |
632 // or applied as an update to an existing TemplateURL. | 646 // or applied as an update to an existing TemplateURL. |
633 // Since both entries are known to Sync and one of their keywords will change, | 647 // Since both entries are known to Sync and one of their keywords will change, |
634 // an ACTION_UPDATE will be appended to |change_list| to reflect this change. | 648 // an ACTION_UPDATE will be appended to |change_list| to reflect this change. |
635 // Note that |applied_sync_turl| must not be an extension keyword. | 649 // Note that |applied_sync_turl| must not be an extension keyword. |
636 void ResolveSyncKeywordConflict(TemplateURL* unapplied_sync_turl, | 650 void ResolveSyncKeywordConflict(TemplateURL* unapplied_sync_turl, |
637 TemplateURL* applied_sync_turl, | 651 TemplateURL* applied_sync_turl, |
(...skipping 181 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
819 // Helper class to manage the default search engine. | 833 // Helper class to manage the default search engine. |
820 DefaultSearchManager default_search_manager_; | 834 DefaultSearchManager default_search_manager_; |
821 | 835 |
822 std::unique_ptr<GoogleURLTracker::Subscription> | 836 std::unique_ptr<GoogleURLTracker::Subscription> |
823 google_url_updated_subscription_; | 837 google_url_updated_subscription_; |
824 | 838 |
825 DISALLOW_COPY_AND_ASSIGN(TemplateURLService); | 839 DISALLOW_COPY_AND_ASSIGN(TemplateURLService); |
826 }; | 840 }; |
827 | 841 |
828 #endif // COMPONENTS_SEARCH_ENGINES_TEMPLATE_URL_SERVICE_H_ | 842 #endif // COMPONENTS_SEARCH_ENGINES_TEMPLATE_URL_SERVICE_H_ |
OLD | NEW |