| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 513 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 524 // Check if default search provider is now managed. | 524 // Check if default search provider is now managed. |
| 525 scoped_ptr<TemplateURL> default_from_prefs; | 525 scoped_ptr<TemplateURL> default_from_prefs; |
| 526 LoadDefaultSearchProviderFromPrefs(&default_from_prefs, | 526 LoadDefaultSearchProviderFromPrefs(&default_from_prefs, |
| 527 &is_default_search_managed_); | 527 &is_default_search_managed_); |
| 528 | 528 |
| 529 // Check if the default search provider has been changed and notify | 529 // Check if the default search provider has been changed and notify |
| 530 // Protector instance about it. Don't check if the default search is | 530 // Protector instance about it. Don't check if the default search is |
| 531 // managed. | 531 // managed. |
| 532 const TemplateURL* backup_default_search_provider = NULL; | 532 const TemplateURL* backup_default_search_provider = NULL; |
| 533 if (!is_default_search_managed_ && | 533 if (!is_default_search_managed_ && |
| 534 CommandLine::ForCurrentProcess()->HasSwitch(switches::kProtector) && | |
| 535 DidDefaultSearchProviderChange( | 534 DidDefaultSearchProviderChange( |
| 536 *result, | 535 *result, |
| 537 template_urls, | 536 template_urls, |
| 538 &backup_default_search_provider) && | 537 &backup_default_search_provider) && |
| 538 CommandLine::ForCurrentProcess()->HasSwitch(switches::kProtector) && |
| 539 default_search_provider) { | 539 default_search_provider) { |
| 540 // TODO: need to handle no default_search_provider better. Likely need to | 540 // TODO: need to handle no default_search_provider better. Likely need to |
| 541 // make sure the default search engine is there, and if not assume it was | 541 // make sure the default search engine is there, and if not assume it was |
| 542 // deleted and add it back. | 542 // deleted and add it back. |
| 543 | 543 |
| 544 // Protector will delete itself when it's needed no longer. | 544 // Protector will delete itself when it's needed no longer. |
| 545 protector::Protector* protector = new protector::Protector(profile()); | 545 protector::Protector* protector = new protector::Protector(profile()); |
| 546 protector->ShowChange(protector::CreateDefaultSearchProviderChange( | 546 protector->ShowChange(protector::CreateDefaultSearchProviderChange( |
| 547 default_search_provider, | 547 default_search_provider, |
| 548 backup_default_search_provider)); | 548 backup_default_search_provider)); |
| (...skipping 1203 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1752 i != template_urls->end(); ++i) { | 1752 i != template_urls->end(); ++i) { |
| 1753 TemplateURL* template_url = *i; | 1753 TemplateURL* template_url = *i; |
| 1754 DCHECK(template_url); | 1754 DCHECK(template_url); |
| 1755 if (template_url->sync_guid().empty()) { | 1755 if (template_url->sync_guid().empty()) { |
| 1756 template_url->set_sync_guid(guid::GenerateGUID()); | 1756 template_url->set_sync_guid(guid::GenerateGUID()); |
| 1757 if (service_.get()) | 1757 if (service_.get()) |
| 1758 service_->UpdateKeyword(*template_url); | 1758 service_->UpdateKeyword(*template_url); |
| 1759 } | 1759 } |
| 1760 } | 1760 } |
| 1761 } | 1761 } |
| OLD | NEW |