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 "base/auto_reset.h" | 7 #include "base/auto_reset.h" |
8 #include "base/command_line.h" | 8 #include "base/command_line.h" |
9 #include "base/compiler_specific.h" | 9 #include "base/compiler_specific.h" |
10 #include "base/environment.h" | 10 #include "base/environment.h" |
(...skipping 808 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
819 bool has_default_search_provider = default_search_provider_ != NULL && | 819 bool has_default_search_provider = default_search_provider_ != NULL && |
820 default_search_provider_->SupportsReplacement(); | 820 default_search_provider_->SupportsReplacement(); |
821 UMA_HISTOGRAM_BOOLEAN(kHasDSPHistogramName, | 821 UMA_HISTOGRAM_BOOLEAN(kHasDSPHistogramName, |
822 has_default_search_provider); | 822 has_default_search_provider); |
823 // Ensure that default search provider exists. See http://crbug.com/116952. | 823 // Ensure that default search provider exists. See http://crbug.com/116952. |
824 if (!has_default_search_provider) { | 824 if (!has_default_search_provider) { |
825 bool success = | 825 bool success = |
826 SetDefaultSearchProviderNoNotify(FindNewDefaultSearchProvider()); | 826 SetDefaultSearchProviderNoNotify(FindNewDefaultSearchProvider()); |
827 DCHECK(success); | 827 DCHECK(success); |
828 } | 828 } |
829 UMA_HISTOGRAM_ENUMERATION( | 829 // Don't log anything if the user has a NULL default search provider. |
SteveT
2013/03/04 15:49:28
nit: Expand your comment a bit "Note that this mea
| |
830 kDSPHistogramName, | 830 if (default_search_provider_) { |
831 default_search_provider_ ? | 831 UMA_HISTOGRAM_ENUMERATION( |
832 default_search_provider_->prepopulate_id() : 0, | 832 kDSPHistogramName, |
833 TemplateURLPrepopulateData::kMaxPrepopulatedEngineID); | 833 default_search_provider_->prepopulate_id(), |
834 TemplateURLPrepopulateData::kMaxPrepopulatedEngineID); | |
835 } | |
834 } | 836 } |
835 | 837 |
836 NotifyObservers(); | 838 NotifyObservers(); |
837 NotifyLoaded(); | 839 NotifyLoaded(); |
838 } | 840 } |
839 | 841 |
840 string16 TemplateURLService::GetKeywordShortName(const string16& keyword, | 842 string16 TemplateURLService::GetKeywordShortName(const string16& keyword, |
841 bool* is_extension_keyword) { | 843 bool* is_extension_keyword) { |
842 const TemplateURL* template_url = GetTemplateURLForKeyword(keyword); | 844 const TemplateURL* template_url = GetTemplateURLForKeyword(keyword); |
843 | 845 |
(...skipping 1693 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2537 // TODO(mpcomplete): If we allow editing extension keywords, then those | 2539 // TODO(mpcomplete): If we allow editing extension keywords, then those |
2538 // should be persisted to disk and synced. | 2540 // should be persisted to disk and synced. |
2539 if (template_url->sync_guid().empty() && | 2541 if (template_url->sync_guid().empty() && |
2540 !template_url->IsExtensionKeyword()) { | 2542 !template_url->IsExtensionKeyword()) { |
2541 template_url->data_.sync_guid = base::GenerateGUID(); | 2543 template_url->data_.sync_guid = base::GenerateGUID(); |
2542 if (service_.get()) | 2544 if (service_.get()) |
2543 service_->UpdateKeyword(template_url->data()); | 2545 service_->UpdateKeyword(template_url->data()); |
2544 } | 2546 } |
2545 } | 2547 } |
2546 } | 2548 } |
OLD | NEW |