| 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 519 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 530 | 530 |
| 531 // Check if the default search provider has been changed and notify | 531 // Check if the default search provider has been changed and notify |
| 532 // Protector instance about it. Don't check if the default search is | 532 // Protector instance about it. Don't check if the default search is |
| 533 // managed. | 533 // managed. |
| 534 const TemplateURL* backup_default_search_provider = NULL; | 534 const TemplateURL* backup_default_search_provider = NULL; |
| 535 if (!is_default_search_managed_ && | 535 if (!is_default_search_managed_ && |
| 536 DidDefaultSearchProviderChange( | 536 DidDefaultSearchProviderChange( |
| 537 *result, | 537 *result, |
| 538 template_urls, | 538 template_urls, |
| 539 &backup_default_search_provider) && | 539 &backup_default_search_provider) && |
| 540 CommandLine::ForCurrentProcess()->HasSwitch(switches::kProtector) && | 540 !CommandLine::ForCurrentProcess()->HasSwitch(switches::kNoProtector) && |
| 541 default_search_provider) { | 541 default_search_provider) { |
| 542 // TODO: need to handle no default_search_provider better. Likely need to | 542 // TODO: need to handle no default_search_provider better. Likely need to |
| 543 // make sure the default search engine is there, and if not assume it was | 543 // make sure the default search engine is there, and if not assume it was |
| 544 // deleted and add it back. | 544 // deleted and add it back. |
| 545 | 545 |
| 546 // Protector will delete itself when it's needed no longer. | 546 // Protector will delete itself when it's needed no longer. |
| 547 protector::Protector* protector = new protector::Protector(profile()); | 547 protector::Protector* protector = new protector::Protector(profile()); |
| 548 protector->ShowChange(protector::CreateDefaultSearchProviderChange( | 548 protector->ShowChange(protector::CreateDefaultSearchProviderChange( |
| 549 default_search_provider, | 549 default_search_provider, |
| 550 backup_default_search_provider)); | 550 backup_default_search_provider)); |
| (...skipping 1307 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1858 i != template_urls->end(); ++i) { | 1858 i != template_urls->end(); ++i) { |
| 1859 TemplateURL* template_url = *i; | 1859 TemplateURL* template_url = *i; |
| 1860 DCHECK(template_url); | 1860 DCHECK(template_url); |
| 1861 if (template_url->sync_guid().empty()) { | 1861 if (template_url->sync_guid().empty()) { |
| 1862 template_url->set_sync_guid(guid::GenerateGUID()); | 1862 template_url->set_sync_guid(guid::GenerateGUID()); |
| 1863 if (service_.get()) | 1863 if (service_.get()) |
| 1864 service_->UpdateKeyword(*template_url); | 1864 service_->UpdateKeyword(*template_url); |
| 1865 } | 1865 } |
| 1866 } | 1866 } |
| 1867 } | 1867 } |
| OLD | NEW |