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 369 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
380 PrefService* prefs, | 380 PrefService* prefs, |
381 const SearchTermsData& search_terms_data, | 381 const SearchTermsData& search_terms_data, |
382 TemplateURL* existing_turl, | 382 TemplateURL* existing_turl, |
383 const syncer::SyncData& sync_data, | 383 const syncer::SyncData& sync_data, |
384 syncer::SyncChangeList* change_list); | 384 syncer::SyncChangeList* change_list); |
385 | 385 |
386 // Returns a map mapping Sync GUIDs to pointers to syncer::SyncData. | 386 // Returns a map mapping Sync GUIDs to pointers to syncer::SyncData. |
387 static SyncDataMap CreateGUIDToSyncDataMap( | 387 static SyncDataMap CreateGUIDToSyncDataMap( |
388 const syncer::SyncDataList& sync_data); | 388 const syncer::SyncDataList& sync_data); |
389 | 389 |
390 // Like GetTemplateURLForKeyword(), but ignores extension-provided keywords. | |
391 TemplateURL* FindNonExtensionTemplateURLForKeyword( | |
Ian Wen
2016/10/17 23:32:21
It looks like GetTemplateURLForKeyword is already
ltian
2016/10/18 01:01:56
Done.
| |
392 const base::string16& keyword); | |
393 | |
390 #if defined(UNIT_TEST) | 394 #if defined(UNIT_TEST) |
391 void set_clock(std::unique_ptr<base::Clock> clock) { | 395 void set_clock(std::unique_ptr<base::Clock> clock) { |
392 clock_ = std::move(clock); | 396 clock_ = std::move(clock); |
393 } | 397 } |
394 #endif | 398 #endif |
395 | 399 |
396 private: | 400 private: |
397 FRIEND_TEST_ALL_PREFIXES(TemplateURLServiceTest, TestManagedDefaultSearch); | 401 FRIEND_TEST_ALL_PREFIXES(TemplateURLServiceTest, TestManagedDefaultSearch); |
398 FRIEND_TEST_ALL_PREFIXES(TemplateURLServiceTest, | 402 FRIEND_TEST_ALL_PREFIXES(TemplateURLServiceTest, |
399 UpdateKeywordSearchTermsForURL); | 403 UpdateKeywordSearchTermsForURL); |
(...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
515 // Returns false if there is a TemplateURL that has a search url with the | 519 // Returns false if there is a TemplateURL that has a search url with the |
516 // specified host and that TemplateURL has been manually modified. | 520 // specified host and that TemplateURL has been manually modified. |
517 bool CanAddAutogeneratedKeywordForHost(const std::string& host); | 521 bool CanAddAutogeneratedKeywordForHost(const std::string& host); |
518 | 522 |
519 // Returns true if the TemplateURL is replaceable. This doesn't look at the | 523 // Returns true if the TemplateURL is replaceable. This doesn't look at the |
520 // uniqueness of the keyword or host and is intended to be called after those | 524 // uniqueness of the keyword or host and is intended to be called after those |
521 // checks have been done. This returns true if the TemplateURL doesn't appear | 525 // checks have been done. This returns true if the TemplateURL doesn't appear |
522 // in the default list and is marked as safe_for_autoreplace. | 526 // in the default list and is marked as safe_for_autoreplace. |
523 bool CanReplace(const TemplateURL* t_url); | 527 bool CanReplace(const TemplateURL* t_url); |
524 | 528 |
525 // Like GetTemplateURLForKeyword(), but ignores extension-provided keywords. | |
526 TemplateURL* FindNonExtensionTemplateURLForKeyword( | |
527 const base::string16& keyword); | |
528 | |
529 // Updates the information in |existing_turl| using the information from | 529 // Updates the information in |existing_turl| using the information from |
530 // |new_values|, but the ID for |existing_turl| is retained. Notifying | 530 // |new_values|, but the ID for |existing_turl| is retained. Notifying |
531 // observers is the responsibility of the caller. Returns whether | 531 // observers is the responsibility of the caller. Returns whether |
532 // |existing_turl| was found in |template_urls_| and thus could be updated. | 532 // |existing_turl| was found in |template_urls_| and thus could be updated. |
533 // | 533 // |
534 // NOTE: This should not be called with an extension keyword as there are no | 534 // NOTE: This should not be called with an extension keyword as there are no |
535 // updates needed in that case. | 535 // updates needed in that case. |
536 bool UpdateNoNotify(TemplateURL* existing_turl, | 536 bool UpdateNoNotify(TemplateURL* existing_turl, |
537 const TemplateURL& new_values); | 537 const TemplateURL& new_values); |
538 | 538 |
(...skipping 274 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
813 // Helper class to manage the default search engine. | 813 // Helper class to manage the default search engine. |
814 DefaultSearchManager default_search_manager_; | 814 DefaultSearchManager default_search_manager_; |
815 | 815 |
816 std::unique_ptr<GoogleURLTracker::Subscription> | 816 std::unique_ptr<GoogleURLTracker::Subscription> |
817 google_url_updated_subscription_; | 817 google_url_updated_subscription_; |
818 | 818 |
819 DISALLOW_COPY_AND_ASSIGN(TemplateURLService); | 819 DISALLOW_COPY_AND_ASSIGN(TemplateURLService); |
820 }; | 820 }; |
821 | 821 |
822 #endif // COMPONENTS_SEARCH_ENGINES_TEMPLATE_URL_SERVICE_H_ | 822 #endif // COMPONENTS_SEARCH_ENGINES_TEMPLATE_URL_SERVICE_H_ |
OLD | NEW |