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 #include "components/search_engines/template_url_service.h" | 5 #include "components/search_engines/template_url_service.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <utility> | 8 #include <utility> |
9 | 9 |
10 #include "base/auto_reset.h" | 10 #include "base/auto_reset.h" |
(...skipping 14 matching lines...) Expand all Loading... |
25 #include "components/pref_registry/pref_registry_syncable.h" | 25 #include "components/pref_registry/pref_registry_syncable.h" |
26 #include "components/rappor/rappor_service.h" | 26 #include "components/rappor/rappor_service.h" |
27 #include "components/search_engines/search_engines_pref_names.h" | 27 #include "components/search_engines/search_engines_pref_names.h" |
28 #include "components/search_engines/search_host_to_urls_map.h" | 28 #include "components/search_engines/search_host_to_urls_map.h" |
29 #include "components/search_engines/search_terms_data.h" | 29 #include "components/search_engines/search_terms_data.h" |
30 #include "components/search_engines/template_url.h" | 30 #include "components/search_engines/template_url.h" |
31 #include "components/search_engines/template_url_prepopulate_data.h" | 31 #include "components/search_engines/template_url_prepopulate_data.h" |
32 #include "components/search_engines/template_url_service_client.h" | 32 #include "components/search_engines/template_url_service_client.h" |
33 #include "components/search_engines/template_url_service_observer.h" | 33 #include "components/search_engines/template_url_service_observer.h" |
34 #include "components/search_engines/util.h" | 34 #include "components/search_engines/util.h" |
35 #include "components/url_fixer/url_fixer.h" | 35 #include "components/url_formatter/url_fixer.h" |
36 #include "net/base/net_util.h" | 36 #include "net/base/net_util.h" |
37 #include "net/base/registry_controlled_domains/registry_controlled_domain.h" | 37 #include "net/base/registry_controlled_domains/registry_controlled_domain.h" |
38 #include "sync/api/sync_change.h" | 38 #include "sync/api/sync_change.h" |
39 #include "sync/api/sync_error_factory.h" | 39 #include "sync/api/sync_error_factory.h" |
40 #include "sync/protocol/search_engine_specifics.pb.h" | 40 #include "sync/protocol/search_engine_specifics.pb.h" |
41 #include "sync/protocol/sync.pb.h" | 41 #include "sync/protocol/sync.pb.h" |
42 #include "url/gurl.h" | 42 #include "url/gurl.h" |
43 | 43 |
44 typedef SearchHostToURLsMap::TemplateURLSet TemplateURLSet; | 44 typedef SearchHostToURLsMap::TemplateURLSet TemplateURLSet; |
45 typedef TemplateURLService::SyncDataMap SyncDataMap; | 45 typedef TemplateURLService::SyncDataMap SyncDataMap; |
(...skipping 1672 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1718 // Only add visits for entries the user hasn't modified. If the user modified | 1718 // Only add visits for entries the user hasn't modified. If the user modified |
1719 // the entry the keyword may no longer correspond to the host name. It may be | 1719 // the entry the keyword may no longer correspond to the host name. It may be |
1720 // possible to do something more sophisticated here, but it's so rare as to | 1720 // possible to do something more sophisticated here, but it's so rare as to |
1721 // not be worth it. | 1721 // not be worth it. |
1722 if (!t_url.safe_for_autoreplace()) | 1722 if (!t_url.safe_for_autoreplace()) |
1723 return; | 1723 return; |
1724 | 1724 |
1725 if (!client_) | 1725 if (!client_) |
1726 return; | 1726 return; |
1727 | 1727 |
1728 GURL url( | 1728 GURL url(url_formatter::FixupURL(base::UTF16ToUTF8(t_url.keyword()), |
1729 url_fixer::FixupURL(base::UTF16ToUTF8(t_url.keyword()), std::string())); | 1729 std::string())); |
1730 if (!url.is_valid()) | 1730 if (!url.is_valid()) |
1731 return; | 1731 return; |
1732 | 1732 |
1733 // Synthesize a visit for the keyword. This ensures the url for the keyword is | 1733 // Synthesize a visit for the keyword. This ensures the url for the keyword is |
1734 // autocompleted even if the user doesn't type the url in directly. | 1734 // autocompleted even if the user doesn't type the url in directly. |
1735 client_->AddKeywordGeneratedVisit(url); | 1735 client_->AddKeywordGeneratedVisit(url); |
1736 } | 1736 } |
1737 | 1737 |
1738 void TemplateURLService::RequestGoogleURLTrackerServerCheckIfNecessary() { | 1738 void TemplateURLService::RequestGoogleURLTrackerServerCheckIfNecessary() { |
1739 if (default_search_provider_ && | 1739 if (default_search_provider_ && |
(...skipping 591 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2331 | 2331 |
2332 if (most_recently_intalled_default) { | 2332 if (most_recently_intalled_default) { |
2333 base::AutoReset<DefaultSearchChangeOrigin> change_origin( | 2333 base::AutoReset<DefaultSearchChangeOrigin> change_origin( |
2334 &dsp_change_origin_, DSP_CHANGE_OVERRIDE_SETTINGS_EXTENSION); | 2334 &dsp_change_origin_, DSP_CHANGE_OVERRIDE_SETTINGS_EXTENSION); |
2335 default_search_manager_.SetExtensionControlledDefaultSearchEngine( | 2335 default_search_manager_.SetExtensionControlledDefaultSearchEngine( |
2336 most_recently_intalled_default->data()); | 2336 most_recently_intalled_default->data()); |
2337 } else { | 2337 } else { |
2338 default_search_manager_.ClearExtensionControlledDefaultSearchEngine(); | 2338 default_search_manager_.ClearExtensionControlledDefaultSearchEngine(); |
2339 } | 2339 } |
2340 } | 2340 } |
OLD | NEW |