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 603 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
614 base::string16 UniquifyKeyword(const TemplateURL& turl, bool force); | 614 base::string16 UniquifyKeyword(const TemplateURL& turl, bool force); |
615 | 615 |
616 // Returns true iff |local_turl| is considered "better" than |sync_turl| for | 616 // Returns true iff |local_turl| is considered "better" than |sync_turl| for |
617 // the purposes of resolving conflicts. |local_turl| must be a TemplateURL | 617 // the purposes of resolving conflicts. |local_turl| must be a TemplateURL |
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 // * |prefer_local_default| is true and |local_turl| is the local default |
| 625 // search provider |
625 bool IsLocalTemplateURLBetter(const TemplateURL* local_turl, | 626 bool IsLocalTemplateURLBetter(const TemplateURL* local_turl, |
626 const TemplateURL* sync_turl); | 627 const TemplateURL* sync_turl, |
| 628 bool prefer_local_default = true); |
627 | 629 |
628 // Given two synced TemplateURLs with a conflicting keyword, one of which | 630 // 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|) | 631 // 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|), | 632 // 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, | 633 // prepares the local model so that |unapplied_sync_turl| can be added to it, |
632 // or applied as an update to an existing TemplateURL. | 634 // or applied as an update to an existing TemplateURL. |
633 // Since both entries are known to Sync and one of their keywords will change, | 635 // 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. | 636 // 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. | 637 // Note that |applied_sync_turl| must not be an extension keyword. |
636 void ResolveSyncKeywordConflict(TemplateURL* unapplied_sync_turl, | 638 void ResolveSyncKeywordConflict(TemplateURL* unapplied_sync_turl, |
(...skipping 182 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
819 // Helper class to manage the default search engine. | 821 // Helper class to manage the default search engine. |
820 DefaultSearchManager default_search_manager_; | 822 DefaultSearchManager default_search_manager_; |
821 | 823 |
822 std::unique_ptr<GoogleURLTracker::Subscription> | 824 std::unique_ptr<GoogleURLTracker::Subscription> |
823 google_url_updated_subscription_; | 825 google_url_updated_subscription_; |
824 | 826 |
825 DISALLOW_COPY_AND_ASSIGN(TemplateURLService); | 827 DISALLOW_COPY_AND_ASSIGN(TemplateURLService); |
826 }; | 828 }; |
827 | 829 |
828 #endif // COMPONENTS_SEARCH_ENGINES_TEMPLATE_URL_SERVICE_H_ | 830 #endif // COMPONENTS_SEARCH_ENGINES_TEMPLATE_URL_SERVICE_H_ |
OLD | NEW |