| OLD | NEW |
| 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 #include "chrome/browser/search_engines/template_url_service.h" | 5 #include "chrome/browser/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 19 matching lines...) Expand all Loading... |
| 30 #include "chrome/browser/rlz/rlz.h" | 30 #include "chrome/browser/rlz/rlz.h" |
| 31 #include "chrome/browser/search_engines/search_host_to_urls_map.h" | 31 #include "chrome/browser/search_engines/search_host_to_urls_map.h" |
| 32 #include "chrome/browser/search_engines/search_terms_data.h" | 32 #include "chrome/browser/search_engines/search_terms_data.h" |
| 33 #include "chrome/browser/search_engines/template_url.h" | 33 #include "chrome/browser/search_engines/template_url.h" |
| 34 #include "chrome/browser/search_engines/template_url_prepopulate_data.h" | 34 #include "chrome/browser/search_engines/template_url_prepopulate_data.h" |
| 35 #include "chrome/browser/search_engines/template_url_service_observer.h" | 35 #include "chrome/browser/search_engines/template_url_service_observer.h" |
| 36 #include "chrome/browser/search_engines/util.h" | 36 #include "chrome/browser/search_engines/util.h" |
| 37 #include "chrome/browser/webdata/web_data_service.h" | 37 #include "chrome/browser/webdata/web_data_service.h" |
| 38 #include "chrome/common/chrome_switches.h" | 38 #include "chrome/common/chrome_switches.h" |
| 39 #include "chrome/common/env_vars.h" | 39 #include "chrome/common/env_vars.h" |
| 40 #include "chrome/common/net/url_fixer_upper.h" | |
| 41 #include "chrome/common/pref_names.h" | 40 #include "chrome/common/pref_names.h" |
| 41 #include "components/url_fixer/url_fixer.h" |
| 42 #include "content/public/browser/notification_service.h" | 42 #include "content/public/browser/notification_service.h" |
| 43 #include "extensions/common/constants.h" | 43 #include "extensions/common/constants.h" |
| 44 #include "net/base/net_util.h" | 44 #include "net/base/net_util.h" |
| 45 #include "sync/api/sync_change.h" | 45 #include "sync/api/sync_change.h" |
| 46 #include "sync/api/sync_error_factory.h" | 46 #include "sync/api/sync_error_factory.h" |
| 47 #include "sync/protocol/search_engine_specifics.pb.h" | 47 #include "sync/protocol/search_engine_specifics.pb.h" |
| 48 #include "sync/protocol/sync.pb.h" | 48 #include "sync/protocol/sync.pb.h" |
| 49 #include "ui/base/l10n/l10n_util.h" | 49 #include "ui/base/l10n/l10n_util.h" |
| 50 #include "url/gurl.h" | 50 #include "url/gurl.h" |
| 51 | 51 |
| (...skipping 1819 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1871 return; | 1871 return; |
| 1872 | 1872 |
| 1873 if (!profile_) | 1873 if (!profile_) |
| 1874 return; | 1874 return; |
| 1875 | 1875 |
| 1876 HistoryService* history = | 1876 HistoryService* history = |
| 1877 HistoryServiceFactory::GetForProfile(profile_, Profile::EXPLICIT_ACCESS); | 1877 HistoryServiceFactory::GetForProfile(profile_, Profile::EXPLICIT_ACCESS); |
| 1878 if (!history) | 1878 if (!history) |
| 1879 return; | 1879 return; |
| 1880 | 1880 |
| 1881 GURL url(URLFixerUpper::FixupURL(base::UTF16ToUTF8(t_url.keyword()), | 1881 GURL url( |
| 1882 std::string())); | 1882 url_fixer::FixupURL(base::UTF16ToUTF8(t_url.keyword()), std::string())); |
| 1883 if (!url.is_valid()) | 1883 if (!url.is_valid()) |
| 1884 return; | 1884 return; |
| 1885 | 1885 |
| 1886 // Synthesize a visit for the keyword. This ensures the url for the keyword is | 1886 // Synthesize a visit for the keyword. This ensures the url for the keyword is |
| 1887 // autocompleted even if the user doesn't type the url in directly. | 1887 // autocompleted even if the user doesn't type the url in directly. |
| 1888 history->AddPage(url, base::Time::Now(), NULL, 0, GURL(), | 1888 history->AddPage(url, base::Time::Now(), NULL, 0, GURL(), |
| 1889 history::RedirectList(), | 1889 history::RedirectList(), |
| 1890 content::PAGE_TRANSITION_KEYWORD_GENERATED, | 1890 content::PAGE_TRANSITION_KEYWORD_GENERATED, |
| 1891 history::SOURCE_BROWSED, false); | 1891 history::SOURCE_BROWSED, false); |
| 1892 } | 1892 } |
| (...skipping 628 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2521 | 2521 |
| 2522 if (most_recently_intalled_default) { | 2522 if (most_recently_intalled_default) { |
| 2523 base::AutoReset<DefaultSearchChangeOrigin> change_origin( | 2523 base::AutoReset<DefaultSearchChangeOrigin> change_origin( |
| 2524 &dsp_change_origin_, DSP_CHANGE_OVERRIDE_SETTINGS_EXTENSION); | 2524 &dsp_change_origin_, DSP_CHANGE_OVERRIDE_SETTINGS_EXTENSION); |
| 2525 default_search_manager_.SetExtensionControlledDefaultSearchEngine( | 2525 default_search_manager_.SetExtensionControlledDefaultSearchEngine( |
| 2526 most_recently_intalled_default->data()); | 2526 most_recently_intalled_default->data()); |
| 2527 } else { | 2527 } else { |
| 2528 default_search_manager_.ClearExtensionControlledDefaultSearchEngine(); | 2528 default_search_manager_.ClearExtensionControlledDefaultSearchEngine(); |
| 2529 } | 2529 } |
| 2530 } | 2530 } |
| OLD | NEW |