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/environment.h" | 9 #include "base/environment.h" |
10 #include "base/i18n/case_conversion.h" | 10 #include "base/i18n/case_conversion.h" |
(...skipping 654 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
665 // The histograms should be reported even when Protector is disabled. | 665 // The histograms should be reported even when Protector is disabled. |
666 scoped_ptr<protector::BaseSettingChange> change( | 666 scoped_ptr<protector::BaseSettingChange> change( |
667 protector::CreateDefaultSearchProviderChange( | 667 protector::CreateDefaultSearchProviderChange( |
668 hijacked_default_search_provider, | 668 hijacked_default_search_provider, |
669 backup_default_search_provider.release())); | 669 backup_default_search_provider.release())); |
670 if (protector::IsEnabled()) { | 670 if (protector::IsEnabled()) { |
671 protector::ProtectorService* protector_service = | 671 protector::ProtectorService* protector_service = |
672 protector::ProtectorServiceFactory::GetForProfile(profile()); | 672 protector::ProtectorServiceFactory::GetForProfile(profile()); |
673 DCHECK(protector_service); | 673 DCHECK(protector_service); |
674 protector_service->ShowChange(change.release()); | 674 protector_service->ShowChange(change.release()); |
675 } else { | 675 } else if (service_.get()) { |
sky
2012/04/16 21:07:43
Remove this.
Ivan Korotkov
2012/04/17 09:54:10
Oops, removed.
| |
676 // Protector is turned off: set the current default search to itself | 676 // Protector is turned off: set the current default search to itself |
677 // to update the backup and sign it. Otherwise, change will be reported | 677 // to update the backup and sign it. Otherwise, change will be reported |
678 // every time when keywords are loaded until a search provider is added. | 678 // every time when keywords are loaded until a search provider is added. |
679 service_->SetDefaultSearchProvider(default_search_provider_); | 679 service_->SetDefaultSearchProvider(default_search_provider_); |
680 } | 680 } |
681 } | 681 } |
682 #endif | 682 #endif |
683 | 683 |
684 if (!is_default_search_managed_) { | 684 if (!is_default_search_managed_) { |
685 UMA_HISTOGRAM_BOOLEAN("Search.HasDefaultSearchProvider", | 685 UMA_HISTOGRAM_BOOLEAN("Search.HasDefaultSearchProvider", |
(...skipping 1284 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1970 // TODO(mpcomplete): If we allow editing extension keywords, then those | 1970 // TODO(mpcomplete): If we allow editing extension keywords, then those |
1971 // should be persisted to disk and synced. | 1971 // should be persisted to disk and synced. |
1972 if (template_url->sync_guid().empty() && | 1972 if (template_url->sync_guid().empty() && |
1973 !template_url->IsExtensionKeyword()) { | 1973 !template_url->IsExtensionKeyword()) { |
1974 template_url->data_.sync_guid = guid::GenerateGUID(); | 1974 template_url->data_.sync_guid = guid::GenerateGUID(); |
1975 if (service_.get()) | 1975 if (service_.get()) |
1976 service_->UpdateKeyword(*template_url); | 1976 service_->UpdateKeyword(*template_url); |
1977 } | 1977 } |
1978 } | 1978 } |
1979 } | 1979 } |
OLD | NEW |