Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(32)

Side by Side Diff: chrome/browser/search_engines/template_url_service.cc

Issue 10065016: [protector] Refactoring of --no-protector code. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Mock fix Created 8 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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
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/13 15:56:22 I don't think it's possible for service_ to be NUL
Ivan Korotkov 2012/04/13 17:19:10 You're right apparently. I was confused by another
sky 2012/04/13 21:33:39 yes
Ivan Korotkov 2012/04/13 22:06:32 Done.
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 // Note that this saves the default search provider to prefs. 679 service_->SetDefaultSearchProvider(default_search_provider_);
680 SetDefaultSearchProviderNoNotify(default_search_provider_);
681 } 680 }
682 } 681 }
683 #endif 682 #endif
684 683
685 if (!is_default_search_managed_) { 684 if (!is_default_search_managed_) {
686 UMA_HISTOGRAM_BOOLEAN("Search.HasDefaultSearchProvider", 685 UMA_HISTOGRAM_BOOLEAN("Search.HasDefaultSearchProvider",
687 default_search_provider_ != NULL); 686 default_search_provider_ != NULL);
688 // Ensure that default search provider exists. See http://crbug.com/116952. 687 // Ensure that default search provider exists. See http://crbug.com/116952.
689 if (!default_search_provider_) 688 if (!default_search_provider_)
690 SetDefaultSearchProviderNoNotify(FindNewDefaultSearchProvider()); 689 SetDefaultSearchProviderNoNotify(FindNewDefaultSearchProvider());
(...skipping 1280 matching lines...) Expand 10 before | Expand all | Expand 10 after
1971 // TODO(mpcomplete): If we allow editing extension keywords, then those 1970 // TODO(mpcomplete): If we allow editing extension keywords, then those
1972 // should be persisted to disk and synced. 1971 // should be persisted to disk and synced.
1973 if (template_url->sync_guid().empty() && 1972 if (template_url->sync_guid().empty() &&
1974 !template_url->IsExtensionKeyword()) { 1973 !template_url->IsExtensionKeyword()) {
1975 template_url->data_.sync_guid = guid::GenerateGUID(); 1974 template_url->data_.sync_guid = guid::GenerateGUID();
1976 if (service_.get()) 1975 if (service_.get())
1977 service_->UpdateKeyword(*template_url); 1976 service_->UpdateKeyword(*template_url);
1978 } 1977 }
1979 } 1978 }
1980 } 1979 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698