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" |
11 #include "base/command_line.h" | 11 #include "base/command_line.h" |
12 #include "base/compiler_specific.h" | 12 #include "base/compiler_specific.h" |
13 #include "base/guid.h" | 13 #include "base/guid.h" |
14 #include "base/i18n/case_conversion.h" | 14 #include "base/i18n/case_conversion.h" |
15 #include "base/memory/scoped_vector.h" | 15 #include "base/memory/scoped_vector.h" |
16 #include "base/metrics/histogram.h" | 16 #include "base/metrics/histogram.h" |
17 #include "base/prefs/pref_service.h" | 17 #include "base/prefs/pref_service.h" |
| 18 #include "base/profiler/scoped_profile.h" |
18 #include "base/stl_util.h" | 19 #include "base/stl_util.h" |
19 #include "base/strings/string_number_conversions.h" | 20 #include "base/strings/string_number_conversions.h" |
20 #include "base/strings/string_split.h" | 21 #include "base/strings/string_split.h" |
21 #include "base/strings/string_util.h" | 22 #include "base/strings/string_util.h" |
22 #include "base/strings/utf_string_conversions.h" | 23 #include "base/strings/utf_string_conversions.h" |
23 #include "base/time/time.h" | 24 #include "base/time/time.h" |
24 #include "components/rappor/rappor_service.h" | 25 #include "components/rappor/rappor_service.h" |
25 #include "components/search_engines/search_engines_pref_names.h" | 26 #include "components/search_engines/search_engines_pref_names.h" |
26 #include "components/search_engines/search_host_to_urls_map.h" | 27 #include "components/search_engines/search_host_to_urls_map.h" |
27 #include "components/search_engines/search_terms_data.h" | 28 #include "components/search_engines/search_terms_data.h" |
(...skipping 790 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
818 TemplateURLService::RegisterOnLoadedCallback( | 819 TemplateURLService::RegisterOnLoadedCallback( |
819 const base::Closure& callback) { | 820 const base::Closure& callback) { |
820 return loaded_ ? | 821 return loaded_ ? |
821 scoped_ptr<TemplateURLService::Subscription>() : | 822 scoped_ptr<TemplateURLService::Subscription>() : |
822 on_loaded_callbacks_.Add(callback); | 823 on_loaded_callbacks_.Add(callback); |
823 } | 824 } |
824 | 825 |
825 void TemplateURLService::OnWebDataServiceRequestDone( | 826 void TemplateURLService::OnWebDataServiceRequestDone( |
826 KeywordWebDataService::Handle h, | 827 KeywordWebDataService::Handle h, |
827 const WDTypedResult* result) { | 828 const WDTypedResult* result) { |
| 829 // TODO(vadimt): Remove ScopedProfile below once crbug.com/422460 is fixed. |
| 830 tracked_objects::ScopedProfile tracking_profile( |
| 831 FROM_HERE_WITH_EXPLICIT_FUNCTION( |
| 832 "422460 TemplateURLService::OnWebDataServiceRequestDone")); |
| 833 |
828 // Reset the load_handle so that we don't try and cancel the load in | 834 // Reset the load_handle so that we don't try and cancel the load in |
829 // the destructor. | 835 // the destructor. |
830 load_handle_ = 0; | 836 load_handle_ = 0; |
831 | 837 |
832 if (!result) { | 838 if (!result) { |
833 // Results are null if the database went away or (most likely) wasn't | 839 // Results are null if the database went away or (most likely) wasn't |
834 // loaded. | 840 // loaded. |
835 load_failed_ = true; | 841 load_failed_ = true; |
836 web_data_service_ = NULL; | 842 web_data_service_ = NULL; |
837 ChangeToLoadedState(); | 843 ChangeToLoadedState(); |
(...skipping 1526 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2364 | 2370 |
2365 if (most_recently_intalled_default) { | 2371 if (most_recently_intalled_default) { |
2366 base::AutoReset<DefaultSearchChangeOrigin> change_origin( | 2372 base::AutoReset<DefaultSearchChangeOrigin> change_origin( |
2367 &dsp_change_origin_, DSP_CHANGE_OVERRIDE_SETTINGS_EXTENSION); | 2373 &dsp_change_origin_, DSP_CHANGE_OVERRIDE_SETTINGS_EXTENSION); |
2368 default_search_manager_.SetExtensionControlledDefaultSearchEngine( | 2374 default_search_manager_.SetExtensionControlledDefaultSearchEngine( |
2369 most_recently_intalled_default->data()); | 2375 most_recently_intalled_default->data()); |
2370 } else { | 2376 } else { |
2371 default_search_manager_.ClearExtensionControlledDefaultSearchEngine(); | 2377 default_search_manager_.ClearExtensionControlledDefaultSearchEngine(); |
2372 } | 2378 } |
2373 } | 2379 } |
OLD | NEW |